-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 basic metrics reporting to the memqueue #31703
Add basic metrics reporting to the memqueue #31703
Conversation
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
This pull request is now in conflicts. Could you fix it? 🙏
|
case schedACKs <- l.pendingACKs: | ||
// on send complete list of pending batches has been forwarded -> clear list | ||
l.pendingACKs = chanList{} | ||
} | ||
} | ||
} | ||
|
||
func (l *directEventLoop) handleMetricsRequest(req *metricsRequest) { | ||
req.responseChan <- memQueueMetrics{currentQueueSize: len(l.buf.entries)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len(l.buf.entries)
returns the total capacity of the queue, not its current number of events. The current event count (including events that have been read by consumers but not yet acked/removed from the queue) would be l.buf.regA.size + l.buf.regB.size
(it probably makes sense to make this a helper function on ringBuffer
since it's not obvious).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is indeed not obvious, thanks. :D
Update or rebase with main to fix the CI build errors. |
* first pass at having the memqueue report metrics * add sort of a test * format * fix length for ring buffer, clean up tests * add tests, occupiedRead * change field names, separate tests
What does this PR do?
First step towards #31113
This adds the basic framework for reporting queue metrics to the memqueue in libbeat. Right now this only adds the two most basic metrics, as I wanted to get feedback from @faec and make sure I was on the right track before I got into anything more in-depth.
This also appends a somewhat simplistic change to an existing test, which should probably be broken into a separate test on its own later.
Why is it important?
This helps address the queue metrics defined in #31113
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.