@@ -105,17 +105,13 @@ pub struct MetricsInterceptor {
105
105
impl observe:: MetricsIntercept for MetricsInterceptor {
106
106
fn observe_operation_duration_seconds (
107
107
& self ,
108
- scheme : Scheme ,
109
- namespace : Arc < String > ,
110
- root : Arc < String > ,
108
+ info : Arc < AccessorInfo > ,
111
109
path : & str ,
112
110
op : Operation ,
113
111
duration : Duration ,
114
112
) {
115
113
let labels = OperationLabels {
116
- scheme,
117
- namespace,
118
- root,
114
+ info,
119
115
path,
120
116
operation : op,
121
117
error : None ,
@@ -126,17 +122,13 @@ impl observe::MetricsIntercept for MetricsInterceptor {
126
122
127
123
fn observe_operation_bytes (
128
124
& self ,
129
- scheme : Scheme ,
130
- namespace : Arc < String > ,
131
- root : Arc < String > ,
125
+ info : Arc < AccessorInfo > ,
132
126
path : & str ,
133
127
op : Operation ,
134
128
bytes : usize ,
135
129
) {
136
130
let labels = OperationLabels {
137
- scheme,
138
- namespace,
139
- root,
131
+ info,
140
132
path,
141
133
operation : op,
142
134
error : None ,
@@ -147,17 +139,13 @@ impl observe::MetricsIntercept for MetricsInterceptor {
147
139
148
140
fn observe_operation_errors_total (
149
141
& self ,
150
- scheme : Scheme ,
151
- namespace : Arc < String > ,
152
- root : Arc < String > ,
142
+ info : Arc < AccessorInfo > ,
153
143
path : & str ,
154
144
op : Operation ,
155
145
error : ErrorKind ,
156
146
) {
157
147
let labels = OperationLabels {
158
- scheme,
159
- namespace,
160
- root,
148
+ info,
161
149
path,
162
150
operation : op,
163
151
error : Some ( error) ,
@@ -168,9 +156,7 @@ impl observe::MetricsIntercept for MetricsInterceptor {
168
156
}
169
157
170
158
struct OperationLabels < ' a > {
171
- scheme : Scheme ,
172
- namespace : Arc < String > ,
173
- root : Arc < String > ,
159
+ info : Arc < AccessorInfo > ,
174
160
path : & ' a str ,
175
161
operation : Operation ,
176
162
error : Option < ErrorKind > ,
@@ -187,9 +173,9 @@ impl OperationLabels<'_> {
187
173
let mut labels = Vec :: with_capacity ( 6 ) ;
188
174
189
175
labels. extend ( [
190
- Label :: new ( observe:: LABEL_SCHEME , self . scheme . into_static ( ) ) ,
191
- Label :: new ( observe:: LABEL_NAMESPACE , ( * self . namespace ) . clone ( ) ) ,
192
- Label :: new ( observe:: LABEL_ROOT , ( * self . root ) . clone ( ) ) ,
176
+ Label :: new ( observe:: LABEL_SCHEME , self . info . scheme ( ) . into_static ( ) ) ,
177
+ Label :: new ( observe:: LABEL_NAMESPACE , self . info . name ( ) ) ,
178
+ Label :: new ( observe:: LABEL_ROOT , self . info . root ( ) ) ,
193
179
Label :: new ( observe:: LABEL_OPERATION , self . operation . into_static ( ) ) ,
194
180
] ) ;
195
181
0 commit comments