# https://uptrace.dev/opentelemetry/collector#installation
# Receivers configure how data gets into the Collector
receivers:
  otlp:
    protocols:
      grpc:
      http:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      cpu:
      memory:
      disk:
      filesystem:
      network:
      load:
  prometheus:
    config:
      scrape_configs:
        - job_name: 'caddy'
          scrape_interval: 1m
          static_configs:
            - targets: ['localhost:2019']
        - job_name: 'miniflux'
          scrape_interval: 30s
          static_configs:
            - targets: ['localhost:8002']
        - job_name: 'restic-rest'
          scrape_interval: 30s
          static_configs:
            - targets: ['localhost:8000']

# Processors specify what happens with the received data
processors:
  resourcedetection:
    detectors: [env, system]
  # cumulativetodelta:
  batch:
    send_batch_size: 10000
    timeout: 10s

exporters:
  otlphttp/traces:
    endpoint: '{{ otel_traces_endpoint }}'
    # auth:
    #   authenticator: basicauth/client
    headers:
      # x-greptime-db-name: '<your_db_name>'
      x-greptime-pipeline-name: 'greptime_trace_v1'
    tls:
      insecure: true
  otlphttp/logs:
    endpoint: '{{ otel_logs_endpoint }}'
    # auth:
    #   authenticator: basicauth/client
    headers:
      # x-greptime-db-name: '<your_db_name>'
      # x-greptime-log-table-name: '<table_name>'
      # x-greptime-pipeline-name: '<pipeline_name>'
    tls:
      insecure: true

  otlphttp/metrics:
    endpoint: '{{ otel_metrics_endpoint }}'
    # auth:
    #   authenticator: basicauth/client
    headers:
      x-greptime-otlp-metric-promote-all-resource-attrs: 'true'
      # x-greptime-db-name: '<your_db_name>'
    tls:
      insecure: true

# Service pipelines pull the configured receivers, processors, and exporters together
# into pipelines that process data
#
# Note: Receivers, processors, and exporters not used in pipelines are silently ignored
service:
  pipelines:
    metrics:
      receivers: [otlp, hostmetrics, prometheus]
      processors: [batch, resourcedetection]
      exporters: [otlphttp/metrics]
    traces:
      receivers: [otlp]
      processors: [batch, resourcedetection]
      exporters: [otlphttp/traces]
    logs:
      receivers: [otlp]
      processors: [batch, resourcedetection]
      exporters: [otlphttp/logs]
