Skip to content

Conversation

@lmolkova
Copy link

@lmolkova lmolkova commented Aug 17, 2022

Fixes #26269, #28952

Processor

image

Async receiver

receiver.receiveMessages()
        .subscribe(m -> LOGGER.info("Message {} ", m.getBody().toString());

image

Sync receiver

Iterable<ServiceBusReceivedMessage> msgs = receiver.receiveMessages(2);
msgs.forEach(m -> receiver.complete(m));

image

Sync receiver with manual process span

Iterable<ServiceBusReceivedMessage> msgs = receiver.receiveMessages(2);
msgs.forEach(m -> {
    Context remoteParent = W3CTraceContextPropagator
            .getInstance()
            .extract(Context.current(), m.getApplicationProperties(), CONTEXT_GETTER);

    Span span = TRACER.spanBuilder("process message")
            .setSpanKind(SpanKind.CONSUMER)
            .setParent(remoteParent)
            .startSpan();
    try (Scope scope = span.makeCurrent()) {
        receiver.complete(m);
    } finally {
        span.end();
    }
});

image

@ghost ghost added the Service Bus label Aug 17, 2022
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-messaging-servicebus

@lmolkova lmolkova force-pushed the servicebus-receiver-instr branch from 6c888eb to a46b1f3 Compare August 17, 2022 17:49
@lmolkova lmolkova changed the title ServiceBus receiver client tracing insterumentation ServiceBus receiver client tracing instrumentation Sep 14, 2022
@lmolkova lmolkova marked this pull request as ready for review September 14, 2022 18:47
@lmolkova lmolkova force-pushed the servicebus-receiver-instr branch from 40f85ea to 92a04dc Compare September 14, 2022 19:32
@lmolkova lmolkova added this to the 2022-10 milestone Sep 15, 2022
@lmolkova lmolkova force-pushed the servicebus-receiver-instr branch from 7b9291b to e99f074 Compare September 20, 2022 03:24
@lmolkova lmolkova force-pushed the servicebus-receiver-instr branch 3 times, most recently from 6940a66 to df70821 Compare September 22, 2022 21:58
@lmolkova lmolkova force-pushed the servicebus-receiver-instr branch from df70821 to 41cdac5 Compare September 26, 2022 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQ] ServiceBus receiver is not traced

3 participants