You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. The way that you configure OpenTelemetry depends if your project startup uses `IHostBuilder` or `IHostApplicationBuilder`, which was introduced in v2.x of the .NET isolated worker model extension.
@@ -145,6 +128,7 @@ Examples in this article assume your app is using `IHostApplicationBuilder`, whi
145
128
146
129
```csharp
147
130
builder.Services.AddOpenTelemetry()
131
+
.UseFunctionsWorkerDefaults()
148
132
.UseAzureMonitorExporter();
149
133
```
150
134
@@ -156,18 +140,8 @@ Examples in this article assume your app is using `IHostApplicationBuilder`, whi
156
140
.ConfigureServices(s =>
157
141
{
158
142
s.AddOpenTelemetry()
159
-
.WithTracing(builder =>
160
-
{
161
-
builder.AddAzureMonitorTraceExporter();
162
-
})
163
-
.WithMetrics(builder =>
164
-
{
165
-
builder.AddAzureMonitorMetricExporter();
166
-
})
167
-
.WithLogging(builder =>
168
-
{
169
-
builder.AddAzureMonitorLogExporter();
170
-
});
143
+
.UseFunctionsWorkerDefaults()
144
+
.UseAzureMonitorExporter();
171
145
})
172
146
```
173
147
@@ -177,7 +151,8 @@ Examples in this article assume your app is using `IHostApplicationBuilder`, whi
177
151
178
152
```csharp
179
153
builder.Services.AddOpenTelemetry()
180
-
.UseOtlpExporter();
154
+
.UseFunctionsWorkerDefaults()
155
+
.UseOtlpExporter();
181
156
```
182
157
183
158
### [IHostBuilder](#tab/ihostbuilder/otlp-export)
@@ -188,24 +163,14 @@ Examples in this article assume your app is using `IHostApplicationBuilder`, whi
188
163
.ConfigureServices(s =>
189
164
{
190
165
s.AddOpenTelemetry()
191
-
.WithTracing(builder =>
192
-
{
193
-
builder.AddOtlpExporter();
194
-
})
195
-
.WithMetrics(builder =>
196
-
{
197
-
builder.AddOtlpExporter();
198
-
})
199
-
.WithLogging(builder =>
200
-
{
201
-
builder.AddOtlpExporter();
202
-
});
166
+
.UseFunctionsWorkerDefaults()
167
+
.UseOtlpExporter();
203
168
})
204
169
```
205
170
206
171
---
207
172
208
-
You can export to both OpenTelemetry endpoints.
173
+
You can export to both OpenTelemetry endpoints from the same app.
209
174
::: zone-end
210
175
::: zone pivot="programming-language-java"
211
176
1. Add the required libraries to your app. The way you add libraries depends on whether you deploy using Maven or Kotlin and if you want to also send data to Application Insights.
0 commit comments