File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -275,10 +275,11 @@ pub fn setup_open_telemetry(subscriber: &mut TracingSubscriber<Registry>) -> (Op
275275 use opentelemetry:: KeyValue ;
276276 use opentelemetry_sdk:: { Resource , metrics:: Temporality } ;
277277
278- let service_name = var ( "OTEL_SERVICE_NAME" ) . unwrap_or_else ( |_| DEFAULT_OTLP_SERVICE_NAME . to_string ( ) ) ;
278+ let service_name =
279+ var ( "OTEL_SERVICE_NAME" ) . unwrap_or_else ( |_| DEFAULT_OTLP_SERVICE_NAME . to_string ( ) ) . trim ( ) . to_string ( ) ;
279280 let service_instance_id = var ( "OTEL_SERVICE_INSTANCE_ID" ) . ok ( ) ;
280281 let mut attributes = vec ! [ KeyValue :: new( SERVICE_NAME , service_name. clone( ) ) ] ;
281- if let Some ( id) = service_instance_id {
282+ if let Some ( id) = service_instance_id. filter ( |value| !value . trim ( ) . is_empty ( ) ) {
282283 attributes. push ( KeyValue :: new ( SERVICE_INSTANCE_ID , id) ) ;
283284 }
284285 let resource = Resource :: builder ( ) . with_attributes ( attributes) . build ( ) ;
You can’t perform that action at this time.
0 commit comments