OpenTelemetry Resource

Every trace, metric and log record Binacle.Net sends carries the same resource attributes. They say which service, which copy of it and which machine the data came from.

πŸ–₯️ Attributes

host.name, process.pid and deployment.environment.name are new in 3.2.0.

βš–οΈ Who Wins

When more than one place sets the same attribute, the later one in this list wins:

  1. Binacle’s own values, above.
  2. The OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables. They also win over ServiceInstanceId. OTEL_SERVICE_NAME wins over a service.name inside OTEL_RESOURCE_ATTRIBUTES. With Azure Monitor, OTEL_SERVICE_NAME also changes the role name.
  3. The top-level AdditionalAttributes in OpenTelemetry.json.

✏️ Naming the Server

To name the server yourself, set host.name through either one:

OTEL_RESOURCE_ATTRIBUTES=host.name=my-server
{
  "OpenTelemetry": {
    "AdditionalAttributes": {
      "host.name": "my-server"
    }
  }
}

☁️ Azure Monitor

Azure Monitor maps only the service.* and k8s.* 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. See Open Telemetry.