-
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
[libbeat] Add a metrics observer to the queue #39774
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
This pull request is now in conflicts. Could you fix it? 🙏
|
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.
Code looks ok, two requests.
-
can we add some user facing documentation on the fields? might be /docs/metrics-in-logs.asciidoc or maybe there is someplace better?
-
(optional) Diskqueue does support compression, might be worth a double check that the bytes reported make sense if compression is enabled.
This change requires a small follow up in the elastic_agent package. See elastic/integrations#9765 which references |
Looking at the metrics coming out of an 8.15.0-SNAPSHOT Filebeat I still see "pipeline": {
"clients": 7,
"events": {
"active": 0,
"dropped": 0,
"failed": 0,
"filtered": 0,
"published": 246036,
"retry": 0,
"total": 246036
},
"queue": {
"acked": 0,
"filled": {
"pct": {
"events": 0
}
},
"max_events": 0
}
}
}, |
@faec (thanks for these changes) QQ: 'queue.filled.pct' is a float (%) this is a percentage of memory correct? I'd imagine it's memory since the queue size is not defined in events. |
Add a metrics observer to the queue, reporting the metrics:
queue.added.{events, bytes}
, the number of events/bytes added to the queuequeue.consumed.{events, bytes}
, the number of events/bytes sent to the outputsqueue.removed.{events, bytes}
, the number of events/bytes removed from the queue after acknowledgment (queue.removed.events
is an alias for the existingqueue.acked
).queue.filled.{events, bytes}
, the current number of events and bytes in the queue (gauges)It also fixes the behavior of
queue.filled.pct.events
, renaming itqueue.filled.pct
.All byte values reported by the memory queue are 0 if the output doesn't support early encoding.
This required some refactoring to the pipeline, which previously used a single custom callback to track its only queue metric (
queue.acked
) fromoutputObserver
, and also used that to manage a wait group that was used to drain the queue on pipeline shutdown. The main changes are:queue.Observer
, with an implementationqueueObserver
for standard metrics reporting.queueMaxEvents
andqueueACKed
were removed frompipeline.outputObserver
, since their logic is now handled byqueue.Observer
.queue.Observer
instead of an ACK callbackDone()
channel that signals when all events are acked / shutdown is complete, so shutdown handling now waits on that channel inoutputController.Close
instead of the shared waitgroup inPipeline.Close
.pipeline.outputObserver
was renamedpipeline.retryObserver
since its only remaining functions track retries and retry failures. It is now owned byeventConsumer
(its only caller) instead ofpipeline.outputController
.The queue previously had a
Metrics()
call that was used in the shipper but didn't integrate with Beats metrics. It had no remaining callers, so I deleted it while adding the new helpers.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.