Conversation
arusahni
left a comment
There was a problem hiding this comment.
One more request (can't make it using the review tool because it hasn't been changed in this PR): Could we change the metrics_endpoint's default value to None (making it an Optional[str]? The current default reflects our internal convention (vs. something meaningful to Quart). Quart's default is None, so we should be able to punch that through.
| app.register_error_handler(HTTPStatusException, abort_with_error) | ||
| app.before_request( | ||
| prometheus_before_request_callback, | ||
| prometheus_before_request_callback.__name__, |
There was a problem hiding this comment.
This parameter is not the name of the function (despite being called name). It is the name of the blueprint to which the handler is attached. Since this isn't attached to a specific blueprint, we shouldn't be providing a key.
There was a problem hiding this comment.
I understand. The reason I added a name, was to be able to test it and find it in the the before_request handlers, if I remove it, maybe I can adjust the unit tests to assert the count of handlers before and after registration?
| self._collectors: Dict[str, MetricType] = {} | ||
| self._custom_labeler: Optional[Callable[["LocalProxy"], Dict[str, str]]] = None | ||
| self._custom_label_names: List[str] = [] | ||
| self._registry = CollectorRegistry() |
There was a problem hiding this comment.
I'm fine with no longer using an explicitly-managed registry, but we should ensure this is identically instantiated. As of now, it is missing the auto_describe parameter.
Additionally, if folks want to manage it externally, I think it'd be useful to add this as an optional argument.
There was a problem hiding this comment.
that's a good idea
|
|
||
| :param labeler: The handler function to invoke. It must return a dict of key-value labels. | ||
| :param labeler: The handler function to invoke. It takes a Quart LocalProxy representing | ||
| the request, from which values for the custom label can be pulled. It must return |
There was a problem hiding this comment.
Instead of "pulled", maybe something a little more active like "constructed" or "generated"?
No description provided.