Configuration ‐ Diagnostics Module ‐ OpenTelemetry - ChrisMavrommatis/Binacle.Net GitHub Wiki

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": "1",
    "AdditionalAttributes": {
      
    },
    "Otlp": {
      "Enabled": false,
      "Endpoint": null,
      "Protocol": "grpc"
    },
    "AzureMonitor": {
      "Enabled": false,
      "ConnectionString": null,
      "EnableLiveMetrics": false,
      "SamplingRatio": 1
    },
    "Metrics": {
      "AdditionalMeters": [

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

      ],
      "AdditionalAttributes": {
        
      }
    },
    "Logging": {
      "AdditionalAttributes": {
        
      }
    }
  }
}

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

  • 📁 Location: /app/Config_Files/DiagnosticsModule
  • 📌 Full Path: /app/Config_Files/DiagnosticsModule/OpenTelemetry.Production.json

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

🔧 Configuration Options

🌍 General Settings

  • ServiceNamespace (string) – Defines the namespace for your service.
  • ServiceInstanceId (string) – Unique identifier for the service instance.
  • AdditionalAttributes (object) – Custom key-value attributes to attach to telemetry data.

📊 Metrics

  • AdditionalMeters (array) – List of additional meters to include for metric collection.
  • AdditionalAttributes (object) – Custom attributes for metrics.

🎯 Tracing

  • AdditionalSources (array) – Additional tracing sources to listen to.
  • AdditionalAttributes (object) – Custom attributes for traces.

📜 Logging

  • AdditionalAttributes (object) – Custom attributes for log entries.

🌐 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.

  • Enabled (boolean) – Enables or disables the OTLP exporter.
  • Endpoint (string?) – The OTLP collector URL (e.g., http://localhost:4317).
  • Protocol (string) – Supported values:
    • "grpc" (default)
    • "http/protobuf"

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.

☁️ Azure Monitor Exporter

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

  • Enabled (boolean) – Enables or disables the Azure Monitor exporter.
  • ConnectionString (string?) – The Azure Monitor connection string.
  • EnableLiveMetrics (boolean) – Enables live metrics streaming in Application Insights.
  • SamplingRatio (float, default: 1) – Defines how much telemetry data to sample (1 = 100% of requests, 0.5 = 50%, etc.).

🔹 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.