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

Make supplying the endpoints a bit smarter #9

Closed
hatchan opened this issue Jun 7, 2023 · 0 comments · Fixed by #21
Closed

Make supplying the endpoints a bit smarter #9

hatchan opened this issue Jun 7, 2023 · 0 comments · Fixed by #21
Assignees

Comments

@hatchan
Copy link
Contributor

hatchan commented Jun 7, 2023

We should make it as easy for a user to supply the endpoints that they want to monitor. The only thing that is required is the host, all other components have some defaults:

  • The protocol should only allow for http and https, where http is the default.
  • The port should follow the default for the protocol, 80 for http and 443 for https.
  • The path should default to /metrics if the path is empty. It should not be appended if a path is already there.

This should result in the following examples:

  • am start 127.0.0.1: would result in http://127.0.0.1:80/metrics
    • All defaults
  • am start https://127.0.0.1: would result in https://127.0.0.1:443/metrics
    • Non default protocol used
  • am start localhost:3030: would result in http://localhost:3030/metrics
    • Non default port used
  • am start localhost:3030/api/metrics: would result in http://localhost:3030/api/metrics
    • Non default path used, so use that instead
  • am start localhost:3030/api/observability: would result in http://localhost:3030/api/observability
    • Non default path used, so use that instead (and do not add /metrics to it)

A user can also mix and match these: am start 127.0.0.1 https://localhost:3030/api/observability

NOTE: since we are adding the /metrics path when a path is not present in a endpoint it is not possible to have Prometheus scrape the root of a webserver. I think this is an acceptable limitation, since it makes the "normal" usage way more easy to use and users will not likely have their metrics in the / path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant