Observability
SquidStd.Telemetry.OpenTelemetry wires OpenTelemetry tracing and metrics into
the bootstrap as a managed service. Spans flow from SquidStd's own
ActivitySource instances and from anything else in your process.
Steps
- Add the package
SquidStd.Telemetry.OpenTelemetry. - Register telemetry with
AddSquidStdTelemetry, passing aTelemetryOptionswith yourServiceName. - Choose an exporter. Set
OtlpEndpoint/OtlpProtocolto ship to a collector (the default endpoint ishttp://localhost:4317, gRPC). For local debugging setEnableConsoleExporter = trueto also print spans to stdout. - Tune sampling with
TracingSampleRatio(0..1) and toggle pipelines withEnableTracing/EnableMetrics.
bootstrap.ConfigureServices(container =>
container.AddSquidStdTelemetry(new TelemetryOptions
{
ServiceName = "orders-worker",
OtlpEndpoint = "http://otel-collector:4317",
OtlpProtocol = OtlpProtocolType.Grpc,
EnableConsoleExporter = false,
TracingSampleRatio = 1.0
}));
ActivitySource convention
SquidStd modules name their ActivitySource instances with the SquidStd.*
prefix (for example SquidStd.Messaging). Subscribe to that prefix in your
collector or tracer-provider configuration to capture all framework spans, and
follow the same convention for your own application sources.