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

# Keep this aligned with helm-charts/pipeline/charts/vector/templates/configmap.yaml in production
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:
  file_out:
    type: file
    inputs: [datadog_transformation]
    path: "/output/metrics-%Y-%m-%dT%H-%M-%S.ndjson"
    encoding:
      codec: json
