1.7 KiB
1.7 KiB
Building your own Exporter
- To export telemetry to a specific destination, custom exporters must be written.
- Exporters should inherit from
ActivityExporterand implementExportandShutdownmethods.ActivityExporteris part of the OpenTelemetry Package. - Depending on user's choice and load on the application,
Exportmay get called with zero or more activities. - Exporters will only receive sampled-in and ended activities.
- Exporters must not throw.
- Exporters should not modify activities they receive (the same activity may be exported again by different exporter).
- Any retry logic that is required by the exporter is the responsibility of the exporter, as the SDK does not implement retry logic.
Example
A sample exporter, which simply writes activity name to the console is shown here.
Apart from the exporter itself, you should also provide extension methods as
shown here. This allows users to add the
Exporter to the TracerProvider as shown in the sample code
here.
To run the full example code demonstrating the exporter, run the following command from this folder.
dotnet run
References
- Exporter specification
- Exporters provided by this repository.