Skip to content

Enhance GET _node/stats/pipelines API for Metricbeat monitoring#10576

Merged
cachedout merged 43 commits intoelastic:masterfrom
cachedout:issue_101120
Jun 22, 2019
Merged

Enhance GET _node/stats/pipelines API for Metricbeat monitoring#10576
cachedout merged 43 commits intoelastic:masterfrom
cachedout:issue_101120

Conversation

@cachedout
Copy link
Copy Markdown
Contributor

@cachedout cachedout commented Mar 21, 2019

Closes #10120

This will fail tests until #10561 is merged in and this PR is rebased. I'm just parking it here until then. ;)

@ycombinator
Copy link
Copy Markdown
Contributor

@cachedout Looks like this PR now needs a merge/rebase from master.

author Guy Boertje <guy@elastic.co> 1556806171 +0100
committer Mike Place <mike.place@elastic.co> 1557234770 +0200

Bump JrJackson to 0.4.8

Fixes elastic#10748

LIR serializer refactor

Remove commented code

Remove more commented code

Remove license and add encoding

Style change to make code more vertical.

eid and hash

Use pipelines_info to construct the stats

Add tests for new fields

Add queue stats
@cachedout
Copy link
Copy Markdown
Contributor Author

@jsvd and @yaauie I believe the only remaining test failure is unrelated to this PR so I consider it ready for review. @ycombinator is currently doing some functional testing on it as well.

@ycombinator
Copy link
Copy Markdown
Contributor

ycombinator commented May 10, 2019

Hi @cachedout, I noticed a few things after running this PR:

  1. Per Enhance GET _node/stats/pipelines API for Metricbeat monitoring #10120 (comment), the vertices field should only be returned if ?vertices=true is set. At the moment the vertices field is always returned in the API response.

  2. If you look at the sample JSON document in Enhance GET _node/stats/pipelines API for Metricbeat monitoring #10120 (comment), particularly the queue field, you'll notice it looks like this, containing 4 fields under it:

    queue":{
      "type":"memory",
      "queue_size_in_bytes":0,
      "max_queue_size_in_bytes":0,
      "events_count":0
    }
    

    However, the queue field in the API response only contains the type field under it. Would it be possible to include the other 3 fields as well?

  3. This is a new requirement so feel free to defer it to a follow up PR. If the elasticsearch output plugin is being used in a pipeline, could we add cluster_uuids to that pipeline's object in the API response, similar to what we did in GET /_node/pipelines API response?

@ycombinator
Copy link
Copy Markdown
Contributor

ycombinator commented May 20, 2019

@cachedout I pulled down this PR and re-tested it. Looks like points 1 and 2 from my previous comment have been addressed but point 3 hasn't yet. [EDIT] Please let me know if you plan to address it in this PR or a follow up PR.

@cachedout
Copy link
Copy Markdown
Contributor Author

@ycombinator Sorry for the confusion. I was going to address the third point in a follow-up PR.

Copy link
Copy Markdown
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

Thanks @cachedout. In that case, this PR LGTM functionally.

@cachedout
Copy link
Copy Markdown
Contributor Author

This is ready for a review from @jsvd or @yaauie or somebody else on @elastic/logstash

@danhermann
Copy link
Copy Markdown
Contributor

We are going to need to commit the changes from #10561 into master since they were merged only into the 7.x branch. Is there a plan for addressing the tech debt introduced in #10561?

@cachedout
Copy link
Copy Markdown
Contributor Author

@danhermann By "tech debt" are you referring to this comment?

@danhermann
Copy link
Copy Markdown
Contributor

@danhermann By "tech debt" are you referring to this comment?

Both that one and the earlier comment about tighter coupling than we would like between Logstash core and plugins.

@cachedout
Copy link
Copy Markdown
Contributor Author

cachedout commented Jun 3, 2019

Hi @danhermann !

Forgive me, but I'm a bit confused by this:

We are going to need to commit the changes from #10561 into master since they were merged only into the 7.x branch.

The changes made by the commits in that PR do seem to be present in the master branch. For example, see the git blame here which seems to show these commits present in the master branch. Just in case, I tried creating a PR for but while the commits themselves apply cleanly, such a PR seems to result in no proposed changes to the files in the Logstash master branch. I'm not sure what I'm missing here so any help would be appreciated. :)

Regarding the comments about tight coupling, my understanding is that those were resolved via the introduction of the PluginMetadata system which was merged here and subsequent use of the new system in my changes. Did I misunderstand the nature of the tight-coupling problem? If you could provide more specifics about the nature of this problem which remain unresolved, I'd be happy of course to try and resolve them. :)

@danhermann
Copy link
Copy Markdown
Contributor

The changes made by the commits in that PR do seem to be present in the master branch.

My apologies, @cachedout. I saw those changes first as a series of distinct commits in the 7.x branch and missed that they had been committed into master as a single, squashed commit (as we prefer).

Regarding the comments about tight coupling, my understanding is that those were resolved via the introduction of the PluginMetadata system which was merged here and subsequent use of the new system in my changes. Did I misunderstand the nature of the tight-coupling problem? If you could provide more specifics about the nature of this problem which remain unresolved, I'd be happy of course to try and resolve them. :)

Let me take another look at those and get back to you in a day or two if that's ok.

Copy link
Copy Markdown
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

I think we're in a pretty good spot here.

