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

Adds Kafka producer metrics for buffer usage #4139

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

dlvenable
Copy link
Member

Description

This PR adds three new metrics for the kafka buffer:

  • recordQueueTimeAvg
  • recordQueueTimeMax
  • bufferExhaustedRate
  • bufferAvailableBytes

These are not topic-related, so I connected it to the KafkaProducer itself.

Issues Resolved

N/A

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: David Venable <dlv@amazon.com>

final Metric metric = metricNameEntry.getValue();

pluginMetrics.gauge(dataPrepperMetricName, metric, m -> (double) m.metricValue());
Copy link
Member

Choose a reason for hiding this comment

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

Will this metrics be emitted only once when the producer is initialized ?

Copy link
Member Author

Choose a reason for hiding this comment

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

That should be correct. The producer already exists as it is passed in here, so it does exist.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@dinujoh , I may have misunderstood you at first. Now I see that you are asking if this metric is only emitted once.

Micrometer controls the timing for gauges. So Micrometer will make this call every minute (this is the current configuration) and get the actual value at that point in time. So the metric is updated regularly.

Copy link
Member Author

Choose a reason for hiding this comment

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

To clarify, Micrometer calls the DoubleFunction every minute. Thus, it calls m -> (double) m.metricValue() every minute.

@dlvenable dlvenable merged commit 845569c into opensearch-project:main Feb 19, 2024
46 of 50 checks passed
@dlvenable dlvenable deleted the kafka-producer-metrics branch March 6, 2024 16:45
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