Is there a convenient and scalable way to add certain parameters (e.g. HTTP-request header information or parameters) or user Information to the Spans?
Asked
Active
Viewed 973 times
1 Answers
1
Yes you can. You can use tags to add arbitrary values to spans. Also check this section of the documentation (http://cloud.spring.io/spring-cloud-sleuth/spring-cloud-sleuth.html#_customizations) how you can extract and inject values to / from span / http requests

Marcin Grzejszczak
- 10,624
- 1
- 16
- 32
-
Thank you very much. I think that leads me into the right direction I guess what I want to do is similar to what the `TraceFilter` is currently doing. Just modify the `addRequestTags` and `addResponseTags`. Do you know whether there is a recommended way to do that, or do I have to create my own implementation of GenericFilterBean as suggested in the Documentation example for the `HttpResponseInjectingTraceFilter` found in your link? – LST Jul 01 '17 at 08:41
-
Yeah try doing it like presented in the docs. If you have any problems ping me back and we'll also update the docs. – Marcin Grzejszczak Jul 01 '17 at 08:43
-
I managed to write a filter that writes the params of a servlet to a span - just what I wanted. Thank you so much. However I am not quite sure how precise the information on filter registration in the HTTP example of the documentation is. I am fairly new to all this. But I needed some search to figure out where to correctly place the `@Bean` part. And I could not figure out how it works to just put the `Tracer` as argument of the `@Bean` method. I ended up creating a `@Autowired` field for the tracer and used this to create the filter. – LST Jul 02 '17 at 09:28
-
You can register the filter in a similar way as we do here - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java#L87-L95 – Marcin Grzejszczak Jul 03 '17 at 14:45
-
Is there a suggested way to add a HandlerInterceptorAdapter like `TraceHandlerInterceptor`? – LST Jul 04 '17 at 09:39
-
You can do it in the same as we do - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java#L37-L45 – Marcin Grzejszczak Jul 04 '17 at 11:02
-
Perfect! Exactly what I was looking for, but was not able to identify in the Repo. Thank you. – LST Jul 04 '17 at 11:33