Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ingest-store: expose Kafka operations via traces #7967

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Apr 25, 2024

What this PR does

This one improves the visibility between ingest-store and Kafka brokers by exposing the kgo's operations into traces.

Right now, all traces from the api_v1_push calls stop in the distributor. With the changes here, each Publish operation also become visible in the traces of the write path:

Screenshot 2024-04-25 at 14 19 07

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
@narqo narqo requested review from grafanabot and a team as code owners April 25, 2024 12:21
@@ -68,6 +69,7 @@ func commonKafkaClientOptions(cfg KafkaConfig, metrics *kprom.Metrics, logger lo
kgo.MetadataMaxAge(10 * time.Second),

kgo.WithLogger(newKafkaLogger(logger)),
kgo.WithHooks(kotel.NewKotel(kotel.WithTracer(kotel.NewTracer())).Hooks()...),
Copy link
Contributor Author

@narqo narqo Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that here we rely on OTel's global tracer (kotel.NewTracer falls back to it under the hood), rather than trying to pass the tracer as a dependency, like we do here for logger and metrics. I believe, this is fine and this is how tracing is used in gRPC and HTTP clients/servers.

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I also had a look through the otel changelog and it looks like nothing should affect us (major changes are around otlpmetricgrpc and otlptracegrpc, but we don't use either)

Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@dimitarvdimitrov dimitarvdimitrov merged commit 44f4c68 into main Apr 25, 2024
29 checks passed
@dimitarvdimitrov dimitarvdimitrov deleted the ingest-store-kafka-kotel branch April 25, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants