Closed hashemmm96 closed 2 years ago
Update: Suggested fix here https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/8543
As discussed in the PR, I think the proposed change is not the right solution to the problem. And the underlying cause is not really a bug but rather a misconfiguration (though to be honest, it's very easy to miss that). dockerstats
receiver already puts the attributes at the resource level.
I don't know prometheus exporter very well, but I think by default it does not include resource-level attributes. To change it, resource_to_telemetry_conversion
enabled
flag needs to be set true
.
So I think all that needs to be done is following change to otel-collector-config.yaml
:
exporters:
prometheus:
endpoint: "0.0.0.0:8889"
resource_to_telemetry_conversion:
enabled: true
const_labels:
label1: value1
Thanks a lot for the help, there was much confusion on my part. I will close the PR as well.
Describe the bug
dockerstatsreceiver
doesn't add labels fromcontainer_labels_to_metric_labels
andenv_vars_to_metric_labels
config options to exported metrics.Steps to reproduce
cmd/otelcontribcol/Dockerfile
) to use USER_UID=0.make docker-otelcontribcol
export OTELCOL_IMG=otelcontribcol
examples/demo
but with modified otel-collector-config.yaml and docker-compose.yaml below:container_*
metric, e.g.container_cpu_percent
What did you expect to see? One series for each container in the docker-compose env should be visible in prometheus, i.e. five graphs. Each series should be labeled with the docker-compose service name and the demo-client service should have an additional label from the DEMO_SERVER_ENDPOINT env var.
What did you see instead? One series in total, with no labels from the otel-collector-config.yaml showing.
What version did you use? commit 32e14e6
What config did you use? see above
Environment OS: Ubuntu 21.10
Additional context