-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a possible_prometheus_urls
parameter to the OpenMetrics base check
#9573
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thanks!
Two notes:
- I think the new parameter needs to be documented here.
- Openmetrics V2 needs to support this at some point, otherwise we couldn't migrate the
kube_*
checks to the V2. The question is, should we make Openmetrics V2 supportprometheus_possible_urls
as part of this PR or not?
This reverts commit 07ba551.
@ahmed-mez said:
If I add the new parameter in this file like in 07ba551, then the new parameter will need to be added in the I think that, for other, non-auto-configured non-kube checks, it would be better to encourage the users to specify a single URL with the |
…naic/prometheus_possible_urls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this. Would it not make more sense for AD itself to try each URL and create the instance based on the first accessible one?
@ofek , IMO, The problem will be that the AD will need to know for each integration the possible URL, so it breaks the separation of concern by putting specific check logic into the AD. |
@ofek said:
Could you detail how you would enhance AD to do that ? I could replace this: ad_identifiers:
- kube-scheduler
init_config:
instances:
- prometheus_possible_urls:
- https://%%host%%:10259/metrics
- https://localhost:10259/metrics
- http://%%host%%:10251/metrics
- http://localhost:10251/metrics by that: ad_identifiers:
- kube-scheduler
init_config:
instances:
- prometheus_url: https://%%host%%:10259/metrics
- prometheus_url: https://localhost:10259/metrics
- prometheus_url: http://%%host%%:10251/metrics
- prometheus_url: http://localhost:10251/metrics But that would schedule 4 checks. Potentially, 2 would be in permanent error and 2 would report duplicated metrics. And I think it’s best to keep AD check-agnostic. |
not much to add here, but I definitely agree that configuring checks is not the job of Autodiscovery. |
I'll implement in v2. FYI I plan to match the v2 name and call it |
datadog_checks_base/datadog_checks/base/checks/openmetrics/base_check.py
Outdated
Show resolved
Hide resolved
Actually, what do all of you think about only adding this feature to v2? |
In fact, I began trying to migrate the concerned checks to |
/azp help |
Supported commands
See additional documentation. |
/azp list |
/azp run PR All |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run PR All |
Azure Pipelines successfully started running 1 pipeline(s). |
…naic/prometheus_possible_urls
Config won't have to change, see: #8438 integrations-core/datadog_checks_base/datadog_checks/base/checks/openmetrics/v2/scraper.py Line 351 in 7ff3ac9
|
prometheus_possible_urls
parameter to the OpenMetrics base checkpossible_prometheus_urls
parameter to the OpenMetrics base check
…eck (#9573) * Add a `prometheus_possible_urls` parameter to the OpenMetrics base check * Remove non-ASCII character * Document the new `prometheus_possible_urls` parameter * Fix flake8 errors * Revert "Document the new `prometheus_possible_urls` parameter" This reverts commit 07ba551. * Fix formatting * Fix formatting * Log an error if no possible url is reachable * Simplify log * Rename `prometheus_possible_urls` into `possible_prometheus_urls` 099995a
What does this PR do?
Add a new
possible_prometheus_urls
parameter to the OpenMetrics base check.It takes a list of possible OpenMetrics endpoints to try.
The data are then scraped from the first endpoint that worked.
Motivation
The goal of the agent auto-discovery is to ease the agent configuration by enabling and configuring as much checks as we can automatically.
In the context of Kubernetes control plane components, this goal is thwarted by the diversity of Kubernetes versions and distributions that the agent must support.
In some versions of Kubernetes, the endpoint is plain http, on other versions, only the secure https endpoint is available. On some distributions, the port is bound only on localhost whereas on others, the endpoint is accessible on the node IP, etc.
In order to provide “out-of-the-box” monitoring of those kind of components, we need the check to be able to try several “standard” endpoints.
Additional Notes
When a user is explicitly setting a check up, they must keep on using the single-valued
prometheus_url
.possible_prometheus_urls
is mainly designed to be used in theauto_conf.yaml
files in the scope of auto-discovery.This new parameter is needed by the following checks:
kube_scheduler
: Fix auto-discovery for latest versions on Kubernetes #9574kube_controller_manager
: Fix auto-discovery for latest versions on Kubernetes #9575kube_apiserver_metrics
: Fix auto-discovery for latest versions on Kubernetes #9577etcd
: Fix auto-discovery for latest versions on Kubernetes #9578Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached