chore: Add some HTTP outcalls metrics - #11233
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to cdc1354. Security Overview
Detected Code Changes
|
| pool_manager_metrics: metrics_registry.int_counter_vec( | ||
| "canister_http_pool_manager_metrics", | ||
| "Canister http pool manager related metrics, by kind.", | ||
| &[LABEL_TYPE], | ||
| ), |
There was a problem hiding this comment.
Nit: The doc comment on the field ("Notable, but expected events observed by the pool manager, by kind") actually suggests a better name:
| pool_manager_metrics: metrics_registry.int_counter_vec( | |
| "canister_http_pool_manager_metrics", | |
| "Canister http pool manager related metrics, by kind.", | |
| &[LABEL_TYPE], | |
| ), | |
| pool_manager_events: metrics_registry.int_counter_vec( | |
| "canister_http_pool_manager_events", | |
| "Notable, but expected events observed by the pool manager, by kind.", | |
| &[LABEL_TYPE], | |
| ), |
As is, "metrics" is exceedingly vague. Everything is a metric, around here and in Prometheus.
| } | ||
|
|
||
| /// Records a notable, but expected event of the given kind. | ||
| pub(crate) fn pool_manager_metrics_inc(&self, label: &str) { |
There was a problem hiding this comment.
observe_pool_manager_event?
| } | ||
|
|
||
| /// Records a failed operation of the given kind. | ||
| pub(crate) fn pool_manager_errors_inc(&self, label: &str) { |
There was a problem hiding this comment.
observe_pool_manager_error?
You could also merge the two IntCounterVecs into one by adding an error="true|false" label. Not sure whether that makes sense in this specific context, but it's an option.
There was a problem hiding this comment.
Done: cdc1354, I kept both metric separate, which is more consistent with what other protocols do
Some metrics and logs for HTTPS outcalls: