data_dir: /var/lib/vector
api:
  enabled: true
  address: 0.0.0.0:8686
  playground: false

sources:
  metrics_in:
    type: opentelemetry
    grpc:
      address: 0.0.0.0:14317
    http:
      address: 0.0.0.0:14318

transforms:
  datadog_transformation:
    type: remap
    drop_on_abort: true
    reroute_dropped: true
    inputs: ["metrics_in.metrics"]
    source: |
      .tags.host = "tidbcloud.com"
      if exists(.tags."resource.instance_id") {
        .tags.instance_id = .tags."resource.instance_id"
      } else if exists(.tags."resource.cluster_id") {
        .tags.cluster_id = .tags."resource.cluster_id"
      }

sinks:
  datadog_metrics:
    type: datadog_metrics
    inputs: [datadog_transformation]
    default_api_key: "__DD_API_KEY__"
    site: "__DD_SITE__"
    request:
      timeout_secs: 30
      retry_attempts: 5
      retry_initial_backoff_secs: 1
    batch:
      timeout_secs: 5
