Skip to content

Passing the traceID over a message bus that is NOT MQTT #3849

Discussion options

You must be logged in to vote

You can use the propagate package:

The producer could look something like this:

    def timer_callback(self):
        msg = String()
        main_angle = random.randrange(0, 45)
        with self.tracer.start_as_current_span("publish_message", SpanKind="PRODUCER"):
            payload = {
                    "servos": [
                        {"angle": 95},
                        {"angle": main_angle},
                        {"angle": main_angle},
                        ],
                    }
            propagate.get_global_textmap().inject(payload) # New line
            msg.data = json.dumps(payload)
            self.publisher_.publish(msg)
            self.otel_log.info('Publish…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@proffalken
Comment options

Answer selected by proffalken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants