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

Bug: Calculation of inflight events does not consider dropped documents #108

Open
saiiman opened this issue Nov 8, 2024 · 3 comments
Open

Comments

@saiiman
Copy link

saiiman commented Nov 8, 2024

The calculation of inflight events is incorrect if documents are intentionally discarded in the logstash pipelines via the "drop" processor.

The method "calculateInflightEvents" (

inflightEvents := calculateInflightEvents(pipe.Events.In, pipe.Events.Out)
) determines the current inflight events based on the global IN / OUT values. If documents are dropped in the pipeline, the values gradually diverge.

Steps to reproduce

  1. create a pipeline with a “drop” processor
  2. analyze the pipeline statistics via “localhost:9600/_node/stats/pipeline” logstash api.
  3. compare the values with the output of the Icinga check
@martialblog
Copy link
Member

Hi, from what I can tell, the "inflight events" were a custom metric that the original check plugin used, based on this calculation:

inflight_events = events_in - events_out

When writing the Golang code, I decided to reuse this logic to keep compatibility with the old code. Generally I would say, it always tried to be an approximation, not sure though (I didn't write the original plugin), @widhalmt might have more information.

I'd say, where possible use the Pipeline Flow Metrics for newer Logstash versions.

@martialblog martialblog added the needs-triage Needs to be triaged label Nov 27, 2024
@widhalmt
Copy link
Member

@martialblog you're right: It always was an approximation. Full disclosure: I just didn't think of the possibility of dropping events when writing the initial version.

I'd really like to see an improvement like a more accurate representation. I'm just not able to write Golang code, yet. And, honestly, I think I'm not the right person to implement this.

While I can see a potential benefit of seeing the difference of incoming and outgoing events, it's definitely wrong to keep them as inflight_events.

@martialblog
Copy link
Member

We currently use the Node Stats API to get the in/out https://www.elastic.co/guide/en/logstash/current/node-stats-api.html#pipeline-stats

Not sure if we can get the information we require from this API. There's was a discussion about this already: #44

If someone has an idea where to get the required info from the API it should be possible to update the calculation.

@martialblog martialblog removed the needs-triage Needs to be triaged label Dec 16, 2024
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

No branches or pull requests

3 participants