GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp

[Micrometer tracing] PubSub Binder does not propagate tracing data

Open
#1,995 6 comments 0 reactions 0 assignees View on GitHub
priority: p3 pubsub trace type: enhancement
Dominant language
Java
Stars
551
Forks
349
Avg merge
1d 13h
Merged PRs (30d)
14

Description

Hello.

We are migrating our SB 2.x services to SB 3.x and it looks like last thing that blocks us is the tracing capability.
We are using Pub/Sub messaging with Spring Cloud Stream abstraction.

I came up with simple project that reproduces the issue: https://github.com/poznachowski/sb3streamtracingpubsub
To reproduce just spin Pub/Sub emulator with docker-compose, run the application and trigger sending / receiving msg with localhost:8080 url.

```
2023-07-04T23:33:21.260+08:00 INFO [test-app,64a43bc116c85a50d4c93dc1dc3bf1dd,d4c93dc1dc3bf1dd] 18913 --- [nio-8080-exec-1] p.p.sb3tracingpubsub.TestProducer : Sending EVENT
2023-07-04T23:33:21.365+08:00 INFO [test-app,64a43bc1cb467df495cd174e9d205b6d,c86c8605779d116a] 18913 --- [sub-subscriber1] p.p.sb3tracingpubsub.TestConsumer : Event came: TestEvent[id=id1, value=value]
```
As can be seen in the logs traceId differs.

There is a lot of layers that are involved and I'm struggling with finding the issue. I dediced to raise the issue here (as opposed to spring cloud stream repository) as I changed the example to use RabbitMQ binder (https://github.com/poznachowski/sb3streamtracingpubsub/tree/rabbit_check) and it works like a charm:

```
2023-07-04T23:37:44.306+08:00 INFO [test-app,64a43cc86fb43c49417fffb851634466,417fffb851634466] 20175 --- [nio-8080-exec-1] p.p.sb3tracingpubsub.TestProducer : Sending EVENT
2023-07-04T23:37:44.350+08:00 INFO [test-app,64a43cc86fb43c49417fffb851634466,e9ea5ac2a5aa32a0] 20175 --- [opic.test-app-1] p.p.sb3tracingpubsub.TestConsumer : Event came: TestEvent[id=id1, value=value]
```

What I've seen is that RabbitTemplate (KafkaTemplate as well) received Micrometer observation support. Maybe something similiar has to be done for Pub/Sub ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.