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

v3.0.0-M4 - Make the constant TRACING_FILTER_ORDER publicly accessible

Open sguillope opened this issue 6 years ago • 5 comments

Is your feature request related to a problem? Please describe. With Spring Cloud Sleuth v2.x we were able to import TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER but since 3.x there is no way to access it because the class was made non-public.

Describe the solution you'd like That constant is actually defined in TraceHttpAutoConfiguration but for some reason it has package-private access only. It was also previously accessible through TraceWebFilter but the class is not public in v3 anymore. Maybe TraceHttpAutoConfiguration.TRACING_FILTER_ORDER could be made public?

Describe alternatives you've considered The alternative is to duplicate the value as it is defined in TraceHttpAutoConfiguration when registering a web filter but that's not ideal if it was to change in the future.

Additional context We have a custom filter that we need to register ahead of the TraceWebFilter.

sguillope avatar Nov 08 '20 11:11 sguillope

Done via https://github.com/spring-cloud/spring-cloud-sleuth/commit/76ad931b4298b18389d0a4ea739316c14682888b

You can access it through https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/instrument/web/SleuthWebProperties.java#L38

marcingrzejszczak avatar Nov 23 '20 16:11 marcingrzejszczak

By the way, this official documentation is obsolete: https://cloud.spring.io/spring-cloud-sleuth/reference/html/#tracingfilter

It says:

@Component
@Order(TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER + 1)
class MyFilter extends GenericFilterBean {
...
}

But we do not have that TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER anymore. Now imho it should be like@Order(SleuthWebProperties.TRACING_FILTER_ORDER + 1)

fzyzcjy avatar Jan 19 '21 02:01 fzyzcjy

The official documentation lives here https://docs.spring.io/spring-cloud-sleuth/docs/3.0.0/reference/html/

spencergibb avatar Jan 19 '21 02:01 spencergibb

Hello,

I using import org.springframework.cloud.sleuth.autoconfig.instrument.web.SleuthWebProperties; to access SleuthWebProperties.TRACING_FILTER_ORDER.

However, since migrating to Micrometer, i encountered difficulties in accessing that property. Is there a solution available?

ShimonMimoun avatar Jun 08 '23 12:06 ShimonMimoun

See: https://github.com/micrometer-metrics/micrometer/issues/3884#issuecomment-1582702912

jonatan-ivanov avatar Jun 08 '23 14:06 jonatan-ivanov