Best practices for configuring gateway OpenTelemetry Collectors

If your OpenTelemetry Collector is running in gateway mode, follow these best practices for configuring its routing of events from the Microsoft SQL Server receiver.

The best practice is to establish a dedicated, direct channel for Microsoft SQL Server events from the sqlserver receiver to an OpenTelemetry Collector running in gateway mode. The receiver sends these events as logs to a unique OTLP HTTP endpoint on the gateway. The gateway, in turn, has a dedicated receiver configured to listen exclusively on this endpoint, ensuring it directs these events to the Database Monitoring pipeline (dbmon).

This approach provides a clear separation of concerns, making the Database Monitoring data flow transparent and robust.

This approach has several benefits:

  • Efficiency: A dedicated port and receiver allow the gateway to immediately process Database Monitoring events.

  • Clarity: The data flow is explicit. Receivers send Database Monitoring events to a specific port, and the gateway expects only that data there, simplifying configuration and troubleshooting.

  • Isolation: Critical Database Monitoring data is isolated to its own channel.

Sample configurations:

sqlserver receiver running in an agent mode collector

The agent is responsible for collecting database metrics and events, and then exporting them directly to a dedicated endpoint on the gateway.

receivers:
  sqlserver:
    collection_interval: 10s
    username: sa
    password: secure-password
    server: mssql-server.mssqltest.svc.cluster.local
    port: 1433
    resource_attributes:
      sqlserver.computer.name:
        enabled: true
      sqlserver.instance.name:
        enabled: true
    events:
      db.server.query_sample:
        enabled: true
      db.server.top_query:
        enabled: true
    top_query_collection:
      lookback_time: 120s

exporters:
  otlphttp/dbmon:
    endpoint: "http://${SPLUNK_GATEWAY_URL}:7276" # Direct endpoint to gateway's dedicated dbmon receiver
    sending_queue:
      batch:
        flush_timeout: 15s
        max_size: 10485760 # 10 MiB
        sizer: bytes

service:
  pipelines:
    logs/dbmon:
      receivers: [sqlserver]
      processors: [memory_limiter, batch]
      exporters: [otlphttp/dbmon]
Agent mode collector sending to gateway mode collector

The gateway is configured to receive Database Monitoring events as logs on a specific, dedicated OTLP HTTP endpoint.

receivers:
  otlp/dbmon:
    protocols:
      http:
        endpoint: "${SPLUNK_LISTEN_INTERFACE}:7276" # Dedicated port for dbmon events

exporters:
  otlphttp/dbmon:
    headers:
      X-SF-Token: "${SPLUNK_ACCESS_TOKEN}"
      X-splunk-instrumentation-library: dbmon
    logs_endpoint: "${SPLUNK_INGEST_URL}/v3/event" # Final destination for dbmon events
    sending_queue:
      batch:
        flush_timeout: 15s
        max_size: 10485760 # 10 MiB
        sizer: bytes

service:
  pipelines:
    logs/dbmon:
      receivers: [otlp/dbmon]
      processors: [memory_limiter, batch]
      exporters: [otlphttp/dbmon]