Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 12 19:51
    davidmelia commented #1620
  • Apr 12 15:28
    spring-cloud-issues unlabeled #1900
  • Apr 12 15:28
    spring-cloud-issues labeled #1900
  • Apr 12 15:25
    vruzhansky commented #1900
  • Apr 12 14:50
    marcingrzejszczak labeled #1900
  • Apr 12 14:50
    marcingrzejszczak unlabeled #1900
  • Apr 12 14:50
    marcingrzejszczak commented #1900
  • Apr 12 14:38
    spring-cloud-issues unlabeled #1325
  • Apr 12 14:38
    spring-cloud-issues labeled #1325
  • Apr 12 14:35
    Johannes-Rost commented #1325
  • Apr 12 14:03
    spring-cloud-issues labeled #1900
  • Apr 12 14:03
    vruzhansky opened #1900
  • Apr 12 12:06

    marcingrzejszczak on service_discovery_instrumentation

    WIP (compare)

  • Apr 12 11:15
    marcingrzejszczak commented #1620
  • Apr 12 10:27
    davidmelia commented #1620
  • Apr 12 10:26
    marcingrzejszczak labeled #1325
  • Apr 12 10:26
    marcingrzejszczak unlabeled #1325
  • Apr 12 09:42
    davidmelia commented #1620
  • Apr 12 09:37
    davidmelia commented #1620
  • Apr 12 07:08
    spring-cloud-issues unlabeled #1325
natraj09
@natraj09
Hello , Does spring sleuth support OTLP transport or is it only zipkin over http. I found some content here https://github.com/spring-cloud-incubator/spring-cloud-sleuth-otel/blob/957334de6e6543307ff47c35960a4027d3d9a3ba/docs/src/main/asciidoc/sagan-index.adoc , not sure how can I ship it to a remote collector service
6 replies
Roussi Abdelghani
@roussi
Hi all, is there any tutorial for setting up spring sleuth with dockerized zipkin-server that use an elasticsearch storage using rabbitmq ?
Marcin Grzejszczak
@marcingrzejszczak
If you go to the docs and search for "how to set up zipkin with messaging" you get this https://docs.spring.io/spring-cloud-sleuth/docs/current/reference/html/howto.html#how-to-set-up-sleuth-with-brave-zipkin-messaging
4 replies
monnetchr
@monnetchr

Hi
I'm using the latests Spring Boot 2.4.3, Spring Cloud 2020.0.1 and Spring Cloud Sleuth OTel 1.0.0-M4 as described here https://github.com/spring-cloud-incubator/spring-cloud-sleuth-otel#quick-start
For propagation I use "type: W3C" in the config of Sleuth.
I have an MVC endpoint and within it, I use a RestTemplate to call another service which expects a traceparent header.
When I do an HTTP call on the endpoint, I can see traceId/spanId in the logs.
When the app calls the other service, on the wire I can see a traceparent header, and the other service indeed reuses the same traceId, so up to that point it all works as expected.
But when the restTemplate.exchange call is done, there is no traceId/spanId anymore.
Here is an extract from the logs:

2021-02-23 10:29:54.874 DEBUG [http-nio-8080-exec-6] o.s.w.c.RestTemplate.debug HTTP GET https://some-other-service username=admin traceId=a2d2ec295687b6956049721e61cfca7c spanId=23e9d443a8d488f1
2021-02-23 10:29:54.884 DEBUG [http-nio-8080-exec-6] o.s.c.s.i.w.m.TracingClientHttpRequestInterceptor.intercept Wrapping an outbound http call with span [RecordEventsReadableSpan{traceId=a2d2ec295687b6956049721e61cfca7c, spanId=4c55a17e71705bde, parentSpanContext=ImmutableSpanContext{traceId=a2d2ec295687b6956049721e61cfca7c, spanId=23e9d443a8d488f1, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, name=HTTP GET, kind=CLIENT, attributes=AttributesMap{data={net.transport=IP.TCP, http.method=GET, http.flavor=1.1, net.peer.name=some-other-service, http.url=https://some-other-service, http.path=/some-path, net.peer.port=0}, capacity=1000, totalAddedValues=7}, status=ImmutableStatusData{statusCode=UNSET, description=null}, totalRecordedEvents=0, totalRecordedLinks=0, startEpochNanos=1614072594880806400, endEpochNanos=0}] username=admin traceId=a2d2ec295687b6956049721e61cfca7c spanId=4c55a17e71705bde
...
2021-02-23 10:29:56.204 DEBUG [http-nio-8080-exec-6] o.s.c.s.o.b.OtelHttpClientHandler.handleReceive There was no error, will finish span [RecordEventsReadableSpan{traceId=a2d2ec295687b6956049721e61cfca7c, spanId=4c55a17e71705bde, parentSpanContext=ImmutableSpanContext{traceId=a2d2ec295687b6956049721e61cfca7c, spanId=23e9d443a8d488f1, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, name=HTTP GET, kind=CLIENT, attributes=AttributesMap{data={net.transport=IP.TCP, http.method=GET, http.flavor=1.1, net.peer.name=some-other-service, http.url=https://some-other-service, http.path=/some-path, net.peer.port=0}, capacity=1000, totalAddedValues=7}, status=ImmutableStatusData{statusCode=UNSET, description=null}, totalRecordedEvents=0, totalRecordedLinks=0, startEpochNanos=1614072594880806400, endEpochNanos=0}] in a standard way username=admin traceId=a2d2ec295687b6956049721e61cfca7c spanId=4c55a17e71705bde
2021-02-23 10:29:56.204 DEBUG [http-nio-8080-exec-6] o.s.w.c.RestTemplate.debug Response 200 OK username=admin

What could be the problem here?

17 replies
natraj09
@natraj09
@marcingrzejszczak the new snapshot https://spring-cloud-incubator.github.io/spring-cloud-sleuth-otel/docs/1.0.0-SNAPSHOT/reference/html/project-features.html#features-otel-otlp works out of the box now.
To set 100% sampling , should it work with the
spring.sleuth.sampler.probability=1.0 property or initialize the following bean
@Bean
    public Sampler defaultSampler() {
        return Sampler.alwaysOn();
    }
2 replies
Anders Clausen
@AndersClausen
Hey @marcingrzejszczak and @jonatan-ivanov. Just wanted to thank you for getting the following issue spring-cloud/spring-cloud-sleuth#1851 fixed so quickly. It was very important to the work we're doing at the moment and meant a lot to us, so really appreciate the quick turn around.
1 reply
Marcin Grzejszczak
@marcingrzejszczak
No problem, we're doing our best :) thank you for using the tool!
CharlesB
@azizabah
Does anyone have some experience with implementing sending traces to AWS XRay? I have it working but it's not sending over the right data points to populate some of the necessary parts of AWS. For example below - I need to add more information into the http object and was wondering what the easiest way to do that is.
"Document": {
                "id": "0690dd07e0adb349",
                "name": "pdw-service-dev",
                "start_time": 1614290165.986539,
                "trace_id": "1-60381cf0-77a9195e5837bab20f56623c",
                "end_time": 1614290166.019955,
                "parent_id": "06dc4fe4416247fa",
                "http": {
                    "request": {
                        "method": "GET"
                    }
                },
                "annotations": {
                    "mvc_controller_class": "CanonicalProductController",
                    "mvc_controller_method": "getProducts",
                    "http_path": "/products/",
                    "operation": "get /products/"
                },
Anders Clausen
@AndersClausen
Hi @marcingrzejszczak. I saw your reply here https://gitter.im/spring-cloud/spring-cloud-sleuth?at=601d179d1640d2090738ee30 and wondered what we can do in order to get that feature added. Should we raise this with the Reactor team (Oleh Dokuka maybe?) or what's needed. We've started using reactive kafka through Project Reactor dependencies and are very depended on the traces working with Sleuth. We've noticed that the KafkaProducer can take interceptors - would this be a way in for Sleuth?
2 replies
Michał Lipiński
@falsyvalues

Hi,
while I was thinking I got everything working with Sleuth, it looks like its not at the very end. In scenario (A -> B -> C) B service adds one extra field during regular call and this seems to be broken (not visible on MDC etc.).
Setting value at controller / service (B) level (is that suppose to be working?):

Optional.ofNullable(BaggageField.getByName("bid"))
    .ifPresent(field -> field.updateValue("test"));

While this works fine on filter level in gateway service A, its not in service B during regular call. Using same configuration that's proven its working:

  sleuth:
    baggage:
      correlation-enabled: true
      correlation-fields:
        - aid
        - bid
      remote-fields:
        - aid
        - bid
      tag-fields:
        - aid
        - bid

Dependencies : spring-boot-starter-parent@2.3.8.RELEASE + spring-cloud-aws@Hoxton.SR9
What could be the problem here?

Marcin Grzejszczak
@marcingrzejszczak
I don't know if aws works fine
4 replies
we're not really supporting it anymore
Lukáš Vasek
@bilak
Hello, I'd like to add brave/zipkin to azure's servicebus library. Can somebody tell me what interfaces/classes do I need to implement? I know that it's possible to use JMS for the servicebus, but in some services we use directly this library so I'd like to provide trancing also for those libraries. Thanks in advance
1 reply
Veera93
@Veera93

@jonatan-ivanov I am trying to implement kafka batch and slueth was not being generated in consumer app. On referring to spring-cloud/spring-cloud-sleuth#1721 I found out that its because of batch listener vs non-batch listener.

Are there any developments/work around on the same? Like i read the messages and call a function of a different service for each unique message, since the execution is happening in the kafka thread, even in the logs statements inside the function dont have traces set

2 replies
Marcin Grzejszczak
@marcingrzejszczak:matrix.org
[m]
I merged the PR - you can check out the snapshots
J Thomas
@jt-helsinki

Hi, does the zipkin server support registering with the Eureka discovery client? Also, is the spring config server supported by zipkin?

Does anyone have an example of how to do this with the latest Zipkin? I've tried extending the server but I keep getting a java.lang.ClassNotFoundException: zipkin2.internal.Buffer$Writer error.

Jonatan Ivanov
@jonatan-ivanov
@bastiat You can add only the fields to MDC that you need from your log config.
merusso
@merusso

Could someone help me understand how Spring Cloud Sleuth OTel differs from OpenTelemetry's own Java instrumentation? Are these complimentary or mutually exclusive projects? Why would developers choose one option over another?

If you go to OpenTelemetry's site, you'll be directed toward their java-instrumentation project which they say offers support for many Spring projects in this list. They talk about using either "automatic instrumentation" (Java agent) or "manual instrumentation" (SDK) described here.

However, if you go to Spring's site, you'll be led to Spring Cloud Sleuth and probably find your way to the incubating spring-cloud-sleuth-otel project.

I find this quite confusing and I assume many others will also.

5 replies
kartikpandey39
@kartikpandey39

Hi, I have a set of spring boot (v 2.3.5) services service A-> service B -> & so on. I need to pass/propagate custom headers received via Client for e.g "OfferId" to all the services involved B-> C....->X
From documentation what I can infer is to use below specified application properties.

 spring.sleuth.baggage.local-fields=country-code
 spring.sleuth.baggage.remote-fields=country-code
 spring.sleuth.baggage.correlation-fields=country-code

Currently I am able to view the custom header i.e country-code in only service A. But it does not propogate to B.
I have added these dependencies in my pom.xml in both the services project:

``` 
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
        <version>2.2.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>Hoxton.SR10</version>
        <type>pom</type>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    ``` 
  1. Is the propagation possible without explicitly specifying baggagefields and just using application properties?

  2. Is there a minimal sample available that I can refer to achieve this task? I am new to Java world and it may be possible that I may have missed few basic requirements/dependencies to achieve this.

4 replies
ronakpatelinfodesk
@ronakpatelinfodesk
2021-03-05_16h51_23.png
I have created 2 simple projects with one rest controller to have traceid & spanid in logs:
  1. Using spring-boot-starter-webflux:2.4.3, spring-cloud-starter-sleuth:3.0.1 -> This logs traceid & spanid.
2021-03-05_16h50_31.png
2: Using spring-cloud-starter-gateway:3.0.1, spring-cloud-starter-sleuth:3.0.1 -> This do not logs traceid & spanid.
2021-03-05_16h53_16.png
2021-03-05_16h52_33.png
Can some one help, how we can get traceid & spanid in logs using spring-cloud-starter-gateway:3.0.1 ?
ronakpatelinfodesk
@ronakpatelinfodesk
yes
John Watson
@jkwatson
Has anyone been able to get W3C Baggage to propagate into a Sleuth app with spring-cloud-sleuth-otel? I've tried every different setting I can find and can't get it to show up. I can get sleuth-style baggage to show up, but not W3C. Is there a setting I'm missing?
20 replies
Marcin Grzejszczak
@marcingrzejszczak
Imo that doesn't make a lot of sense of there's no span. Also we will pick either of the formats not both. The first one matching wins
Most likely the gitter mobile app didn't respond in the thread so sorry if the response is there in the main channel
blake-bauman
@blake-bauman
Hi. I'm using Sleuth 3.0.1 and I'm setting the spring.sleuth.baggage.remote-fields: Foo-Header property along with spring.sleuth.baggage.local-fields: Foo-Header and spring.sleuth.baggage.correlation-fields: Foo-Header. I can see the baggage added to the MDC in my service working just fine, and BaggageField.getByName() returns a valid value, but when I make a WebClient call to a downstream service, that service is not receiving Foo-Header. Am I missing a property? Is there a good place where I can set a breakpoint to see how WebClient calls are being decorated?
Marcin Grzejszczak
@marcingrzejszczak
@blake-bauman check TraceWebClientBeanPostProcessor and TraceExchangeFilterFunction
11 replies
Marcin Grzejszczak
@marcingrzejszczak
And we have a sample that proves that baggage propagation works fine
blake-bauman
@blake-bauman
I'm sure I'm doing something wrong, just trying to figure out what that is. Can you point me to that sample? Maybe I can use that to figure out what I'm missing. I was browsing and stepping through the post processor and filter function, but couldn't find where the headers were supposed to get set. I'm sure I'm missing something obvious.
If you think that this sample is wrong or doesn't prove that the feature works don't hesitate to ping us
blake-bauman
@blake-bauman
Will do. I'll compare this to our app first. Thanks.
Marcin Grzejszczak
@marcingrzejszczak
Wait a second. Remote fields are not baggage... Baggage is one thing remote fields is just propagating some headers on
blake-bauman
@blake-bauman
I apologize. I may be misusing terms. I'm trying to use remote-fields to propagate a header to a downstream service. This seems to be working for me with Spring Cloud Gateway, but not with a WebClient call. The data does show up when I access the BaggageField directly.
Marcin Grzejszczak
@marcingrzejszczak
It should be there in 2020.0.2 train and sleuth 3.0.2 release
blake-bauman
@blake-bauman
Yeah, I noticed the PR yesterday (spring-cloud/spring-cloud-sleuth#1884). I think it should resolve my issue. It doesn't seem to be assigned a milestone, but did it get into 3.0.2?
Marcin Grzejszczak
@marcingrzejszczak
Cause we stopped double assinging milestones. That means that this pr corresponds to an issue. The issue has the milestone and project set. So yup, that should go to 3.0.2
blake-bauman
@blake-bauman
Great. I should be able to try it out later today.
jay
@legendjaks

I am using spring-cloud-starter-sleuth-3.0.2. Without any configuration, by default logging works fine, . When service calls are made across services, it is difficult search, due to no space between span-id and trace-id like [playground-service,40a43685ec748dc6,40a43685ec748dc6]. So I want to take the X-B3-ParentSpanId and print it as seperate field, so that with X-B3-ParentSpanId, I can search all logs across services.

I tried

<property name="CONSOLE_LOG_PATTERN"
    value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} [%X{X-B3-TraceId:-}]  %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>

but it is always coming as [], e.g.,

2021-03-23 16:22:52.752 []   INFO [playground-service,40a43685ec748dc6,40a43685ec748dc6] 33124 --- [nio-8085-exec-1] c.p.service.ProductService     : Get 1

How I can fix this?

2 replies
rajdeepbiswas101
@rajdeepbiswas101

@marcingrzejszczak :
I am using this filter function which attaches to weblient for logging request:

public static ExchangeFilterFunction logRequest() {
        return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
                StringBuilder sb = new StringBuilder("application: Request: \n");
                sb.append(clientRequest.method()).append(": ").append(clientRequest.url()).append("\n");
                clientRequest
                        .headers()
                        .forEach((name, values) -> values.forEach(value -> sb.append(name).append("=").append(value).append("; ")));
            log.info(sb.toString());
            return Mono.just(clientRequest);
        });
    }

I don't get traceId in log object for a particular POST call while the header of the same call contains X-B3-TraceId.
Where am I going wrong with this particular request?

venraf
@venraf
Hi everyone, please could someone help me with this problem: spring-cloud/spring-cloud-sleuth#1886 ? Thanks
1 reply
Viacheslav Petriaiev
@Viacheslav-Petriaiev

Hi @marcingrzejszczak ,

What is the best way to implement rest-client exchange logging(request headers + body, response headers + body using my custom format) with tracing information in the project-reactor environment?

I've tried
https://careydevelopment.us/blog/spring-webflux-how-to-log-requests-with-webclient
but this approach is not acceptable for request body logging

I've implemented the Jetty HTTP client approach which is described here: https://www.baeldung.com/spring-log-webclient-calls
But spring-cloud-sleuth has no instrumentation support for the Jetty HTTP client

Do you have any suggestions?

Thank you

2 replies
jay
@legendjaks

I am using spring-cloud-starter-sleuth-3.0.2. This version and previous versions has this following problem. When SQL exception is thrown while stream processing (or) HTTP request processing, the exception log doesn't contain traceId & spanId. e.g.,

2021-03-25 20:13:19.275 ERROR [playground-service, 060e765b154dbe18, 2ae46011f7c42eaa] 13367 --- [container-1-C-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : Duplicate entry 'OnePlus 1' for key 'uq_p_name'

2021-03-25 20:13:19.306 ERROR [playground-service, , ] 13367 --- [container-1-C-1] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.cloud.stream.function.FunctionConfiguration$FunctionToDestinationBinder$1@4d6056e6]; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [uq_p_name]; nested exception is org.hibernate.exception.ConstraintViolationException:

How can I include traceId & spanId, in this case?

3 replies
Jens Geiregat
@jgrgt

I'm using Sleuth and OTEL (1.0.0-M7). Trying to set something up that can send traces to DataDog. I'm running an OTEL collector that prints to console and sends to DataDog. I've set up my Sleuth. The missing part is getting my traces from Sleuth to that collector...

Some people seem to use the OpenTelemetry agent? I added that to my process and it's sending its own traces now, but not the ones from Sleuth...
Other people say to use the opentelemetry-exporter-otlp but then I get errors like this:
No functional channel service provider found. Try adding a dependency on the grpc-okhttp, grpc-netty, or grpc-netty-shaded artifact -> I could throw in some more dependencies, but I'm not sure which one to pick etc...

I've read though the manuals, tried to debug, googled, but I'm still unsure what the correct way is or what I should do to fix any of the options above?

2 replies