@@ -235,9 +235,32 @@ impl observe::MetricsIntercept for MetricsRecorder {
235235 }
236236}
237237
238- #[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
238+ /// observe::MetricLabels contains root but we don't want it.
239+ #[ derive( Clone , Debug ) ]
239240struct OperationLabels ( observe:: MetricLabels ) ;
240241
242+ impl PartialEq for OperationLabels {
243+ fn eq ( & self , other : & Self ) -> bool {
244+ self . 0 . scheme == other. 0 . scheme
245+ && self . 0 . namespace == other. 0 . namespace
246+ && self . 0 . operation == other. 0 . operation
247+ && self . 0 . error == other. 0 . error
248+ && self . 0 . status_code == other. 0 . status_code
249+ }
250+ }
251+
252+ impl Eq for OperationLabels { }
253+
254+ impl std:: hash:: Hash for OperationLabels {
255+ fn hash < H : std:: hash:: Hasher > ( & self , state : & mut H ) {
256+ self . 0 . scheme . hash ( state) ;
257+ self . 0 . namespace . hash ( state) ;
258+ self . 0 . operation . hash ( state) ;
259+ self . 0 . error . hash ( state) ;
260+ self . 0 . status_code . hash ( state) ;
261+ }
262+ }
263+
241264impl EncodeLabelSet for OperationLabels {
242265 fn encode ( & self , mut encoder : LabelSetEncoder ) -> Result < ( ) , fmt:: Error > {
243266 ( observe:: LABEL_SCHEME , self . 0 . scheme . into_static ( ) ) . encode ( encoder. encode_label ( ) ) ?;
0 commit comments