spring-cloud-sleuth-otel icon indicating copy to clipboard operation
spring-cloud-sleuth-otel copied to clipboard

Make the service name configurable by another property

Open roookeee opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. Currently the OtelAutoConfiguration sets the service.name attribute to spring.application.name (see here). We would like to configure the service.name in the exported traces idependently of setting the spring.application.name - this is done to e.g. prefix our service name with our companies branch so that the trace UI has better glance value (it's a company policy).

This is possible in the non-otel zipkin exporter provided by spring-cloud-seuth (which this repo is replacing for OTEL) via spring.zipkin.service.name but is lacking here.

Describe the solution you'd like We would like another property to override the service.name attribute that takes precedence over spring.application.name if present.

Describe alternatives you've considered We could in theory provide an @Bean that creates a custom Resource that gets merged by the auto configuration, but setting a property vs. adding code for something this simple seems off.

Additional context /

roookeee avatar Jun 16 '22 08:06 roookeee

I would be willing to do a PR for this if you accept the idea

roookeee avatar Jun 16 '22 11:06 roookeee

Maybe this is already fixed with https://github.com/spring-projects-experimental/spring-cloud-sleuth-otel/issues/107 but there is no milestone release for me to test this in a fast way :)

roookeee avatar Jun 16 '22 11:06 roookeee

I think it's a good idea for a separate enhancement (let's give sth spring.zipkin.service.name for OTel). Go ahead and file a PR :)

marcingrzejszczak avatar Jun 17 '22 10:06 marcingrzejszczak

Alright, the only remaining question is about precedence then. I would propose <whatever_the_new_property_is> has precedence over #107 attributes which has precedence over spring.application.name. Still don't like the interaction between #107 and this but we can't help it besides disallowing #107 setting service.name as an attribute. Any thoughts on this?

roookeee avatar Jun 17 '22 11:06 roookeee

I'm reopening this sine it seems #144 fixed #133 not this one (#113), its commit message was pointing to the wrong issue.

jonatan-ivanov avatar Aug 02 '23 20:08 jonatan-ivanov

Sleuth reached the end of its OSS support timeline. We encourage to migrate to Micrometer Tracing.

jonatan-ivanov avatar Jul 12 '24 18:07 jonatan-ivanov