diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4deb0480d0..9e3be3ec2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
- Spans and Transactions now implement `IDisposable` so that they can be used with `using` statements/declarations that will automatically finish the span with a status of OK when it passes out of scope, if it has not already been finished, to be consistent with `Activity` classes when using OpenTelemetry ([#4627](https://github.com/getsentry/sentry-dotnet/pull/4627))
- SpanTracer and TransactionTracer are still public but these are now `sealed` (see also [#4627](https://github.com/getsentry/sentry-dotnet/pull/4627))
- CaptureFeedback now returns a `SentryId` and a `CaptureFeedbackResult` out parameter that indicate whether feedback was captured successfully and what the reason for failure was otherwise ([#4613](https://github.com/getsentry/sentry-dotnet/pull/4613))
+- `IScopeObserver.AddBreadcrumb` now takes a `SentryHint` as a second parameter ([#4694](https://github.com/getsentry/sentry-dotnet/pull/4694))
### Features
diff --git a/src/Sentry/IScopeObserver.cs b/src/Sentry/IScopeObserver.cs
index 2e8c8ec6ab..3db64df947 100644
--- a/src/Sentry/IScopeObserver.cs
+++ b/src/Sentry/IScopeObserver.cs
@@ -8,7 +8,7 @@ public interface IScopeObserver
///
/// Adds a breadcrumb.
///
- public void AddBreadcrumb(Breadcrumb breadcrumb);
+ public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint);
///
/// Sets an extra.
diff --git a/src/Sentry/Internal/ScopeObserver.cs b/src/Sentry/Internal/ScopeObserver.cs
index feb1411747..513c13587e 100644
--- a/src/Sentry/Internal/ScopeObserver.cs
+++ b/src/Sentry/Internal/ScopeObserver.cs
@@ -17,15 +17,15 @@ public ScopeObserver(
_options = options;
}
- public void AddBreadcrumb(Breadcrumb breadcrumb)
+ public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint)
{
_options.DiagnosticLogger?.Log(SentryLevel.Debug,
"{0} Scope Sync - Adding breadcrumb m:\"{1}\" l:\"{2}\"", null, _name,
breadcrumb.Message, breadcrumb.Level);
- AddBreadcrumbImpl(breadcrumb);
+ AddBreadcrumbImpl(breadcrumb, hint);
}
- public abstract void AddBreadcrumbImpl(Breadcrumb breadcrumb);
+ public abstract void AddBreadcrumbImpl(Breadcrumb breadcrumb, SentryHint hint);
public void SetExtra(string key, object? value)
{
diff --git a/src/Sentry/Platforms/Android/AndroidScopeObserver.cs b/src/Sentry/Platforms/Android/AndroidScopeObserver.cs
index c2a272061f..d64e4ac11a 100644
--- a/src/Sentry/Platforms/Android/AndroidScopeObserver.cs
+++ b/src/Sentry/Platforms/Android/AndroidScopeObserver.cs
@@ -18,16 +18,17 @@ public AndroidScopeObserver(SentryOptions options)
_innerObserver = observer is AndroidScopeObserver ? null : observer;
}
- public void AddBreadcrumb(Breadcrumb breadcrumb)
+ public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint)
{
try
{
var b = breadcrumb.ToJavaBreadcrumb();
- JavaSdk.Sentry.AddBreadcrumb(b);
+ var h = hint.ToJavaHint();
+ JavaSdk.Sentry.AddBreadcrumb(b, h);
}
finally
{
- _innerObserver?.AddBreadcrumb(breadcrumb);
+ _innerObserver?.AddBreadcrumb(breadcrumb, hint);
}
}
diff --git a/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs b/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs
index d4e7def7a8..45fca06962 100644
--- a/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs
+++ b/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs
@@ -18,7 +18,7 @@ public CocoaScopeObserver(SentryOptions options)
_innerObserver = observer is CocoaScopeObserver ? null : observer;
}
- public void AddBreadcrumb(Breadcrumb breadcrumb)
+ public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint)
{
try
{
@@ -27,7 +27,7 @@ public void AddBreadcrumb(Breadcrumb breadcrumb)
}
finally
{
- _innerObserver?.AddBreadcrumb(breadcrumb);
+ _innerObserver?.AddBreadcrumb(breadcrumb, hint);
}
}
diff --git a/src/Sentry/Platforms/Native/NativeScopeObserver.cs b/src/Sentry/Platforms/Native/NativeScopeObserver.cs
index b278bf1e83..edf9b9812f 100644
--- a/src/Sentry/Platforms/Native/NativeScopeObserver.cs
+++ b/src/Sentry/Platforms/Native/NativeScopeObserver.cs
@@ -10,7 +10,7 @@ internal class NativeScopeObserver : ScopeObserver
{
public NativeScopeObserver(SentryOptions options) : base("Native", options) { }
- public override void AddBreadcrumbImpl(Breadcrumb breadcrumb)
+ public override void AddBreadcrumbImpl(Breadcrumb breadcrumb, SentryHint hint)
{
// see https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/
var crumb = C.sentry_value_new_breadcrumb(breadcrumb.Type, breadcrumb.Message);
diff --git a/src/Sentry/Scope.cs b/src/Sentry/Scope.cs
index 04fab75ff1..bdcf432434 100644
--- a/src/Sentry/Scope.cs
+++ b/src/Sentry/Scope.cs
@@ -348,7 +348,7 @@ public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint)
_breadcrumbs.Enqueue(breadcrumb);
if (Options.EnableScopeSync)
{
- Options.ScopeObserver?.AddBreadcrumb(breadcrumb);
+ Options.ScopeObserver?.AddBreadcrumb(breadcrumb, hint);
}
}
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
index c9e1f7fb87..bcbe7545d0 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
@@ -215,7 +215,7 @@ namespace Sentry
}
public interface IScopeObserver
{
- void AddBreadcrumb(Sentry.Breadcrumb breadcrumb);
+ void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint);
void SetExtra(string key, object? value);
void SetTag(string key, string value);
void SetTrace(Sentry.SentryId traceId, Sentry.SpanId parentSpanId);
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
index c9e1f7fb87..bcbe7545d0 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
@@ -215,7 +215,7 @@ namespace Sentry
}
public interface IScopeObserver
{
- void AddBreadcrumb(Sentry.Breadcrumb breadcrumb);
+ void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint);
void SetExtra(string key, object? value);
void SetTag(string key, string value);
void SetTrace(Sentry.SentryId traceId, Sentry.SpanId parentSpanId);
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
index c9e1f7fb87..bcbe7545d0 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
@@ -215,7 +215,7 @@ namespace Sentry
}
public interface IScopeObserver
{
- void AddBreadcrumb(Sentry.Breadcrumb breadcrumb);
+ void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint);
void SetExtra(string key, object? value);
void SetTag(string key, string value);
void SetTrace(Sentry.SentryId traceId, Sentry.SpanId parentSpanId);
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
index c95975f156..19207749f7 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
@@ -203,7 +203,7 @@ namespace Sentry
}
public interface IScopeObserver
{
- void AddBreadcrumb(Sentry.Breadcrumb breadcrumb);
+ void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint);
void SetExtra(string key, object? value);
void SetTag(string key, string value);
void SetTrace(Sentry.SentryId traceId, Sentry.SpanId parentSpanId);
diff --git a/test/Sentry.Tests/ScopeTests.cs b/test/Sentry.Tests/ScopeTests.cs
index 0bb65dc8ec..63621a98d5 100644
--- a/test/Sentry.Tests/ScopeTests.cs
+++ b/test/Sentry.Tests/ScopeTests.cs
@@ -686,14 +686,15 @@ public void AddBreadcrumb_ObserverExist_ObserverAddsBreadcrumbIfEnabled(bool obs
EnableScopeSync = observerEnable
});
var breadcrumb = new Breadcrumb(message: "1234");
+ var hint = new SentryHint(key: "k", value: "v");
var expectedCount = observerEnable ? 2 : 0;
// Act
- scope.AddBreadcrumb(breadcrumb);
- scope.AddBreadcrumb(breadcrumb);
+ scope.AddBreadcrumb(breadcrumb, hint);
+ scope.AddBreadcrumb(breadcrumb, hint);
// Assert
- observer.Received(expectedCount).AddBreadcrumb(Arg.Is(breadcrumb));
+ observer.Received(expectedCount).AddBreadcrumb(Arg.Is(breadcrumb), Arg.Is(hint));
}
[Fact]