feat: add prometheus and grafana #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "developemnt_prometheus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#2

2ee16189c21158f898afWIP: feat: add prometheus and grafanato feat: add prometheus and grafana@ -90,0 +117,4 @@} else {"connect_info"};state.metrics.record_source(source);record_sourceis called after IP resolution, so failed requests don't record a source. Source counts won't sum to total requestsis this the expected behaviour?
yes, record_source only makes sense when we actually have a valid IP to look up it increments total lookups but by source
@ -0,0 +36,4 @@pub requests: Family<RequestLabels, Counter>,pub request_duration_seconds: Histogram,pub lookup_errors: Family<ErrorLabels, Counter>,pub lookup_source: Family<SourceLabels, Counter>,Access of these four variables goes through record_ methods
so these fields should be private to avoid direct access to them
@ -0,0 +113,4 @@/// Handler that renders all registered metrics in OpenMetrics text format.pub async fn metrics_handler(State(state): State<super::AppState>) -> impl IntoResponse {let mut buffer = String::new();encode(&mut buffer, &state.metrics_registry).unwrap();can we avoid the use of
unwrapto avoid panics? we can return internal server error instead if the encode fails