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

Add kafka metrics related to local queue size #158

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

agbpatro
Copy link
Collaborator

@agbpatro agbpatro commented Apr 11, 2024

Description

Adds a go routine which periodically tracks pending messages to be sent to the broker.

Type of change

Please select all options that apply to this change:

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Checklist:

Confirm you have completed the following steps:

  • My code follows the style of this project.
  • I have performed a self-review of my code.
  • I have made corresponding updates to the documentation.
  • I have added/updated unit tests to cover my changes.
  • I have added/updated integration tests to cover my changes.

interval := time.Minute
t := time.NewTicker(interval)
for range t.C {
total := p.kafkaProducer.Len()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is total length including the delivered events

produceAckCount adapter.Counter
bytesAckTotal adapter.Counter
errorCount adapter.Counter
produceQueueSize adapter.Gauge
Copy link
Collaborator

Choose a reason for hiding this comment

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

producerQueueSize?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@@ -130,6 +132,18 @@ func (p *Producer) logError(err error) {
metricsRegistry.errorCount.Inc(map[string]string{})
}

func (p *Producer) reportProducerMetrics() {
interval := time.Minute
Copy link
Collaborator

Choose a reason for hiding this comment

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

One minutes feels like a really long interval; 5s? It should be super cheap right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

Adds a go routine which periodically tracks pending messages
to be sent to the broker.
@agbpatro agbpatro merged commit ae85f65 into main Apr 11, 2024
5 checks passed
@agbpatro agbpatro deleted the producer_len_metrics_kafka branch April 11, 2024 21:24
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.

None yet

2 participants