Skip to content

Commit 0e25afd

Browse files
committed
assert "sentry.origin"
1 parent 7efc8f6 commit 0e25afd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/Sentry.Tests/SentryLogTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
8282
{
8383
Environment = "my-environment",
8484
Release = "my-release",
85-
ServerName = hasAdditionalDefaultAttributes ? "my-server-address" : null,
8685
};
8786
var scope = new Scope(options);
8887

8988
if (hasAdditionalDefaultAttributes)
9089
{
9190
options.Dsn = ValidDsn;
91+
9292
var replaySession = Substitute.For<IReplaySession>();
9393
replaySession.ActiveReplayId.Returns(SentryId.Parse("f18176ecbb544e549fd23fbbe39064cc"));
9494
_ = scope.PropagationContext.GetOrCreateDynamicSamplingContext(options, replaySession);
@@ -101,6 +101,7 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
101101
};
102102
scope.Contexts.Browser.Name = "my-browser-name";
103103
scope.Contexts.Browser.Version = "my-browser-version";
104+
options.ServerName = "my-server-address";
104105
scope.Contexts.OperatingSystem.Name = "my-os-name";
105106
scope.Contexts.OperatingSystem.Version = "my-os-version";
106107
scope.Contexts.Device.Brand = "my-device-brand";
@@ -114,7 +115,6 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
114115
Parameters = ImmutableArray.Create(new KeyValuePair<string, object>("param", "params")),
115116
SpanId = SpanId,
116117
};
117-
log.SetAttribute("attribute", "value");
118118
log.SetDefaultAttributes(options, scope);
119119

120120
log.TryGetAttribute("sentry.replay_id", out string replayId).Should().Be(hasAdditionalDefaultAttributes);
@@ -302,6 +302,7 @@ public void WriteTo_EnvelopeItem_MaximalSerializedSentryLog()
302302
log.SetAttribute("integer-attribute", 3);
303303
log.SetAttribute("double-attribute", 4.4);
304304
log.SetDefaultAttributes(options, scope);
305+
log.SetOrigin("auto.log.sentry_tests");
305306

306307
var envelope = EnvelopeItem.FromLog(new StructuredLog([log]));
307308

@@ -433,6 +434,10 @@ public void WriteTo_EnvelopeItem_MaximalSerializedSentryLog()
433434
"device.family": {
434435
"value": "my-device-family",
435436
"type": "string"
437+
},
438+
"sentry.origin": {
439+
"value": "auto.log.sentry_tests",
440+
"type": "string"
436441
}
437442
}
438443
}

0 commit comments

Comments
 (0)