-
-
Notifications
You must be signed in to change notification settings - Fork 250
feat(otel): mark span processor based OpenTelemetry setup methods as obsolete #5586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,14 +10,14 @@ using var tracerProvider = Sdk.CreateTracerProviderBuilder() | |||||
| resource.AddService( | ||||||
| serviceName: serviceName, | ||||||
| serviceVersion: serviceVersion)) | ||||||
| .AddSentry() // <-- Configure OpenTelemetry to send traces to Sentry | ||||||
| .AddSentryOtlpExporter(dsn) // <-- Configure OpenTelemetry to send traces to Sentry | ||||||
| .Build(); | ||||||
|
|
||||||
| SentrySdk.Init(o => | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To match the rest of the readme:
Suggested change
|
||||||
| { | ||||||
| options.Dsn = "...Your DSN..."; | ||||||
| options.Dsn = dsn; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here about the "var dsn" reference. |
||||||
| options.TracesSampleRate = 1.0; | ||||||
| options.UseOpenTelemetry(); // <-- Configure Sentry to use OpenTelemetry trace information | ||||||
| options.UseOtlp(); // <-- Configure Sentry to use OpenTelemetry trace information | ||||||
| }); | ||||||
| ``` | ||||||
|
|
||||||
|
|
@@ -29,4 +29,4 @@ and/or to downstream services. | |||||
|
|
||||||
| If you need to further customize header propagation in your application (e.g. propagating other vendor specific headers) | ||||||
| then you can do so by creating a `CompositeTextMapPropagator` consisting of the custom propagator(s) you need plus the | ||||||
| `SentryPropagator`. You can supply this as an optional parameter to the `AddSentry` method. | ||||||
| `SentryPropagator`. You can supply this as an optional parameter to the `AddSentryOtlpExporter` method. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,10 @@ namespace Sentry.OpenTelemetry; | |
| /// </summary> | ||
| public static class SentryOptionsExtensions | ||
| { | ||
| internal const string ObsoleteMessage = | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In other places we define this variable with more explicit names... Here we could use e.g. |
||
| "Use UseOtlp from the Sentry.OpenTelemetry.Exporter package instead. " + | ||
| "This method will be removed in future versions."; | ||
|
|
||
| /// <summary> | ||
| /// Enables OpenTelemetry instrumentation with Sentry | ||
| /// </summary> | ||
|
|
@@ -28,10 +32,7 @@ public static class SentryOptionsExtensions | |
| /// It's recommended that you set this to <c>true</c> since mixing OpenTelemetry and Sentry traces may yield | ||
| /// unexpected results. It is <c>false</c> by default for backward compatibility only. | ||
| /// </param> | ||
| /// <remarks> | ||
| /// This method of initialising the Sentry OpenTelemetry integration will be deprecated in a future major release. | ||
| /// We recommend you use the Sentry.OpenTelemetry.Exporter integration instead. | ||
| /// </remarks> | ||
| [Obsolete(ObsoleteMessage)] | ||
| public static void UseOpenTelemetry(this SentryOptions options, TracerProviderBuilder traceProviderBuilder, | ||
| TextMapPropagator? defaultTextMapPropagator = null, bool disableSentryTracing = false) | ||
| { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The obsolete method Suggested FixWrap the calls to the obsolete methods within the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C# skips the obsolete warning when the code making the call is itself marked [Obsolete]. |
||
|
|
@@ -52,10 +53,7 @@ public static void UseOpenTelemetry(this SentryOptions options, TracerProviderBu | |
| /// It's recommended that you set this to <c>true</c> since mixing OpenTelemetry and Sentry traces may yield | ||
| /// unexpected results. It is <c>false</c> by default for backward compatibility only. | ||
| /// </param> | ||
| /// <remarks> | ||
| /// This method of initialising the Sentry OpenTelemetry integration will be deprecated in a future major release. | ||
| /// We recommend you use the Sentry.OpenTelemetry.Exporter integration instead. | ||
| /// </remarks> | ||
| [Obsolete(ObsoleteMessage)] | ||
| public static void UseOpenTelemetry(this SentryOptions options, bool disableSentryTracing = false) | ||
| { | ||
| options.Instrumenter = Instrumenter.OpenTelemetry; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,10 @@ namespace Sentry.OpenTelemetry; | |||||
| /// </summary> | ||||||
| public static class TracerProviderBuilderExtensions | ||||||
| { | ||||||
| internal const string ObsoleteMessage = | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we could use e.g. |
||||||
| "Use AddSentryOtlpExporter from the Sentry.OpenTelemetry.Exporter package instead. " + | ||||||
| "This method will be removed in version 7.0.0."; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| /// <summary> | ||||||
| /// <para> | ||||||
| /// Ensures OpenTelemetry trace information is sent to Sentry. OpenTelemetry spans will be converted to Sentry spans | ||||||
|
|
@@ -35,10 +39,7 @@ public static class TracerProviderBuilderExtensions | |||||
| /// </para> | ||||||
| /// </param> | ||||||
| /// <returns>The supplied <see cref="TracerProviderBuilder"/> for chaining.</returns> | ||||||
| /// <remarks> | ||||||
| /// This method of initialising the Sentry OpenTelemetry integration will be deprecated in a future major release. | ||||||
| /// We recommend you use the Sentry.OpenTelemetry.Exporter integration instead. | ||||||
| /// </remarks> | ||||||
| [Obsolete(ObsoleteMessage)] | ||||||
| public static TracerProviderBuilder AddSentry(this TracerProviderBuilder tracerProviderBuilder, | ||||||
| TextMapPropagator? defaultTextMapPropagator = null) | ||||||
| { | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here in the README we don't have the
var dsnfrom the samples, but not a big deal.We could add the
var dsn = "...Your DSN..."declaration above in the examples, or not. Your call!