Remove unused metrics (#322)
Removed the `method` label from Prometheus, and removed HTTP methods from reports. Removed `StreamSummary` from reports and replaced it with a `u32` count of streams. Closes #266 Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
parent
713ddf24c8
commit
ea06854fca
|
@ -7,7 +7,6 @@ use http;
|
||||||
use ordermap::OrderMap;
|
use ordermap::OrderMap;
|
||||||
|
|
||||||
use conduit_proxy_controller_grpc::common::{
|
use conduit_proxy_controller_grpc::common::{
|
||||||
HttpMethod,
|
|
||||||
TcpAddress,
|
TcpAddress,
|
||||||
Protocol,
|
Protocol,
|
||||||
};
|
};
|
||||||
|
@ -22,7 +21,6 @@ use conduit_proxy_controller_grpc::telemetry::{
|
||||||
ResponseCtx,
|
ResponseCtx,
|
||||||
ResponseScope,
|
ResponseScope,
|
||||||
ServerTransport,
|
ServerTransport,
|
||||||
StreamSummary,
|
|
||||||
TransportSummary,
|
TransportSummary,
|
||||||
};
|
};
|
||||||
use ctx;
|
use ctx;
|
||||||
|
@ -54,7 +52,7 @@ struct RequestStats {
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct ResponseStats {
|
struct ResponseStats {
|
||||||
ends: OrderMap<End, Vec<EndStats>>,
|
ends: OrderMap<End, u32>,
|
||||||
/// Response latencies in tenths of a millisecond.
|
/// Response latencies in tenths of a millisecond.
|
||||||
///
|
///
|
||||||
/// Observed latencies are mapped to a count of the times that
|
/// Observed latencies are mapped to a count of the times that
|
||||||
|
@ -62,13 +60,6 @@ struct ResponseStats {
|
||||||
latencies: latency::Histogram,
|
latencies: latency::Histogram,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct EndStats {
|
|
||||||
duration_ms: u64,
|
|
||||||
bytes_sent: u64,
|
|
||||||
frames_sent: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||||
enum End {
|
enum End {
|
||||||
Grpc(u32),
|
Grpc(u32),
|
||||||
|
@ -133,36 +124,19 @@ impl Metrics {
|
||||||
.or_insert_with(Default::default);
|
.or_insert_with(Default::default);
|
||||||
|
|
||||||
stats.latencies += fail.since_request_open;
|
stats.latencies += fail.since_request_open;
|
||||||
ends.push(EndStats {
|
*ends += 1;
|
||||||
// We never got a response, but we need to a count
|
|
||||||
// for this request + end, so a 0 EndStats is used.
|
|
||||||
//
|
|
||||||
// TODO: would be better if this case didn't need
|
|
||||||
// a `Vec`, and could just be a usize counter.
|
|
||||||
duration_ms: 0,
|
|
||||||
bytes_sent: 0,
|
|
||||||
frames_sent: 0,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::StreamResponseOpen(ref res, ref open) => {
|
Event::StreamResponseOpen(ref res, ref open) => {
|
||||||
self.response(res).latencies += open.since_request_open;
|
self.response(res).latencies += open.since_request_open;
|
||||||
},
|
},
|
||||||
Event::StreamResponseFail(ref res, ref fail) => {
|
Event::StreamResponseFail(ref res, ref fail) => {
|
||||||
self.response_end(res, End::Reset(fail.error.into()))
|
*self.response_end(res, End::Reset(fail.error.into()))
|
||||||
.push(EndStats {
|
+= 1;
|
||||||
duration_ms: dur_to_ms(fail.since_response_open),
|
|
||||||
bytes_sent: fail.bytes_sent,
|
|
||||||
frames_sent: fail.frames_sent,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
Event::StreamResponseEnd(ref res, ref end) => {
|
Event::StreamResponseEnd(ref res, ref end) => {
|
||||||
let e = end.grpc_status.map(End::Grpc).unwrap_or(End::Other);
|
let e = end.grpc_status.map(End::Grpc).unwrap_or(End::Other);
|
||||||
self.response_end(res, e).push(EndStats {
|
*self.response_end(res, e) += 1;
|
||||||
duration_ms: dur_to_ms(end.since_response_open),
|
|
||||||
bytes_sent: end.bytes_sent,
|
|
||||||
frames_sent: end.frames_sent,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +158,7 @@ impl Metrics {
|
||||||
&mut self,
|
&mut self,
|
||||||
res: &'a Arc<ctx::http::Response>,
|
res: &'a Arc<ctx::http::Response>,
|
||||||
end: End,
|
end: End,
|
||||||
) -> &mut Vec<EndStats> {
|
) -> &mut u32 {
|
||||||
self.response(res)
|
self.response(res)
|
||||||
.ends
|
.ends
|
||||||
.entry(end)
|
.entry(end)
|
||||||
|
@ -249,16 +223,7 @@ impl Metrics {
|
||||||
for (status_code, res_stats) in stats.responses {
|
for (status_code, res_stats) in stats.responses {
|
||||||
let mut ends = Vec::with_capacity(res_stats.ends.len());
|
let mut ends = Vec::with_capacity(res_stats.ends.len());
|
||||||
|
|
||||||
for (end, end_stats) in res_stats.ends {
|
for (end, streams) in res_stats.ends {
|
||||||
let mut streams = Vec::with_capacity(end_stats.len());
|
|
||||||
|
|
||||||
for stats in end_stats {
|
|
||||||
streams.push(StreamSummary {
|
|
||||||
duration_ms: stats.duration_ms,
|
|
||||||
bytes_sent: stats.bytes_sent,
|
|
||||||
frames_sent: stats.frames_sent,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ends.push(EosScope {
|
ends.push(EosScope {
|
||||||
ctx: Some(EosCtx {
|
ctx: Some(EosCtx {
|
||||||
|
@ -289,7 +254,6 @@ impl Metrics {
|
||||||
|
|
||||||
requests.push(RequestScope {
|
requests.push(RequestScope {
|
||||||
ctx: Some(RequestCtx {
|
ctx: Some(RequestCtx {
|
||||||
method: Some(HttpMethod::from(&req.method)),
|
|
||||||
authority: req.uri
|
authority: req.uri
|
||||||
.authority_part()
|
.authority_part()
|
||||||
.map(|a| a.to_string())
|
.map(|a| a.to_string())
|
||||||
|
|
|
@ -50,11 +50,7 @@ fn inbound_sends_telemetry() {
|
||||||
assert_eq!(res.ends.len(), 1);
|
assert_eq!(res.ends.len(), 1);
|
||||||
// ends
|
// ends
|
||||||
let ends = &res.ends[0];
|
let ends = &res.ends[0];
|
||||||
assert_eq!(ends.streams.len(), 1);
|
assert_eq!(ends.streams, 1);
|
||||||
// streams
|
|
||||||
let stream = &ends.streams[0];
|
|
||||||
assert_eq!(stream.bytes_sent, 5);
|
|
||||||
assert_eq!(stream.frames_sent, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,11 +96,7 @@ fn http1_inbound_sends_telemetry() {
|
||||||
assert_eq!(res.ends.len(), 1);
|
assert_eq!(res.ends.len(), 1);
|
||||||
// ends
|
// ends
|
||||||
let ends = &res.ends[0];
|
let ends = &res.ends[0];
|
||||||
assert_eq!(ends.streams.len(), 1);
|
assert_eq!(ends.streams, 1);
|
||||||
// streams
|
|
||||||
let stream = &ends.streams[0];
|
|
||||||
assert_eq!(stream.bytes_sent, 5);
|
|
||||||
assert_eq!(stream.frames_sent, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,11 +156,7 @@ fn inbound_aggregates_telemetry_over_several_requests() {
|
||||||
|
|
||||||
// ------ ends ----------------------
|
// ------ ends ----------------------
|
||||||
let ends = &res.ends[0];
|
let ends = &res.ends[0];
|
||||||
assert_eq!(ends.streams.len(), 1);
|
assert_eq!(ends.streams, 1);
|
||||||
// -------- streams -----------------
|
|
||||||
let stream = &ends.streams[0];
|
|
||||||
assert_eq!(stream.bytes_sent, 5);
|
|
||||||
assert_eq!(stream.frames_sent, 1);
|
|
||||||
|
|
||||||
// -- second request ----------------
|
// -- second request ----------------
|
||||||
let req = &report.requests[1];
|
let req = &report.requests[1];
|
||||||
|
@ -189,12 +177,7 @@ fn inbound_aggregates_telemetry_over_several_requests() {
|
||||||
|
|
||||||
// ------ ends ----------------------
|
// ------ ends ----------------------
|
||||||
let ends = &res.ends[0];
|
let ends = &res.ends[0];
|
||||||
assert_eq!(ends.streams.len(), 2);
|
assert_eq!(ends.streams, 2);
|
||||||
|
|
||||||
// -------- streams -----------------
|
|
||||||
let stream = &ends.streams[0];
|
|
||||||
assert_eq!(stream.bytes_sent, 12);
|
|
||||||
assert_eq!(stream.frames_sent, 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue