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 "single scraper" rule for Kubernetes
  • Resource allocation and scaling
  • Security and secret management

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.

YAML
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:
        max_size: 10485760 # 10 MiB
        sizer: bytes

service:
  pipelines:
    logs/dbmon:
      receivers: [sqlserver]
      processors: [memory_limiter, batch]
      exporters: [otlp_http/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.

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

exporters:
  otlp_http/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:
        max_size: 10485760 # 10 MiB
        sizer: bytes

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