Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 17:43

    spring-builds on main

    Bumping versions (compare)

  • 10:20
    HashZhang synchronize #2024
  • Sep 26 06:29
    jonatan-ivanov unlabeled #2029
  • Sep 26 06:29
    jonatan-ivanov labeled #2029
  • Sep 25 12:49
    MitchelLabonte closed #2029
  • Sep 25 12:49
    MitchelLabonte commented #2029
  • Sep 24 18:56
    spencergibb labeled #2029
  • Sep 24 18:56
    spencergibb unlabeled #2029
  • Sep 24 18:40
    marcingrzejszczak commented #2029
  • Sep 24 16:49
    spring-cloud-issues labeled #2029
  • Sep 24 16:47
    MitchelLabonte opened #2029
  • Sep 24 08:34
    spring-cloud-issues labeled #2028
  • Sep 24 08:32
    desertTown opened #2028
  • Sep 24 08:30
    HashZhang synchronize #2024
  • Sep 24 08:25
    HashZhang commented #2024
  • Sep 23 22:16
    jonatan-ivanov commented #2020
  • Sep 23 22:05
    jonatan-ivanov commented #2020
  • Sep 23 12:03
    marcingrzejszczak commented #2020
  • Sep 23 11:29
    spring-cloud-issues unlabeled #2020
  • Sep 23 11:29
    spring-cloud-issues labeled #2020
Deserttown
@desertTown
any sample of how to set "userId" from header to span in reative project?
Marcin Grzejszczak
@marcingrzejszczak
I don't see you actually try to set it at all, can you show us the code that doesn't work?
Deserttown
@desertTown
here is my ContexHolder
public class ReactiveRequestContextHolder {

    public static final Class<ServerHttpRequest> CONTEXT_KEY = ServerHttpRequest.class;

    public static Mono<ServerHttpRequest> getRequest() {
        return Mono.subscriberContext()
                .map(ctx -> ctx.get(CONTEXT_KEY));
    }

}
I can get related value like this
ReactiveRequestContextHolder.getRequest()
                .map(request -> request.getHeaders().getFirst("userid"))
and this will return Mono<String>
how can I set this value in span?
seems span tag only accept String type?
Deserttown
@desertTown
    @Bean
    SpanHandler handlerSpan() {
        return new SpanHandler() {
            @Override
            public boolean end(TraceContext traceContext, MutableSpan span, Cause cause) {
                Mono<String> userid = ReactiveRequestContextHolder.getRequest()
                        .map(request -> request.getHeaders().getFirst("userid"));
                String userId = userid.block();   //  this line wil throw this Exception java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-4

                span.tag("userId", userId);
                return true; // keep this span
            }
        };
    }
Deserttown
@desertTown
Hi @marcingrzejszczak
any suggestion about this case?
or could you give me a demo/guileline of "how to put header to all spans(one request) in reative project"?
Marcin Grzejszczak
@marcingrzejszczak
Hmm if I were you I'd create a reactive webfilter and use the ReactiveRequestContextHolder there within the mono
that way you don't block
Deserttown
@desertTown
you mean create another reactive webfilter?
Deserttown
@desertTown
create another WebFilter after ReactiveRequestContextFilter and use ReactiveRequestContextHolder.getRequest()?
Marcin Grzejszczak
@marcingrzejszczak
so instead of setting the value in the context you can tag the span directly
Deserttown
@desertTown
how can I tag the span direclty? I am confuse
Marcin Grzejszczak
@marcingrzejszczak
tracer.currentSpan().tag()
Deserttown
@desertTown
but this case, it just work in some some span
I got a requirement that I need all of my span(in one request) contains a tag("userid" propagate from header)
Marcin Grzejszczak
@marcingrzejszczak
that makes no sense
why do you need to tag all spans
Deserttown
@desertTown
that's the reason why
I need to store header in context cache first
Marcin Grzejszczak
@marcingrzejszczak
it's enough to tag one span
Deserttown
@desertTown
um... i see, seeems no sense to make all of span(in one request) contains that tag info
thanks for your help
Deserttown
@desertTown
Hi @marcingrzejszczak
I am doing a REST call using SpringBoot version 2.3.1 and SpringCloud version Hoxton.SR8
and type off Type of Span: Client and Server will share the same SpanId. and it looks like this in Zipkin dashboard
image.png
Marcin Grzejszczak
@marcingrzejszczak
and what is the question?
Deserttown
@desertTown
but once I use SpringBoot version 2.4.5 and SpringCloud version 2020.0.2
they dont share the spanId in type of Span: Client and Server
is it expected?
image.png
Marcin Grzejszczak
@marcingrzejszczak
so Sleuth delegates work to Brave, apparently that's a change in Brave. You can file an issue there if you think that it's wrong
Deserttown
@desertTown
you mean in gitter or github ?
could you share the Linked
let me file the issue in GitHub first
https://github.com/openzipkin/brave
thanks
Deserttown
@desertTown
@marcingrzejszczak
Brave support said this is an issue for spring-cloud-sleuth..
image.png
Marcin Grzejszczak
@marcingrzejszczak
interesting
we're also setting it to true
can you create a small issue that replicates this
Deserttown
@desertTown
yes, I will raise the issue with a demo project later
Marcin Grzejszczak
@marcingrzejszczak
thank you
Deserttown
@desertTown
@marcingrzejszczak
I had raise the issue with sample app, please help a check
Marcin Grzejszczak
@marcingrzejszczak
great, thank you I'll try to check it out today
Deserttown
@desertTown
thank you
Deserttown
@desertTown
Hi @marcingrzejszczak
can i know if there any update on this case
Marcin Grzejszczak
@marcingrzejszczak
sure, there are no updates until now - we are updating issues on the fly when we're wokring on them