File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,15 @@ fn main() {
27
27
let service = ServiceBuilder :: new ()
28
28
// Make a trace layer where the chunks are bytes::Bytes
29
29
. layer (make_layer (| b : & bytes :: Bytes | b . len () as u64 ));
30
- // ... Use this service in a Tower Middleware stack.
30
+ // ... Use this service in a Tower middleware stack.
31
31
}
32
- ```
32
+ ```
33
+
34
+ ## Recorded Metrics
35
+
36
+ * http_request_counter The total count of all requests
37
+ * http_request_failure_counter The total count of all request failures
38
+ * http_request_size_bytes_hist A histogram of request size in bytes
39
+ * http_request_request_time_micros_hist A histogram of request time in microseconds
40
+
41
+ Each metric is faceted by ` path ` , ` method ` , and ` host ` for the request.
Original file line number Diff line number Diff line change 58
58
pub labels : Arc < Mutex < Vec < Label > > > ,
59
59
/// The accumulator for the number of bytes on this request.
60
60
pub size : Arc < AtomicU64 > ,
61
- /// The mapper function to extract the size from a chunk in [OnBodyChunk<B>],
61
+ /// The mapper function to extract the size in bytes from a chunk in [OnBodyChunk<B>],
62
62
pub chunk_len : Arc < F > ,
63
63
_phantom : PhantomData < B > ,
64
64
}
82
82
F : Fn ( & B ) -> u64 ,
83
83
{
84
84
/// Construct a new [MetricsRecorder] using the installed [metrics::Recorder].
85
- /// The function passed in is used to extract the size from the chunks in a
85
+ /// The function passed in is used to extract the size in bytes from the chunks in a
86
86
/// response for all [OnBodyChunk] calls.
87
87
pub fn new ( f : F ) -> Self {
88
88
Self {
@@ -169,7 +169,7 @@ where
169
169
}
170
170
171
171
/// Construct a [TraceLayer] that will use an installed [metrics::Recorder] to record metrics per request.
172
- /// The provided [Fn] is used to extract the size from the chunks in a
172
+ /// The provided [Fn] is used to extract the size in bytes from the chunks in a
173
173
/// response for all [OnBodyChunk] calls.
174
174
pub fn make_layer < B , F > ( f : F ) -> MetricsTraceLayer < B , F >
175
175
where
You can’t perform that action at this time.
0 commit comments