Open Telemetry

OpenTelemetry offers distributed tracing, metrics, and logging, enabling you to monitor and analyze your applicationโ€™s performance.

If Binacle.Net is part of your system, you can push telemetry data to popular platforms like Grafana, Jaeger, Prometheus, and Azure Application Insights for real-time observability.

๐Ÿ› ๏ธ Configuration

OpenTelemetry is configured via the OpenTelemetry.json file.

Below is the default configuration:

{
  "OpenTelemetry": {
    "ServiceNamespace": "binacle",
    "ServiceInstanceId": null,
    "AdditionalAttributes": {

    },
    "Otlp": {
      "Enabled": false,
      "Endpoint": null,
      "Protocol": "grpc",
      "Metrics": true,
      "Tracing": true,
      "Logging": true
    },
    "AzureMonitor": {
      "Enabled": false,
      "ConnectionString": null,
      "EnableLiveMetrics": false,
      "SamplingRatio": 1.0
    },
    "Metrics": {
      "AdditionalMeters": [

      ]
    },
    "Tracing": {
      "AdditionalSources": [

      ]
    }
  }
}

You can modify OpenTelemetry configuration using Production Overrides by creating an OpenTelemetry.Production.json file, or by using Environment Variables.

For more information on overriding configurations, refer to the Configuration page.

๐Ÿ”ง Configuration Options

๐ŸŒ General Settings

Before 3.2.0, ServiceInstanceId defaulted to "1", which made every running copy look like the same one. If a dashboard or alert filters on "1", change it, or set ServiceInstanceId yourself.

๐Ÿ“Š Metrics

๐ŸŽฏ Tracing

Deprecated in 3.2.0: the AdditionalAttributes under Metrics, Tracing and Logging. They still work, and a warning is logged at startup when one has values. Move the values to the top-level AdditionalAttributes, which applies to every signal. They will be removed in 4.0.0.

๐ŸŒ OTLP (OpenTelemetry Protocol) Exporter

The OTLP Exporter is the recommended way to send OpenTelemetry data.

It allows you to export traces, metrics, and logs to platforms like Grafana, Jaeger, Tempo, Prometheus, and more.

With http/protobuf, each signal goes to /v1/metrics, /v1/traces or /v1/logs, after any path already on the endpoint: http://host:4318/otel/ sends traces to http://host:4318/otel/v1/traces. With grpc the endpoint is used as given.

The recommended way to configure the OTLP exporter is via the officially supported environment variables.

For a full list of available variables, check the OpenTelemetry .NET OTLP Exporter Docs.

๐Ÿ”„ OTLP Environment Variables

With any of the three switches off, no OTEL_EXPORTER_OTLP_<SIGNAL>_* variable is read. The signals still on share the one endpoint, from Endpoint or OTEL_EXPORTER_OTLP_ENDPOINT.

โ˜๏ธ Azure Monitor Exporter

The Azure Monitor Exporter sends telemetry to Azure Application Insights for monitoring and live diagnostics.

๐Ÿ”น Azure Monitor Exporter requires an Application Insights resource. You can retrieve your connection string from the Azure Portal under the โ€œInstrumentation Keyโ€ section of your Application Insights instance.

Azure Monitor always gets all three signals; the OTLP Metrics, Tracing and Logging switches do not apply to it. It maps only the service.* and k8s.* resource attributes onto its records. host.name, process.pid and deployment.environment.name reach it only through its _OTELRESOURCE_ metric, which the OTEL_DOTNET_AZURE_MONITOR_ENABLE_RESOURCE_METRICS environment variable turns on.

๐Ÿ“ก What Binacle Sends

With OpenTelemetry on, Binacle sends:

Every signal carries the same resource attributes.

๐Ÿงฉ Scopes

Scope Meter Trace source Collected
Binacle.Net yes yes always
Binacle.Net.DiagnosticsModule yes no always
Binacle.Lib no yes only when Tracing.AdditionalSources lists it

The Binacle.Net and Binacle.Net.DiagnosticsModule scopes carry the Binacle version, so a backend can tell which release produced a series.

๐Ÿฉบ Health Checks Left Out

With health checks on, requests to the health-check path make no span and are not counted in the HTTP request metrics, so probes do not bury real traffic. The health checks themselves are unchanged. Added in 3.2.0.

๐Ÿงช Stability

Binacleโ€™s own names are experimental in 3.x. That covers every binacle.* metric and attribute, the span names on the Binacle.Net and Binacle.Lib sources, and the Binacle.Net, Binacle.Net.DiagnosticsModule and Binacle.Lib scope names. A minor release may change one, and the release notes will say so.

The built-in names follow OpenTelemetry and .NET, not Binacle: http.*, aspnetcore.*, dotnet.*, kestrel.* and db.*, such as http.server.request.duration.