Skip to content

Add option to skip older k8s events - #29396

Merged
ChrsMark merged 7 commits into
elastic:masterfrom
ChrsMark:add_option_to_skip_events_k8s
Dec 14, 2021
Merged

ChrsMark merged 7 commits into
elastic:masterfrom
ChrsMark:add_option_to_skip_events_k8s

Conversation

@ChrsMark

@ChrsMark ChrsMark commented Dec 13, 2021 •

Copy link
Copy Markdown
Member

What does this PR do?

This PR adds option to skip older k8s events in event metricset of kubernetes module.

Why is it important?

There might be cases that LastTimestamp

// skip events happened before watch
FilterFunc: func(obj interface{}) bool {
eve := obj.(*kubernetes.Event)
if kubernetes.Time(&eve.LastTimestamp).Before(now) {
return false
}
is not populated properly (either buggy situation or updated API) and this results into all events being dropped. We need an option here to make the filtering configurable and avoid having Metricbeat dropping all events in case the LastTimestamp is not set.

Related to #28923

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark self-assigned this Dec 13, 2021
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 13, 2021
@mergify

mergify Bot commented Dec 13, 2021

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label. Could you fix it @ChrsMark? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify Bot added the backport-skip Skip notification from the automated backport with mergify label Dec 13, 2021
@ChrsMark ChrsMark added backport-v8.0.0 Automated backport with mergify Team:Integrations Label for the Integrations team labels Dec 13, 2021
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 13, 2021
@mergify mergify Bot removed the backport-skip Skip notification from the automated backport with mergify label Dec 13, 2021
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@elasticmachine

elasticmachine commented Dec 13, 2021 •

Copy link
Copy Markdown
Contributor

💚 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: 2021-12-14T12:12:00.453+0000

  • Duration: 87 min 17 sec

  • Commit: a09571d

Test stats 🧪

Test Results
Failed 0
Passed 9356
Skipped 2421
Total 11777

💚 Flaky test report

Tests succeeded.

🤖 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!)

@mergify

mergify Bot commented Dec 13, 2021

Copy link
Copy Markdown
Contributor

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b add_option_to_skip_events_k8s upstream/add_option_to_skip_events_k8s
git merge upstream/master
git push upstream add_option_to_skip_events_k8s

Signed-off-by: chrismark <chrismarkou92@gmail.com>
dedotConfig: dedotConfig,
watcher: watcher,
watchOptions: watchOptions,
skipOlder: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This value should come from the config like skipOlder: config.SkipOlder.
Now it is hardcoded to true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤦🏼‍♂️ you are right! Thanks for catching this!

Signed-off-by: chrismark <chrismarkou92@gmail.com>

@MichaelKatsoulis MichaelKatsoulis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark
ChrsMark merged commit 9b893e8 into elastic:master Dec 14, 2021
mergify Bot pushed a commit that referenced this pull request Dec 14, 2021
(cherry picked from commit 9b893e8)

# Conflicts:
#	metricbeat/module/kubernetes/event/config.go
ChrsMark added a commit that referenced this pull request Dec 14, 2021
* Add option to skip older k8s events (#29396)

(cherry picked from commit 9b893e8)

# Conflicts:
#	metricbeat/module/kubernetes/event/config.go

* Update CHANGELOG.next.asciidoc

* Update config.go

Co-authored-by: Chris Mark <chrismarkou92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v8.0.0 Automated backport with mergify Team:Integrations Label for the Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址