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
Copy file name to clipboardExpand all lines: troubleshoot/ingest/opentelemetry/edot-sdks/dotnet/index.md
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,4 +194,50 @@ To avoid this scenario, make sure each placeholder uses a unique name. For examp
194
194
195
195
```csharp
196
196
Logger.LogInformation("Eat your {fruit1} {fruit2} {fruit3}!", "apple", "banana", "mango");
197
-
```
197
+
```
198
+
199
+
### Custom processors are not applied to exported data
200
+
201
+
When using custom processors, be aware that they may not run before data is exported unless explicitly configured.
202
+
203
+
By default, EDOT .NET simplifies the getting started experience by applying [opinionated defaults](elastic-otel-dotnet://reference/edot-dotnet/setup/edot-defaults.md). These defaults include registering the OTLP exporter with the OpenTelemetry SDK so that telemetry data is exported automatically, without requiring additional code.
204
+
205
+
In advanced scenarios, you might want to develop custom processors that enrich telemetry data before it passes through the rest of the processing pipeline. In such circumstances, you have to add the processor to the relevant signal provider builder.
206
+
207
+
For example, if you use the following code to register a custom processor for trace data using
208
+
the `TracerProviderBuilder`, it won't work as intended:
This code will not work as desired due to EDOT .NET registering the OTLP exporter before the processor,
217
+
therefore running earlier in the pipeline than `SpanRollupProcessor`. The exact behaviour may vary or appear to
218
+
work because trace data is exported in batches and the custom processor may partially apply to trace data before
219
+
the batch is exported.
220
+
221
+
To address this, you can disable the automatic OTLP exporter registration using the `SkipOtlpExporter` option. This allows you to manually register the exporter *after* registering your custom processor.
222
+
223
+
Taking the prior example, the correct code should be as follows:
In this example, `SkipOtlpExporter` is set to `true` using the `ElasticOpenTelemetryOptions` overload of `AddElasticOpenTelemetry`. If preferred, this can also be configured using the `appSettings.json` file.
239
+
240
+
With `SkipOtlpExporter` enabled, the exporter must be added to __each__ signal that should be exported. In
241
+
this example, the OTLP exporter is manually added for logs, traces and metrics. Crucially, for traces, the
242
+
exporter is registered after the custom `SpanRollupProcessor` to ensure that trace data is batched for export
0 commit comments