by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 21 07:29
    CircleCI success: spring-cloud build (#6382) in https://github.com/spring-cloud/spring-cloud-sleuth
    • Make the WebClient instrumentation conditional on property (#1723)
      (4ec412c6ae392dbe26b8419ca9a9e7e8dcb8c264 by GitHub)
  • Sep 21 07:14
    marcingrzejszczak unlabeled #1732
  • Sep 21 07:14
    marcingrzejszczak closed #1717
  • Sep 21 07:14
    marcingrzejszczak commented #1717
  • Sep 21 07:14
    marcingrzejszczak milestoned #1717
  • Sep 21 07:13
    marcingrzejszczak commented #1723
  • Sep 21 07:13

    marcingrzejszczak on master

    Make the WebClient instrumentat… (compare)

  • Sep 21 07:13
    marcingrzejszczak closed #1723
  • Sep 21 07:13
    marcingrzejszczak milestoned #1723
  • Sep 21 07:13
    marcingrzejszczak labeled #1723
  • Sep 21 07:13
    marcingrzejszczak unlabeled #1723
  • Sep 21 07:07
    marcingrzejszczak labeled #1734
  • Sep 21 07:07
    marcingrzejszczak unlabeled #1734
  • Sep 21 07:07
    marcingrzejszczak labeled #1738
  • Sep 21 07:07
    marcingrzejszczak unlabeled #1738
  • Sep 21 07:07
    marcingrzejszczak commented #1738
  • Sep 20 13:10
    spring-issuemaster labeled #1738
  • Sep 20 13:07
    notizklotz opened #1738
  • Sep 17 11:25
    spring-issuemaster labeled #1721
  • Sep 17 11:25
    spring-issuemaster commented #1721
Adrian Cole
@adriancole
@LtTempletonPeck I think feign is using defaults. It could possibly be made to implement HttpRequest.route() as UriTemplate https://github.com/OpenFeign/feign/blob/835a96380e3212afb2c882aa54e463eea4c20b32/core/src/main/java/feign/template/UriTemplate.java#L28 you could open an issue for that. I haven't worked on feign for years but I initially envisioned MethodMetadata.configKey as the span name hystrix name etc also. But anyway HttpRequest.route() would work better as the template value than the path as it won't lead to unlimited span names. OTOH if x-ray is ok with unlimited span names, path could be used instead (possibly in the data conversion) cc @anuraaga
2 replies
I don't know the answer to the other question so will punt that one :D
Marcin Grzejszczak
@marcingrzejszczak
There's nothing OOB AFAIR that would allow to change Feign spans for the RPC calls. You'd have to use Brave configuration to try to change it
Anuraag Agrawal
@anuraaga
Don't know much about feign, but if using zipkin-aws, remote service names need to be set to have proper names in x-ray segments. Maybe it's not set? https://github.com/openzipkin/zipkin-aws/blob/master/storage-xray-udp/src/main/java/zipkin2/storage/xray_udp/UDPMessageEncoder.java#L75
2 replies
benrejebmoh
@benrejebmoh

Hello,
I m trying to propagate some extra-information within all log records (in my current service and client services) using spring-cloud-sleuth 2.2.1.RELEASE, but facing a problem when trying to add local-keys to SLF4J's MDC. (it works perfectly with propagation-keys for remote calls). This is my configuration:
spring:
sleuth:
propagation-keys:

  - remote-key
local-keys:
  - local-key
propagation:
  tag:
    whitelisted-keys:
      - remote-key
      - local-key
log:
  slf4j:
    whitelisted-mdc-keys:
      - remote-key
      - local-key

I'm i missing some thing? or log.slf4j.whitelisted-mdc-keys is not intended to work with local-keys?

Thank you in advance.

Marcin Grzejszczak
@marcingrzejszczak
can you try the latest release? @adriancole has done quite a few changes in baggage propagation in the meantime
Dimitrios Klimis
@dimi-nk
Hey everyone. I've been looking into sleuth and I was wondering if any client-side buffering is done before pushing traces to zipkin. The only relevant prop I found is spring.sleuth.sampler.rate but I assume it's more about rate limiting rather than buffering.
I guess this is a job for brave, but I cannot find any documentation đŸ‘€
Adrian Cole
@adriancole
@dimi-nk https://cloud.spring.io/spring-cloud-sleuth/reference/html/#sending-spans-to-zipkin says it is async, but doesn't copy the properties defined into asciidoc
to see properties you can look at the appendix here https://cloud.spring.io/spring-cloud-sleuth/reference/html/appendix.html
for example, the default amount of time to buffer spans is 1 second spring.zipkin.message-timeout
in the latest version of sleuth 2.2.3, this is what's ultimately controlled https://github.com/openzipkin/zipkin-reporter-java/tree/master/brave
and spring.zipkin.message-timeout -> https://github.com/openzipkin/zipkin-reporter-java#tuning
krraghavan
@krraghavan
Thanks @marcingrzejszczak. Turned out to be some problem with my configuration. I am using the async mongodb java driver to execute reactive queries on my Mongodb. I'm assuming these don't get instrumented by default. Should I be using annotations on the Repository interfaces to get these to be instrumented?
Marcin Grzejszczak
@marcingrzejszczak
Yes that's the way to go
Dimitrios Klimis
@dimi-nk

@dimi-nk https://cloud.spring.io/spring-cloud-sleuth/reference/html/#sending-spans-to-zipkin says it is async, but doesn't copy the properties defined into asciidoc

Thanks @adriancole , that clears is up

ricardoneves93
@ricardoneves93
Hello everyone!
I am using kafka streams alongside sleuth to enable tracing intra and inter service.
Right now, I am setting the setUncaughtExceptionHandler on StreamsBuilderFactoryBean class. This will allows to catch expected and unexpected exceptions that occur inside Streams Api.
So far so good, when an exception is thrown, the callback method that is received by setUncaughtExceptionHandler setter is called as expected.
However I am trying to produce logs inside callback method and traceId is not preserved. For example when I call inside the callback method tracer.currentSpan() it returns null.
Dos this happens because callback method is running on a separate thread? If yes, what is the best way to pass the Tracer context to a new thread?
9 replies
Marcin Grzejszczak
@marcingrzejszczak
it might be the case. You'd need to instrument whatever is spawning that thread
ricardoneves93
@ricardoneves93
Is there any way of checking what is spawning that thread, I really don't know where to look...
Any Intellij tool, profile, etc
Templeton Peck
@LtTempletonPeck
Sorry another Sleuth/Zipkin/X-Ray question. Even on normal MVC calls it isn't setting the http.url is that right? Here is an example:
{
    "Duration": 0.003,
    "Id": "1-5edfc25c-29fa208298d8dcaabe39b7ca",
    "Segments": [
        {
            "Document": {
                "id": "653dc59555a64e76",
                "name": "alt-service",
                "start_time": 1591722588.818313,
                "trace_id": "1-5edfc25c-29fa208298d8dcaabe39b7ca",
                "end_time": 1591722588.821566,
                "http": {
                    "request": {
                        "method": "GET"
                    }
                },
                "annotations": {
                    "mvc_controller_class": "AltController",
                    "mvc_controller_method": "query",
                    "http_path": "/v1/",
                    "operation": "get /v1/"
                }
            },
            "Id": "653dc59555a64e76"
        }
    ]
}
Jorge Tovar
@jorgetovar_gitlab
Hello , How can I add sleuth/zipkin instrumentation to retrofit (Http client) used between many spring boot microservices... ? Can you help me please (Y)
With RestTemplate @Bean it works nice but we have Retrofit as our default http client
I can see in this post that there is not support :S
Adrian Cole
@adriancole
@jorgetovar_gitlab retrofit is built over okhttp, and okhttp is supported by brave
3 replies
answered your stackoverflow
Adrian Cole
@adriancole
@LtTempletonPeck the default parsing doesn't include the HTTP url for security and performance reasons. there's an example to add more (for any library not just mvc) here https://cloud.spring.io/spring-cloud-sleuth/reference/html/#data-policy
1 reply
Jorge Tovar
@jorgetovar_gitlab
Ok I will look that. In short use plain brave to add all the headers logic. Right?
Adrian Cole
@adriancole
yeap
Marcin Grzejszczak
@marcingrzejszczak
@ricardoneves93 what I do is I debug the internals of a given library to understand how it works and how those threads are spawned. Maybe there's a better way but I don't know it ;)
Jorge Tovar
@jorgetovar_gitlab
I used this bean to create the retrofit bean with tracing in okhttp3 but it doesn't add the headers on the http call ... what can be the error?
` @Bean("retrofitTracing")
public Retrofit retrofitTracing(HttpTracing tracing) {
    OkHttpClient.Builder httpClient = new Builder();
    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
    httpClient.addInterceptor(logging);
    // httpClient.addInterceptor(new RetrofitSleuthInterceptor(tracer)); 
   // (with custom headers it works)
    Retrofit.Builder builder = new Retrofit.Builder();
    OkHttpClient client = httpClient.build();
    return builder.callFactory(TracingCallFactory.create(tracing, client))
            .baseUrl("http://localhost:8081/")
            .addConverterFactory(GsonConverterFactory.create())
            .client(client).build();
}`
10 replies
krraghavan
@krraghavan
I ended up using a dynamic proxy and a bean post processor to add tracing support for reactive mongo repositories. Is this something that’s of interest to support as part of sleuth itself? Just wondering if this can be supported via auto configuration. Is there a better way?
malika15
@malika15
Hi Marcin , we are using Spring Webflux in our API and using webclient to invoke a remote service. springCloudVersion is "Hoxton.RELEASE" . I see that the logs related to reactor threads are missing the MDC context information but the X-B3 headers are still in the payload. To fix this we are setting the MDC context from X-B3 headers in our custom logger attached to jettyHttpClient and then we can see the logs having the MDC information. Does this mean sleuth is setting the X-B3 headers in reactor threads but missing to add MDC context to those threads as part of TraceWebFilter implementation.
I just want to be sure we are not doing something that sleuth already does .
Adrian Cole
@adriancole
@jorgetovar_gitlab here's what I posted to your stackoverflow

you can configure brave's Call.Factory with retrofit with an HttpTracing bean configured by Sleuth and an instance of OkHttp

retrofitBuilder.callFactory(TracingCallFactory.create(httpTracing, okhttp))

https://github.com/openzipkin/brave/blob/master/instrumentation/okhttp3/README.md#tracingcallfactory https://github.com/square/retrofit/blob/63cf3e66c4b661170a34a396e9be8a2a01c0e57f/retrofit/src/main/java/retrofit2/Retrofit.java#L484

no reason to do anything otherwise I think
@krraghavan openzipkin/brave#1113
malika15
@malika15
Hi @adriancole @marcingrzejszczak , can you please let me know if i have to raise a stackoverflow before posting my question here . I posted earlier regarding sleuth adding X-B3 headers but not adding MDC context to reactor threads. And so we had to exclusively handle in our logger to grab the info from X-B3 headers and set MDC context on reactor thread . Can you please let me know if this is right ?
58 replies
malika15
@malika15
Hi @adriancole , please let me know if you need the gradle project . Thanks much , Malika
I posted the sample code in the Thread you started
krraghavan
@krraghavan
@adriancole thanks for the link. The solution I had actually works with the Spring repository abstraction rather than the driver level. I think there’s room for both although the driver one is likely only useful for deeper troubleshooting. I wrap the repository classes in a dynamic proxy and create a new child span in the handler. Feels like there’s room for both
benrejebmoh
@benrejebmoh
Good afternoon,
I'm facing an issue using sleuth in my application and calling an external java api wich do some calculation and return a CompletableFuture<T>.
Sleuth fields (traceId...) are not automatically injected into MDC for all logs in that CompletableFuture calculation part.
I checked the documentation, but the CompletableFuture is created and executed outside my application
Is there any solution so i can make the complete ecosystem aware of MDC of my application (wich contain sleuth fields)?
5 replies
Jorge Tovar
@jorgetovar_gitlab
hello, the sleuth instrumentation is working perfect with my http clients but I need to trace sqs events, I add the dependencies and all the required beans but I dont see headers of trace in the logs
What I need to do because I see in all the post that this should work out of the box
2 replies
@Bean
    public QueueMessageHandler queueMessageHandler() {
        QueueMessageHandlerFactory queueMsgHandlerFactory = new QueueMessageHandlerFactory();
        queueMsgHandlerFactory.setAmazonSqs(amazonSQSAsync());
        QueueMessageHandler queueMessageHandler = queueMsgHandlerFactory.createQueueMessageHandler();
        List<HandlerMethodArgumentResolver> list = new ArrayList<>();
        list.add(new HeadersMethodArgumentResolver());
        list.add(new PayloadArgumentResolver(new MappingJackson2MessageConverter()));
        queueMessageHandler.setArgumentResolvers(list);
        return queueMessageHandler;
    }
`
Jorge Tovar
@jorgetovar_gitlab
Another question @adriancole how can I get an span from string "05e36a8d977eee59" in sleuth
14 replies
Mannuru
@ARUNMANNURU
@here I want to trace the kafka messages received from kafka topic using Spring Cloud Sleuth
Is there any best blog post or any documentation I can refer to
Mannuru
@ARUNMANNURU
2020-06-13 00:17:24.523  INFO 17274 --- [ntainer#0-0-C-1] c.s.w.listeners.KafkaListeners   : Message Received from Kafka topic TEST: Hello
2020-06-13 00:17:24.523  INFO 17274 --- [ntainer#0-0-C-1] com.test.arun.util.ServicebusQueueImpl    : Sending Message to Service Bus: Hello
2020-06-13 00:17:24.600  INFO 17274 --- [ntainer#0-0-C-1] c.s.w.listeners.KafkaListeners   : ServiceBus Test Topic: Hello
2020-06-13 00:17:42.220  INFO 17274 --- [ntainer#0-0-C-1] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService
I added the below dependency