open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.88k stars 2.26k forks source link

[exporter/loki] Promote nested attribute to label #16475

Closed nlamirault closed 1 year ago

nlamirault commented 1 year ago

Component(s)

exporter/loki, receiver/fluentforward

What happened?

Description

I would like to have some labels into Grafana/Loki UI. But i've got only exporter label and OPTLP value

Steps to Reproduce

Expected Result

Actual Result

Collector version

v0.64.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") : K3S Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

exporters:
      logging:
        verbosity: normal
      loki:
        endpoint: http://loki-gateway.logging.svc.cluster.local:80/loki/api/v1/push
        headers:
          X-Scope-OrgID: homelab
        tls:
          insecure: true
    extensions:
      health_check: null
      memory_ballast:
        size_in_percentage: 20
      pprof:
        endpoint: :1888
      zpages:
        endpoint: :55679
    processors:
      attributes:
        actions:
        - action: insert
          key: loki.attribute.labels
          value: kubernetes.namespace_name
        - action: insert
          key: loki.attribute.labels
          value: kubernetes.pod_name
        - action: insert
          key: loki.attribute.labels
          value: kubernetes.pod_id
        - action: insert
          key: loki.attribute.labels
          value: kubernetes.container_name
        - action: insert
          key: loki.attribute.labels
          value: kubernetes.container_id
        - action: insert
          key: loki.attribute.labels
          value: kubernetes.host
      batch:
        send_batch_max_size: 1000
        send_batch_size: 800
        timeout: 15s
      memory_limiter:
        check_interval: 5s
        limit_percentage: 90
        spike_limit_percentage: 30
      resource:
        attributes:
        - action: insert
          key: collector.name
          value: ${KUBE_POD_NAME}
    receivers:
      fluentforward:
        endpoint: 0.0.0.0:24224
      otlp:
        protocols:
          grpc: null
          http: null
    service:
      extensions:
      - health_check
      - memory_ballast
      - pprof
      - zpages
      pipelines:
        logs:
          exporters:
          - logging
          - loki
          processors:
          - batch
          - memory_limiter
          - resource
          - attributes
          receivers:
          - fluentforward
      telemetry:
        logs:
          encoding: json
          level: info
        metrics:
          address: 0.0.0.0:8888
          level: detailed

Log output

No response

Additional context

2022-11-24_17-06 2022-11-24_17-05

github-actions[bot] commented 1 year ago

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

jpkrohling commented 1 year ago

Based on the conversation on Slack, the problem is that nested attributes cannot be used as labels.