extensions:
  health_check:
  # pprof:
  zpages:
  basicauth/grafana_cloud_tempo:
    # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/basicauthextension
    client_auth:
      username: "853044"
      password: "glc_eyJvIjoiMTA5NTM0MyIsIm4iOiJzdGFjay05MDA5NDctaW50ZWdyYXRpb24tZ3VydS1jb2xsZWN0b3IiLCJrIjoiNFJGWFo4bWRVWDI3WjkyZTRQNFJiMzB2IiwibSI6eyJyIjoicHJvZC1ldS13ZXN0LTIifX0="
  basicauth/grafana_cloud_prometheus:
    client_auth:
      username: "1515927"
      password: "glc_eyJvIjoiMTA5NTM0MyIsIm4iOiJzdGFjay05MDA5NDctaW50ZWdyYXRpb24tZ3VydS1jb2xsZWN0b3IiLCJrIjoiNFJGWFo4bWRVWDI3WjkyZTRQNFJiMzB2IiwibSI6eyJyIjoicHJvZC1ldS13ZXN0LTIifX0="
  basicauth/grafana_cloud_loki:
    client_auth:
      username: "858728"
      password: "glc_eyJvIjoiMTA5NTM0MyIsIm4iOiJzdGFjay05MDA5NDctaW50ZWdyYXRpb24tZ3VydS1jb2xsZWN0b3IiLCJrIjoiNFJGWFo4bWRVWDI3WjkyZTRQNFJiMzB2IiwibSI6eyJyIjoicHJvZC1ldS13ZXN0LTIifX0="

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch: # https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor
  attributes:
    actions:
      - action: insert
        key: loki.attribute.labels
        value: [component, function, endpoint]
  resource:
    attributes:
      - action: insert
        key: loki.resource.labels
        value: [host.name, service.name, service.namespace]

exporters:
  otlp/tempo:
    endpoint: tempo:4317
    tls:
      insecure: true
  prometheusremotewrite:
    endpoint: http://prometheus.example.com:9411/api/prom/push
  otlphttp/loki:
    endpoint: http://loki:3100/otlp
  otlp/grafana_cloud_traces:
    # https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlpexporter
    endpoint: "tempo-prod-10-prod-eu-west-2.grafana.net:443"
    auth:
      authenticator: basicauth/grafana_cloud_tempo
  loki/grafana_cloud_logs:
    # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/lokiexporter
    endpoint: "https://logs-prod-012.grafana.net/loki/api/v1/push"
    auth:
      authenticator: basicauth/grafana_cloud_loki
  prometheusremotewrite/grafana_cloud_metrics:
    # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/prometheusremotewriteexporter
    endpoint: "https://prometheus-prod-24-prod-eu-west-2.grafana.net/api/prom/push"
    add_metric_suffixes: false
    auth:
      authenticator: basicauth/grafana_cloud_prometheus

service:
  extensions:
    - health_check
    - zpages
    - basicauth/grafana_cloud_tempo
    - basicauth/grafana_cloud_prometheus
    - basicauth/grafana_cloud_loki

  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp/tempo, otlp/grafana_cloud_traces]
    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters:
        - prometheusremotewrite
        - prometheusremotewrite/grafana_cloud_metrics
    logs:
      receivers: [otlp]
      processors: [attributes, resource, batch]
      exporters: [otlphttp/loki, loki/grafana_cloud_logs]