Skip to content
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

metrics_path is silently ignored when used together with *-notation #360

Closed
sed-i opened this issue Sep 16, 2022 · 1 comment
Closed

metrics_path is silently ignored when used together with *-notation #360

sed-i opened this issue Sep 16, 2022 · 1 comment

Comments

@sed-i
Copy link
Contributor

sed-i commented Sep 16, 2022

Bug Description

When a scrape job has a custom metrics_path AND uses star-notation, then the other side of the relation (consumer, i.e. the prom that scrapes) has the custom metrics_path ignored, and uses the default one.

  • On one hand, multiple units may have different hostnames but the exact same path prefix. In those cases the star-notation should still work.
  • On the other hand, with ingress-per-unit, each unit will have a different path so it should be possible to combine it with star-notation.

EDIT

Put differently, a job's target hostname has no effect, if the external_hostname= kwarg is not passed to MetricsEndpointProvider.

Still, after passing external_hostname, there is some duplication (apart from ingress nor path not being picked up):

> $ curl 10.1.13.180:9090/api/v1/targets| jq | grep "scrapeUrl"
        "scrapeUrl": "http://prometheus-0.prometheus-endpoints.test-external-url-f4ew.svc.cluster.local:9090/metrics",
        "scrapeUrl": "http://prometheus-0.prometheus-endpoints.test-external-url-f4ew.svc.cluster.local:80/metrics",
        "scrapeUrl": "http://prometheus-1.prometheus-endpoints.test-external-url-f4ew.svc.cluster.local:80/metrics",
        "scrapeUrl": "http://localhost:9090/metrics",

To Reproduce

Pass the following job to PromScrapeProvider:

{"metrics_path": "/foo/metrics", "static_configs": [{"targets": [f"*:{self._port}"]}]}

Environment

N/A

Relevant log output

scrape_jobs: '[{"metrics_path": "/metrics", "static_configs": [{"targets": ["*:9090"]}]}]'

Additional context

Noticed this while working on ingress (#349).

@sed-i
Copy link
Contributor Author

sed-i commented Sep 29, 2022

Fixed by #370 + #373.

@sed-i sed-i closed this as completed Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant