Closed onelapahead closed 5 years ago
Duplicate of https://github.com/DataDog/integrations-core/issues/1144 and solved by https://github.com/DataDog/integrations-core/pull/1976.
My datadog annotations were:
ad.datadoghq.com/container.check_names: '["prometheus"]'
ad.datadoghq.com/container.init_configs: '[{}]'
ad.datadoghq.com/container.instances: '[{"prometheus_url": "http://%%host%%:8888/actuator/prometheus","namespace": "a-namespace","metrics": ["*"],"type_overrides": {}}]'
and this was fixed by changing the check name:
ad.datadoghq.com/container.check_names: '["openmetrics"]'
Output of the info page (if this is a bug)
Describe what happened: Our agents are failing to scrape the
/actuator/prometheus
endpoint of our Spring Boot apps because they are receiving 406's due to an invalidAccept
header:The reason being is that Actuator/Micrometer does not support the preferred protobuf format for Prometheus metrics, and instead only supports the text format i.e.
text/plain
, for example:From what I can tell it's because the agent uses the
datadog_checks_base
Python lib which doesn't expose the type/Accept
header for configuration (although it is configurable). Thecheck
method in there eventually callspoll
which does have a preferred format option that could be set toNone
.Describe what you expected:
The datadog agent should accept an additional annotation such as
ad.datadoghq.com/<container-name>.prometheus-format: <text|protobuf>
which will tell the agent to configure the check to use which ever format was provided. It should default toprotobuf
for backwards compatibility.This will require a slight refactoring of the check within
datadog_checks_base
so thatpFormat
inpoll
is actually set byscrape_metrics
and so on.Steps to reproduce the issue:
Run a Spring Boot app on a Kubernetes/OpenShift cluster and enable Prometheus metrics via Micrometer and Actuator.
Configure the annotations to scrape the
/actuator/prometheus
endpoint, and check the agent logs to see that it fails with a 406.If you use a debug pod to hit your Spring Boot pod directly you can reproduce the 406 with the same headers the agent uses:
Additional environment details (Operating System, Cloud provider, etc):
Spring Boot 2.1.4 OpenShift 3.11.98 docker.io/datadog/agent@sha256:904c18135ec534fc81c29a42537725946b23ba19ac3c0a8b2e942fe39981af20 (v6)