elastic / apm-agent-go

https://www.elastic.co/guide/en/apm/agent/go/current/index.html
Apache License 2.0
418 stars 194 forks source link

Feature: github.com/Shopify/sarama tracing #36

Open axw opened 6 years ago

axw commented 6 years ago

Implement a tracing wrapper for the Client interface of https://github.com/Shopify/sarama.

axw commented 6 years ago

There's a couple of thorny issues here to work through:

Shelving this for now.

axw commented 5 years ago

I've done a little more investigation of tracing for sarama. Here are my current thoughts:

These wrappers will be extended with "WithContext" methods, so that context can be associated. This will enable propagation of trace context.

For produced messages, we'll create a span with a name like Produce <topic>. For a SyncProducer, we will end the span when the operation completes. For an AsyncProducer, the time of a span depends on the sarama configuration. If sarama is configured to return successes/errors, then we should wait for the response before ending the span; otherwise we'll have to treat it as being instantaneous.

Each message consumed by a wrapped consumer will result in a transaction with a name like Consume <topic>. This assumes a sort of message queue pattern where each message is processed independently. If instead messages are consumed within a transaction, then we might instead create a Consume <topic> span.