Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Trace time message spent in Kafka #143

Open
arkadyb opened this issue Jul 2, 2019 · 5 comments
Open

Trace time message spent in Kafka #143

arkadyb opened this issue Jul 2, 2019 · 5 comments

Comments

@arkadyb
Copy link

arkadyb commented Jul 2, 2019

Is there some way to trace time message spend in Kafka? I have async application where service 1 recives requests and stores message into Kafka. Service 2 - consumer, reads messages from Kafka and handles some other activities.

So, according to the manuals i found i was able to inject span context into Kafka headers in service 1, extract them into span context on service 2 site and start span with this info there. So the resulted graph (using jaeger) shows gap at the time message was in the bus. Is there some way to mark this time with respective Kafka span?

@yurishkuro
Copy link
Member

Why do you need an extra span? The gap between producer and consumer spans is already measurable.

@yurishkuro
Copy link
Member

Here's a trace from https://github.com/PacktPublishing/Mastering-Distributed-Tracing/tree/master/Chapter05. You can see time difference between send and receive spans.

B08957_05_05

@arkadyb
Copy link
Author

arkadyb commented Jul 2, 2019

Thats true, but it would be nice to be able plot a span specifying what the gap is - Kafka, PG, MySQL or what ever else.

@yurishkuro
Copy link
Member

I cannot speak for other tracing systems, but in Jaeger we made a design decision that a span "belongs" to a single process, which is reflected in the data model, e.g. in properties like span.process.serviceName. This ensures that the start/end timestamps in the span are comparable, which is not true if they come from different processes / different hosts (clock skew).

I am going to move this issue to another repo, since it's not specific to Go API.

@yurishkuro yurishkuro transferred this issue from opentracing/opentracing-go Jul 3, 2019
@guilherme-souza-lima
Copy link

hi @arkadyb

how did you inject the context into the kafka header?

and how did you extract it in the second microservice?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants