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

libbeat/monitoring/inputmon - Ignore dataset metrics without name and id #34884

Merged

Conversation

andrewkroh
Copy link
Member

What does this PR do?

This filters metrics from the /inputs/ endpoint for entities that lack an input name and id.

This is needed because we continued to use the "dataset" namespace in the monitoring registry instead of using a new one like "inputs". Originally I planned to use to new namespace but I stayed with dataset because I wanted to prevent a breaking change for existing users of the /dataset API endpoint. This meant that metrics from the log input (and possibly others) that don't yet follow the conventions need to be filtered.

Why is it important?

The data being produced from the /inputs/ API is different than what we expected.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

Logs

Prior to this change when using the log input you would get data like this from the /inputs/ API. This data lacks an id or an input name. Plus it creates an entry for every file rather than one entry for the log input itself (which could lead to a lot more data than we expected).

% curl http://localhost:6060/inputs/ | jq .
[
  {
    "last_event_published_time": "2023-03-21T17:07:30.704Z",
    "last_event_timestamp": "2023-03-21T17:07:30.704Z",
    "name": "/var/log/jamf.log",
    "read_offset": 173391,
    "size": 536730,
    "start_time": "2023-03-21T21:07:30.136Z"
  },
  {
    "last_event_published_time": "2023-03-21T17:07:30.704Z",
    "last_event_timestamp": "2023-03-21T17:07:30.704Z",
    "name": "/var/log/install.log",
    "read_offset": 275589,
    "size": 25889274,
    "start_time": "2023-03-21T21:07:30.142Z"
  }
]

This filters metrics from the /inputs/ endpoint for entities that lack an input `name` and `id`.

This is needed because we continued to use the "dataset" namespace in the monitoring
registry instead of using a new one like "inputs". Originally I planned to use to new namespace
but I stayed with `dataset` because I wanted to prevent a breaking change for existing users of the
/dataset API endpoint. This meant that metrics from the log input (and possibly others) that don't
yet follow the conventions need to be filtered.
@andrewkroh andrewkroh requested a review from a team as a code owner March 21, 2023 21:31
@andrewkroh andrewkroh requested review from ycombinator and fearful-symmetry and removed request for a team March 21, 2023 21:31
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 21, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 21, 2023
@andrewkroh andrewkroh requested a review from a team March 21, 2023 21:31
libbeat/monitoring/inputmon/httphandler.go Outdated Show resolved Hide resolved
libbeat/monitoring/inputmon/httphandler.go Outdated Show resolved Hide resolved
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 21, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-03-22T13:23:15.302+0000

  • Duration: 68 min 16 sec

Test stats 🧪

Test Results
Failed 0
Passed 26044
Skipped 1965
Total 28009

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@andrewkroh andrewkroh merged commit a0c6bb6 into elastic:main Mar 22, 2023
mergify bot pushed a commit that referenced this pull request Mar 22, 2023
… id (#34884)

This filters metrics from the /inputs/ endpoint for entities that lack an input `name` and `id`.

This is needed because we continued to use the "dataset" namespace in the monitoring
registry instead of using a new one like "inputs". Originally I planned to use to new namespace
but I stayed with `dataset` because I wanted to prevent a breaking change for existing users of the
/dataset API endpoint. This meant that metrics from the log input (and possibly others) that don't
yet follow the conventions need to be filtered.

Co-authored-by: Dan Kortschak <[email protected]>
(cherry picked from commit a0c6bb6)
andrewkroh added a commit that referenced this pull request Mar 22, 2023
… id (#34884) (#34898)

This filters metrics from the /inputs/ endpoint for entities that lack an input `name` and `id`.

This is needed because we continued to use the "dataset" namespace in the monitoring
registry instead of using a new one like "inputs". Originally I planned to use to new namespace
but I stayed with `dataset` because I wanted to prevent a breaking change for existing users of the
/dataset API endpoint. This meant that metrics from the log input (and possibly others) that don't
yet follow the conventions need to be filtered.

Co-authored-by: Dan Kortschak <[email protected]>
(cherry picked from commit a0c6bb6)

Co-authored-by: Andrew Kroh <[email protected]>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
… id (#34884)

This filters metrics from the /inputs/ endpoint for entities that lack an input `name` and `id`.

This is needed because we continued to use the "dataset" namespace in the monitoring
registry instead of using a new one like "inputs". Originally I planned to use to new namespace
but I stayed with `dataset` because I wanted to prevent a breaking change for existing users of the
/dataset API endpoint. This meant that metrics from the log input (and possibly others) that don't
yet follow the conventions need to be filtered.

Co-authored-by: Dan Kortschak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.7.0 Automated backport with mergify bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants