opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

mdatagen: telemetry attributes

Open tombrk opened this issue 1 year ago • 1 comments
trafficstars

In the config spec, mdatagen lists an attributes key for telemetry metrics:

https://github.com/open-telemetry/opentelemetry-collector/blob/fce1d4619dd65e1c53c0b83ccc154f5063ac8612/cmd/mdatagen/metadata-schema.yaml#L167-L168

however, when trying to use it:

attributes:
  test:
    type: string
    description: test

telemetry:
  metrics:
    test:
      description: test
      unit: "1"
      enabled: true
      gauge:
        value_type: int
      attributes: [test]

mdatagen fails:

$ go generate .
2024/08/20 16:49:09 failed loading /home/tbraack/work/otelcol-contrib/processor/deltatocumulativeprocessor/metadata.yaml: unused attributes: [test]
doc.go:4: running "mdatagen": exit status 1

looking at the code, it appears to only check metrics, not telemetry.metrics for attribute usage.

Adding a fake metric to silence the check succeeds, but also does not generate anything.

tombrk avatar Aug 20 '24 14:08 tombrk

I think the same fix that will address https://github.com/open-telemetry/opentelemetry-collector/issues/10925 will address this issue as well, can you confirm @sh0rez

codeboten avatar Aug 22 '24 22:08 codeboten

Going to close as inactive. Please reopen if this is still incorrect.

atoulme avatar Mar 24 '25 22:03 atoulme