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

fix: Standardise kafka (client|writer|tenant-tee) metric names #16882

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benclive
Copy link
Contributor

What this PR does / why we need it:
The metric names are very inconsistent. Some of them are wrapped in loki_distributor and kafka, others are not and don't have any prefix (!)

  • kafka_client.WriterClient => Now adds loki_distributor_kafka_ prefix to metrics. These come from a lib and expect a registerer.
  • kafka_client.Producer => Now adds loki_distributor_ prefix to metrics. These are our own code so we are already adding the kafka_ prefix but not the other bits.
  • tenant_tee => These were manually adding loki_distributor_ which I've wrapped in a registerer. It also containers a Producer client which inheririts the registerer and adds its own kafka_ prefix (as before).

This makes it a bit easier to search for these metrics. Previously they were hard to find, as some of them were called things like buffered_fetch_records which are now loki_distributor_kafka_buffered_fetch_records.

@benclive benclive requested a review from a team as a code owner March 24, 2025 17:52
@benclive benclive changed the title Standardise kafka (client|writer|tenant-tee) metric names fix: Standardise kafka (client|writer|tenant-tee) metric names Mar 24, 2025
@@ -304,6 +305,8 @@ func NewTenantTopicWriter(
return nil, fmt.Errorf("unknown strategy %q", strategy.String())
}

reg = prometheus.WrapRegistererWithPrefix("tenant_topic_tee_", reg)
Copy link
Contributor

Choose a reason for hiding this comment

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

this would also add the prefix to the producer metrics, is this intentional? an alternative could be to register with a constant label that says producer="tenant_topic_tee"

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

Successfully merging this pull request may close these issues.

2 participants