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.
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:
http
andhttps
, wherehttp
is the default.80
forhttp
and443
forhttps
./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 inhttp://127.0.0.1:80/metrics
am start https://127.0.0.1
: would result inhttps://127.0.0.1:443/metrics
am start localhost:3030
: would result inhttp://localhost:3030/metrics
am start localhost:3030/api/metrics
: would result inhttp://localhost:3030/api/metrics
am start localhost:3030/api/observability
: would result inhttp://localhost:3030/api/observability
/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.