Skip to content

Make supplying the endpoints a bit smarter #9

Closed

Description

@hatchan

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.

Activity

  1. self-assigned this
    on Jun 12, 2023
  2. linked a pull request that will close this issueAdd more flexible endpoints parser #21on Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions