diff --git a/README.md b/README.md index 611b33c..5522ec2 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,15 @@ fn main() { let service = ServiceBuilder::new() // Make a trace layer where the chunks are bytes::Bytes .layer(make_layer(|b: &bytes::Bytes| b.len() as u64)); - // ... Use this service in a Tower Middleware stack. + // ... Use this service in a Tower middleware stack. } -``` \ No newline at end of file +``` + +## Recorded Metrics + +* http_request_counter The total count of all requests +* http_request_failure_counter The total count of all request failures +* http_request_size_bytes_hist A histogram of request size in bytes +* http_request_request_time_micros_hist A histogram of request time in microseconds + +Each metric is faceted by `path`, `method`, and `host` for the request. \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 717e65d..34d83bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,7 +58,7 @@ where pub labels: Arc>>, /// The accumulator for the number of bytes on this request. pub size: Arc, - /// The mapper function to extract the size from a chunk in [OnBodyChunk], + /// The mapper function to extract the size in bytes from a chunk in [OnBodyChunk], pub chunk_len: Arc, _phantom: PhantomData, } @@ -82,7 +82,7 @@ where F: Fn(&B) -> u64, { /// Construct a new [MetricsRecorder] using the installed [metrics::Recorder]. - /// The function passed in is used to extract the size from the chunks in a + /// The function passed in is used to extract the size in bytes from the chunks in a /// response for all [OnBodyChunk] calls. pub fn new(f: F) -> Self { Self { @@ -169,7 +169,7 @@ where } /// Construct a [TraceLayer] that will use an installed [metrics::Recorder] to record metrics per request. -/// The provided [Fn] is used to extract the size from the chunks in a +/// The provided [Fn] is used to extract the size in bytes from the chunks in a /// response for all [OnBodyChunk] calls. pub fn make_layer(f: F) -> MetricsTraceLayer where