Introduction
editThe Meziantou.Framework.OpenTelemetryCollector packages receive the telemetry that applications export with the OpenTelemetry protocol (OTLP): logs, traces and metrics. They add the OTLP endpoints to an ASP.NET Core application, over HTTP and gRPC, and pass each export request to handlers that you write, or to an in-memory store.
Use them to collect telemetry in your own service, or in tests, to check what an application exports.
What you can do with them
- Host the OTLP endpoints and receive telemetry in memory. See Getting started.
- Assert on the exported telemetry in tests, with the in-memory receiver. See Testing with the in-memory receiver.
- Handle the telemetry in code: store it, forward it, or reject part of it. See Custom handlers.
- Configure the endpoints: paths, HTTP and gRPC, Protobuf and JSON, compression and security. See Endpoints.
- Drop telemetry before it reaches the handlers, request by request or trace by trace once the whole trace is received. See Sampling and Tail sampling.
Packages
| Package | Main types |
|---|---|
Meziantou.Framework.OpenTelemetryCollector | OpenTelemetryHandler, OpenTelemetrySampler, OpenTelemetryTailSampler, OpenTelemetryReceiverOptions |
Meziantou.Framework.OpenTelemetryCollector.InMemory | InMemoryOpenTelemetryHandler, InMemoryOpenTelemetryHandlerOptions |
The in-memory package references the main one.
Namespaces
- Meziantou.Framework.OpenTelemetryCollector: the handlers, samplers, options, and the AddOpenTelemetryReceiver and MapOpenTelemetryReceiverEndpoints extension methods.
- Meziantou.Framework.OpenTelemetryCollector.InMemory: the in-memory receiver and AddInMemoryOpenTelemetryReceiver.
OpenTelemetry.Proto.*: the OTLP messages that the handlers receive, such as ExportLogsServiceRequest in OpenTelemetry.Proto.Collector.Logs.V1 and LogRecord in OpenTelemetry.Proto.Logs.V1. See the available fields.
Next steps
- Getting started: install the packages and receive your first export request.
- Testing with the in-memory receiver: check what an application exports. To check the logs an application writes through
ILogger, without OTLP, see Logging.