I have left a comment about retaining the @api private comment on our helper method and repeated a suggestion to move the method declaration to below the public API methods.

Beyond that, everything is looking good.

Copy link
Copy Markdown
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

👍

LGTM. Thanks for all the work to wrangle this through, @cachedout

@cachedout
Copy link
Copy Markdown
Contributor Author

cachedout commented Jun 26, 2019

Thanks again for your help @yaauie. It's very much appreciated by me and the whole team. :)

@ycombinator Just as an FYI, the backport to this is here: #10909

cachedout added a commit to cachedout/logstash that referenced this pull request Jun 26, 2019
…tic#10576)

* parent 8c5697c
author Guy Boertje <guy@elastic.co> 1556806171 +0100
committer Mike Place <mike.place@elastic.co> 1557234770 +0200

Bump JrJackson to 0.4.8

Fixes elastic#10748

LIR serializer refactor

Remove commented code

Remove more commented code

Remove license and add encoding

Style change to make code more vertical.

eid and hash

Use pipelines_info to construct the stats

Add tests for new fields

Add queue stats

* bad merge resolution

* bad merge resolution

* Don't merge if nil

* Better merge strategy

* add vertex gate

* Guard against nil

* Use extended queue stats in pipeline report

* Add cluster uuids to Elasticsearch outputters in pipeline output

* move uuid

* remove old uuid lookup

* Only populate cluster_uuids when present

* remove print

* cluster_uuids -> cluster_uuid

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Make var singular

* Match singular var name

* Remove unnecessary nil check

* Pass in the matching pipeline for the report

* Remove old way of inserting cluster_uuids

* Update logstash-core/lib/logstash/api/commands/stats.rb

I like this much better and in testing it seems to work correctly.

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Remove unreferenced code that was part of debugging

* Remove events var which was unused

* Don't try to remove before insert

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Make pipeline extended stats generation more efficient

* Implement suggestion to improve readability

* Cleaner merging per review recommendation

* Only generate extended_stats once

* remove unneeded comments

* Add cluster_uuid to node vertex

* remove top-level cluster_uuids

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Implement change to make logic more simple suggested in review

* Rely on options gate to insert graph

Resolves concern here:
elastic#10576 (comment)

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Move UUID lookup to API layer

* Move private method to bottom per review recommandation
cachedout added a commit that referenced this pull request Jun 26, 2019
…) (#10909)

* parent 8c5697c
author Guy Boertje <guy@elastic.co> 1556806171 +0100
committer Mike Place <mike.place@elastic.co> 1557234770 +0200

Bump JrJackson to 0.4.8

Fixes #10748

LIR serializer refactor

Remove commented code

Remove more commented code

Remove license and add encoding

Style change to make code more vertical.

eid and hash

Use pipelines_info to construct the stats

Add tests for new fields

Add queue stats

* bad merge resolution

* bad merge resolution

* Don't merge if nil

* Better merge strategy

* add vertex gate

* Guard against nil

* Use extended queue stats in pipeline report

* Add cluster uuids to Elasticsearch outputters in pipeline output

* move uuid

* remove old uuid lookup

* Only populate cluster_uuids when present

* remove print

* cluster_uuids -> cluster_uuid

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Make var singular

* Match singular var name

* Remove unnecessary nil check

* Pass in the matching pipeline for the report

* Remove old way of inserting cluster_uuids

* Update logstash-core/lib/logstash/api/commands/stats.rb

I like this much better and in testing it seems to work correctly.

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Remove unreferenced code that was part of debugging

* Remove events var which was unused

* Don't try to remove before insert

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Make pipeline extended stats generation more efficient

* Implement suggestion to improve readability

* Cleaner merging per review recommendation

* Only generate extended_stats once

* remove unneeded comments

* Add cluster_uuid to node vertex

* remove top-level cluster_uuids

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Implement change to make logic more simple suggested in review

* Rely on options gate to insert graph

Resolves concern here:
#10576 (comment)

* Update logstash-core/lib/logstash/api/commands/stats.rb

Co-Authored-By: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Move UUID lookup to API layer

* Move private method to bottom per review recommandation
@cachedout cachedout mentioned this pull request Jul 17, 2019
5 tasks
andsel added a commit to andsel/logstash that referenced this pull request May 25, 2020
…s for _node/stats

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR elastic#10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.
andsel added a commit to andsel/logstash that referenced this pull request Jun 4, 2020
…s for _node/stats

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR elastic#10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.
andsel added a commit that referenced this pull request Jun 4, 2020
…s for _node/stats (#11923)

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR #10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.
andsel added a commit to andsel/logstash that referenced this pull request Jun 4, 2020
…s for _node/stats

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR elastic#10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.
elasticsearch-bot pushed a commit that referenced this pull request Jun 5, 2020
…s for _node/stats

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR #10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.

Fixes #11970
andsel added a commit to andsel/logstash that referenced this pull request Jun 8, 2020
…s for _node/stats

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR elastic#10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.
elasticsearch-bot pushed a commit that referenced this pull request Jun 9, 2020
…s for _node/stats

Avoid to reassing the subdocument for queue metrics preferring a merge
With PR #10576 the PluginsStats.report(stats) overwrites the subsection related to queue instead of merge with newly created entries.
@jsvd jsvd removed the v8.0.0 label Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance GET _node/stats/pipelines API for Metricbeat monitoring

5 participants