Commit 8ad5fe7 1 parent db86b75 commit 8ad5fe7 Copy full SHA for 8ad5fe7
File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -168,4 +168,15 @@ macro_rules! metric {
168
168
} ) ;
169
169
rv
170
170
} } ;
171
+
172
+ // we use statsd timers to send things such as filesizes as well.
173
+ ( time_raw( $id: expr) = $value: expr $( , $k: expr => $v: expr) * $( , ) ?) => { {
174
+ use $crate:: metrics:: _pred:: * ;
175
+ $crate:: metrics:: with_client( |client| {
176
+ client. time_with_tags( $id, $value)
177
+ $( . with_tag( $k, $v) ) *
178
+ . send( ) ;
179
+ } )
180
+ } } ;
181
+
171
182
}
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ use flate2::read::ZlibDecoder;
12
12
use futures:: prelude:: * ;
13
13
use url:: form_urlencoded;
14
14
15
+ use semaphore_common:: metric;
16
+
15
17
use crate :: actors:: outcome:: DiscardReason ;
16
18
17
19
/// A set of errors that can occur during parsing json payloads
@@ -159,7 +161,12 @@ impl Future for StoreBody {
159
161
Ok ( body)
160
162
}
161
163
} )
162
- . and_then ( |body| decode_bytes ( body. freeze ( ) ) ) ;
164
+ . and_then ( |body| {
165
+ metric ! ( time_raw( "event.size_bytes.raw" ) = body. len( ) as u64 ) ;
166
+ let decoded = decode_bytes ( body. freeze ( ) ) ?;
167
+ metric ! ( time_raw( "event.size_bytes.uncompressed" ) = decoded. len( ) as u64 ) ;
168
+ Ok ( decoded)
169
+ } ) ;
163
170
164
171
self . fut = Some ( Box :: new ( future) ) ;
165
172
You can’t perform that action at this time.
0 commit comments