@@ -94,7 +94,7 @@ pub fn serve_http(
9494 . status ( StatusCode :: SERVICE_UNAVAILABLE )
9595 . body ( Body :: empty ( ) )
9696 . unwrap ( ) ,
97- Some ( rt. name . clone ( ) ) ,
97+ Some ( ( rt. name . clone ( ) , rt . version . clone ( ) ) ) ,
9898 ) ;
9999 }
100100
@@ -138,7 +138,7 @@ pub fn serve_http(
138138 . status ( StatusCode :: INTERNAL_SERVER_ERROR )
139139 . body ( Body :: empty ( ) )
140140 . unwrap ( ) ,
141- Some ( rt. name . clone ( ) ) ,
141+ Some ( ( rt. name . clone ( ) , rt . version . clone ( ) ) ) ,
142142 ) ;
143143 }
144144
@@ -166,31 +166,31 @@ pub fn serve_http(
166166
167167 Ok ( Response :: from_parts ( parts, body) )
168168 } ) ,
169- Some ( rt. name . clone ( ) ) ,
169+ Some ( ( rt. name . clone ( ) , rt . version . clone ( ) ) ) ,
170170 )
171171 } else {
172172 future_response (
173173 Response :: builder ( )
174174 . status ( StatusCode :: SERVICE_UNAVAILABLE )
175175 . body ( Body :: empty ( ) )
176176 . unwrap ( ) ,
177- Some ( rt. name . clone ( ) ) ,
177+ Some ( ( rt. name . clone ( ) , rt . version . clone ( ) ) ) ,
178178 )
179179 }
180180}
181181
182- fn future_response ( res : Response < Body > , name : Option < String > ) -> BoxedResponseFuture {
183- wrap_future ( future:: ok ( res) , name )
182+ fn future_response ( res : Response < Body > , namever : Option < ( String , String ) > ) -> BoxedResponseFuture {
183+ wrap_future ( future:: ok ( res) , namever )
184184}
185185
186- fn wrap_future < F > ( fut : F , maybe_name : Option < String > ) -> BoxedResponseFuture
186+ fn wrap_future < F > ( fut : F , namever : Option < ( String , String ) > ) -> BoxedResponseFuture
187187where
188188 F : Future < Item = Response < Body > , Error = futures:: Canceled > + Send + ' static ,
189189{
190190 Box :: new ( fut. and_then ( move |res| {
191- let rt_name = maybe_name . unwrap_or ( String :: new ( ) ) ;
191+ let ( name , ver ) = namever . unwrap_or ( ( String :: new ( ) , String :: new ( ) ) ) ;
192192 metrics:: HTTP_RESPONSE_COUNTER
193- . with_label_values ( & [ rt_name . as_str ( ) , res. status ( ) . as_str ( ) ] )
193+ . with_label_values ( & [ name . as_str ( ) , ver . as_str ( ) , res. status ( ) . as_str ( ) ] )
194194 . inc ( ) ;
195195 Ok ( res)
196196 } ) )
0 commit comments