File tree 2 files changed +22
-23
lines changed
2 files changed +22
-23
lines changed Original file line number Diff line number Diff line change @@ -106,17 +106,16 @@ return await Host.CreateDefaultBuilder(args)
106
106
opts .PublishMessage <RabbitMessage2 >().ToRabbitQueue (MessagingConstants .Subscriber2Queue );
107
107
108
108
// Add Open Telemetry tracing
109
- opts .Services .AddOpenTelemetryTracing (builder =>
110
- {
111
- builder
112
- .SetResourceBuilder (ResourceBuilder
113
- .CreateDefault ()
114
- .AddService (" Subscriber1" ))
115
- .AddJaegerExporter ()
116
-
117
- // Add Wolverine as a source
118
- .AddSource (" Wolverine" );
119
- });
109
+ opts .Services .AddOpenTelemetry ()
110
+ .ConfigureResource (resources => resources .AddService (" Subscriber1" )) // <-- sets service name
111
+ .WithTracing (tracing =>
112
+ {
113
+ tracing
114
+ .AddOtlpExporter () // <-- Add otlp exporter that by default outputs to the Jaeger default port
115
+
116
+ // Add Wolverine as a source
117
+ .AddSource (" Wolverine" );
118
+ });
120
119
})
121
120
122
121
// Executing with Oakton as the command line parser to unlock
Original file line number Diff line number Diff line change @@ -209,18 +209,18 @@ code sample:
209
209
<a id =' snippet-sample_enabling_open_telemetry ' ></a >
210
210
``` cs
211
211
// builder.Services is an IServiceCollection object
212
- builder .Services .AddOpenTelemetryTracing ( x =>
213
- {
214
- x . SetResourceBuilder ( ResourceBuilder
215
- . CreateDefault ()
216
- . AddService ( " OtelWebApi " )) // <-- sets service name
217
- . AddJaegerExporter ()
218
- .AddAspNetCoreInstrumentation ()
219
-
220
- // This is absolutely necessary to collect the Wolverine
221
- // open telemetry tracing information in your application
222
- .AddSource (" Wolverine" );
223
- });
212
+ builder .Services .AddOpenTelemetry ()
213
+ . ConfigureResource ( resources => resources . AddService ( " OtelWebApi " )) // <-- sets service name
214
+ . WithTracing ( tracing =>
215
+ {
216
+ tracing
217
+ . AddOtlpExporter () // <-- Add otlp exporter that by default outputs to the Jaeger default port
218
+ .AddAspNetCoreInstrumentation ()
219
+
220
+ // This is absolutely necessary to collect the Wolverine
221
+ // open telemetry tracing information in your application
222
+ .AddSource (" Wolverine" );
223
+ });
224
224
```
225
225
<sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Testing/OpenTelemetry/OtelWebApi/Program.cs#L36-L52 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_enabling_open_telemetry ' title =' Start of snippet ' >anchor</a ></sup >
226
226
<!-- endSnippet -->
You can’t perform that action at this time.
0 commit comments