by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 07 21:32
    spring-issuemaster labeled #1711
  • Aug 07 21:27
    iulia-iancu opened #1711
  • Aug 07 18:42
    spring-issuemaster unlabeled #1690
  • Aug 07 18:42
    spring-issuemaster unlabeled #1690
  • Aug 07 18:42
    spring-issuemaster labeled #1690
  • Aug 07 18:40
    btkelly commented #1690
  • Aug 07 18:16
    saturnism commented #1465
  • Aug 07 12:04
    CircleCI failed: spring-cloud build (#6350) in https://github.com/spring-cloud/spring-cloud-sleuth
    • Added an option to disable refresh scope on samplers; fixes gh-1557
      (9d0ee1428dfc6b9c4c01e0c45bb05795c5c295ab by Marcin Grzejszczak)
  • Aug 07 11:58
    marcingrzejszczak commented #1557
  • Aug 07 11:57
    marcingrzejszczak closed #1557
  • Aug 07 11:57

    marcingrzejszczak on master

    Added an option to disable refr… (compare)

  • Aug 07 11:57
    marcingrzejszczak milestoned #1557
  • Aug 07 11:57
    marcingrzejszczak labeled #1557
  • Aug 07 11:57
    marcingrzejszczak unlabeled #1557
  • Aug 07 11:57
    marcingrzejszczak unlabeled #1557
  • Aug 07 11:14
    marcingrzejszczak labeled #1557
  • Aug 07 11:13
    marcingrzejszczak commented #1630
  • Aug 07 11:13
    marcingrzejszczak reopened #1630
  • Aug 07 11:12
    marcingrzejszczak closed #1630
  • Aug 07 11:12
    marcingrzejszczak commented #1630
eyalringort
@eyalringort
Marcin Grzejszczak
@marcingrzejszczak
I've answered
Veera93
@Veera93
@adriancole Thanks for you reply. So using trace filter is the only way in which I can get the traceId in the response header then
Marcin Grzejszczak
@marcingrzejszczak
You can use a filter and retrieve tracing info before sending out the response
eyalringort
@eyalringort
@marcingrzejszczak I added a sample project for my SO question
Marcin Grzejszczak
@marcingrzejszczak
:+1: thanks
krraghavan
@krraghavan
My spring webflux based boot application seems to post traces to zipkin properly but neither the logs nor the controller methods are getting the trace and span ids. It’s a pretty basic configuration with sleuth starter and zipkin starter. The trace web filter is getting invoked correctly and recording the initial span. I realize this is pretty vague but am wondering if I’m missing something basic. What information should I provide here if this is not obvious.
Marcin Grzejszczak
@marcingrzejszczak
if you're using a Controller with WebFlux and you log out things with a logger then that should work
2 replies
Templeton Peck
@LtTempletonPeck

Hi I now have traces being sent to X-Ray but the names that display in the X-Ray console for traces are not being correctly set for Feign and Spring Cloud Stream Kafka. For Feign they are using the http method, here is an example the name is get but the annotations.http_path has the path:

                "subsegments": [
                    {
                        "id": "f945f28acb910a16",
                        "name": "get",
                        "start_time": 1591611761.254306,
                        "end_time": 1591611761.583249,
                        "http": {
                            "request": {
                                "method": "GET"
                            }
                        },
                        "annotations": {
                            "http_path": "/device/v1",
                            "operation": "get"
                        },
                        "namespace": "remote"
                    },
                    ...

For Spring Cloud Stream Kafka I was hoping it would resolve the destination of the channel but at the moment it is using the binder as the name and the channel is in the annotations. It doesnt seem to have resolved the destination.

                    {
                        "id": "aeab33b8a6b2c004",
                        "name": "kafka",
                        "start_time": 1591611763.963422,
                        "end_time": 1591611763.968351,
                        "annotations": {
                            "channel": "output"
                        },
                        "namespace": "remote"
                    }

Do you know if its possible to override the name? So far I've tried @SpanName and @PostMapping(name = "my-name" but neither work.

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