File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
opentelemetry-sdk/src/trace Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -398,8 +398,13 @@ impl Builder {
398398 // For the uncommon case where there are multiple tracer providers with different resource
399399 // configurations, users can optionally provide their own borrowed static resource.
400400 if matches ! ( config. resource, Cow :: Owned ( _) ) {
401- let owned_resource = config. resource . clone ( ) . into_owned ( ) ;
402- config. resource = Cow :: Borrowed ( PROVIDER_RESOURCE . get_or_init ( || owned_resource) ) ;
401+ config. resource =
402+ match PROVIDER_RESOURCE . get_or_init ( || config. resource . clone ( ) . into_owned ( ) ) {
403+ static_resource if * static_resource == * config. resource . as_ref ( ) => {
404+ Cow :: Borrowed ( static_resource)
405+ }
406+ _ => config. resource , // Use the new resource if different
407+ } ;
403408 }
404409
405410 // Create a new vector to hold the modified processors
You can’t perform that action at this time.
0 commit comments