Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulsar-client-instrumentation can't inject receive() and receiveAsync() method #8162

Closed
coderzc opened this issue Mar 29, 2023 · 2 comments · Fixed by #8171
Closed

pulsar-client-instrumentation can't inject receive() and receiveAsync() method #8162

coderzc opened this issue Mar 29, 2023 · 2 comments · Fixed by #8171
Labels
bug Something isn't working

Comments

@coderzc
Copy link

coderzc commented Mar 29, 2023

Describe the bug

When I use receive()/ receiveAsync() method to receive messages on pulsar-client, can't export the "receive" span, but receive(int timeout, TimeUnit unit) work well.

Steps to reproduce

    public static void main(String[] args) throws PulsarClientException, InterruptedException {
        PulsarClient client = PulsarClient.builder()
                .serviceUrl(serviceUrl)
                .build();

        Consumer<String> consumer = client.newConsumer(Schema.STRING)
                .topic(topic)
                .subscriptionType(SubscriptionType.Shared)
                .subscriptionName("subs")
                .subscribe();

        Producer<String> producer = client.newProducer(Schema.STRING)
                .enableBatching(false)
                .topic(topic)
                .create();

        final int N = 1;

        for (int i = 0; i < N ; i++) {
            producer.newMessage().key("key-" + i).value("message-" + i).send();
        }

        for (int i = 0; i < N ; i++) {
            Message<String> receive = consumer.receive();
            System.out.println(receive.getValue());
        }
    }
java -javaagent:/path/opentelemetry-javaagent.jar \
     -Dotel.resource.attributes=service.name=myapp \
     -Dotel.traces.exporter=jaeger \
     -Dotel.metrics.exporter=none \
     -jar myapp.jar

What did you expect to see?

Export the "receive" span when using receive()/ receiveAsync() method to receive messages on pulsar-client.

What did you see instead?

Can't export the "receive" span

What version are you using?
v1.24.0

Environment
Compiler: JDK17
OS: "macOS M1"

Additional context

image

@coderzc coderzc added the bug Something isn't working label Mar 29, 2023
@mateuszrzeszutek
Copy link
Member

Hey @coderzc ,

Can you prepare a reproduction scenario for this issue?

@coderzc coderzc changed the title pulsar-client-instrumentation can't inject receive(int timeout, TimeUnit unit) and receiveAsync() method pulsar-client-instrumentation can't inject receive() and receiveAsync() method Mar 29, 2023
@trask
Copy link
Member

trask commented Mar 29, 2023

cc @tjiuming @asafm

laurit added a commit that referenced this issue Mar 30, 2023
Resolves
#8162
Instrument Consumer#receiveAsync() and Consumer#receive(). Although
comments in code indicate that batch receiving was instrumented it
didn't really work as far as I can tell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants