Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Add path label in metrics #50

Open
lforite opened this issue Jun 3, 2019 · 7 comments
Open

Add path label in metrics #50

lforite opened this issue Jun 3, 2019 · 7 comments

Comments

@lforite
Copy link

lforite commented Jun 3, 2019

On top of hostname, we would like to segregate our metrics by path such as:

  • caddy_http_request_count_total{host, family, proto, path}
  • caddy_http_request_duration_seconds{host, family, proto, path}
  • caddy_http_response_latency_seconds{host, family, proto, path, status}
  • caddy_http_response_size_bytes{host, family, proto, path, status}
  • caddy_http_response_status_count_total{host, family, proto, path, status}

If it's fine for you I can open a PR

@lforite lforite changed the title Additional path label in metrics Add path label in metrics Jun 3, 2019
@miekg
Copy link
Owner

miekg commented Jun 3, 2019 via email

@hairyhenderson
Copy link
Collaborator

I was actually also thinking of this a few weeks ago. Our use-case is where we want to make sure that Caddy is serving files within a certain latency, but only from certain paths.

The cardinality is a concern, however the usual way we deal with this with other services is by setting the path value not to the final path, but to the endpoint that handled the request (i.e. the proxy from, or rewrite basepath, etc...).

Also it's probably important to omit the path label for non-matching requests - ones that would result in a 404.

For compatibility, this should definitely be an opt-in feature, not enabled by default.

@lforite
Copy link
Author

lforite commented Jun 4, 2019

Even for a 404 this information would be useful: you could see which resource resulted in a 404 which might be a useful piece of information.

@miekg what about making it opt-in ?

@miekg
Copy link
Owner

miekg commented Jun 4, 2019 via email

@lforite
Copy link
Author

lforite commented Jun 4, 2019

you mean size wise ?

@lforite
Copy link
Author

lforite commented Jun 4, 2019

Probably you refer to: prometheus/client_golang#491 ?

@hairyhenderson
Copy link
Collaborator

you mean size wise ?

He's referring to cardinality, which is true. Unbounded cardinality can be a bit of an Achilles' heel for Prometheus.

The cardinality could be bounded by setting a static value per endpoint. Not sure about how to actually implement that, though 😉

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

No branches or pull requests

3 participants