micronaut-projects / micronaut-gcp

Integration between Micronaut and Google Cloud Platform (GCP)
Apache License 2.0
50 stars 35 forks source link

Feature Request: Propagate Tracing with Pub/Sub #242

Open viniciusccarvalho opened 4 years ago

viniciusccarvalho commented 4 years ago

Google Cloud Pub/Sub have samples on how to propagate tracing using Pub/Sub libraries https://opencensus.io/integrations/google_cloud/google_cloud_pubsub/java/. Would be nice to have, I have a WIP code already. Could use some help in tracing @graemerocher

graemerocher commented 4 years ago

Sure let me know what you need!

Btw for Pub/Sub I think it would be great if it was integrated into Micronaut Launch as well so that it appears on https://micronaut.io/launch/

Does folks often built message driven microservices with pub/sub?

viniciusccarvalho commented 4 years ago

I would love to contribute it to launch as well, just point me on the repo to make a contribution :D

Yes, pub/sub is a very popular service in GCP, I have a pending community tutorial with micronaut and metrics to be published soon (waiting final devrel editorial review) (https://cloud.google.com/community) and now that Pub/Sub is on the master, I'm planing to publish one soon too.

graemerocher commented 4 years ago

@viniciusccarvalho the code is at https://github.com/micronaut-projects/micronaut-starter/

For example this is a feature for Kafka:

https://github.com/micronaut-projects/micronaut-starter/blob/master/starter-core/src/main/java/io/micronaut/starter/feature/messaging/kafka/Kafka.java

Which then modifies the gradle build:

https://github.com/micronaut-projects/micronaut-starter/blob/master/starter-core/src/main/java/io/micronaut/starter/feature/build/gradle/templates/buildGradle.rocker.raw#L377

and the maven one:

https://github.com/micronaut-projects/micronaut-starter/blob/master/starter-core/src/main/java/io/micronaut/starter/feature/build/maven/templates/pom.rocker.raw#L320

That is the most basic thing you can do, then of course you could do something more extensive like define commands for creating subscribers etc. for example:

https://github.com/micronaut-projects/micronaut-starter/blob/master/starter-cli/src/main/java/io/micronaut/starter/cli/feature/messaging/kafka/CreateKafkaListener.java#L36

darksun commented 1 year ago

This issue is fairly old but I'm interested in this enhancement as well. I can make an attempt at the implementation but would need some help on the direction.