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

allows disable pod events enrichment with deployment name #28521

Merged
merged 9 commits into from
Nov 8, 2021

Conversation

newly12
Copy link
Contributor

@newly12 newly12 commented Oct 19, 2021

What does this PR do?

allows disable pod events enrichment with deployment name

Why is it important?

allows user to disable this enrichment due to the potential rate limit #28149

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.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 19, 2021
@mergify
Copy link
Contributor

mergify bot commented Oct 19, 2021

This pull request does not have a backport label. Could you fix it @newly12? 🙏
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 Oct 19, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 19, 2021

💚 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-11-05T15:06:57.136+0000

  • Duration: 140 min 47 sec

  • Commit: 821f06f

Test stats 🧪

Test Results
Failed 0
Passed 53548
Skipped 5225
Total 58773

💚 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.

@MichaelKatsoulis MichaelKatsoulis added the Team:Integrations Label for the Integrations team label Oct 20, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 20, 2021
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

@newly12 this change looks good to me however it will require a changelog entry and adding this option to docs. Thank you!

@newly12
Copy link
Contributor Author

newly12 commented Oct 28, 2021

@ChrsMark Thanks for reviewing this!

@ChrsMark ChrsMark self-assigned this Nov 1, 2021
@mergify
Copy link
Contributor

mergify bot commented Nov 2, 2021

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 deployment_name upstream/deployment_name
git merge upstream/master
git push upstream deployment_name

Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

Hey @newly12 ! This is looking good! I just left 2 comments to consider.

@@ -96,7 +96,7 @@ func GetPodMetaGen(
if namespaceWatcher != nil && metaConf.Namespace.Enabled() {
namespaceMetaGen = NewNamespaceMetadataGenerator(metaConf.Namespace, namespaceWatcher.Store(), namespaceWatcher.Client())
}
metaGen := NewPodMetadataGenerator(cfg, podWatcher.Store(), podWatcher.Client(), nodeMetaGen, namespaceMetaGen)
metaGen := NewPodMetadataGenerator(cfg, podWatcher.Store(), podWatcher.Client(), nodeMetaGen, namespaceMetaGen, metaConf)
Copy link
Member

Choose a reason for hiding this comment

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

Can't you just pass the value of metaConf.Deployment as bool?

@@ -107,7 +116,7 @@ func (p *pod) GenerateK8s(obj kubernetes.Resource, opts ...FieldOptions) common.
meta := p.namespace.GenerateFromName(po.GetNamespace())
if meta != nil {
// Use this in 8.0
//out.Put("namespace", meta["namespace"])
// out.Put("namespace", meta["namespace"])
Copy link
Member

Choose a reason for hiding this comment

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

@MichaelKatsoulis this line looks like a leftover from other PR, shall we open a fixup PR to remove it?

namespace MetaGen) MetaGen {
namespace MetaGen,
metaCfg *AddResourceMetadataConfig) MetaGen {
addDeploymentMeta := true
Copy link
Member

Choose a reason for hiding this comment

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

In combination with the previous suggestion you might can move this one layer up to GetPodMetaGen function.

@@ -139,7 +139,7 @@ func NewResourceMetadataEnricher(
cfg, _ := common.NewConfigFrom(&metaConfig)

metaGen := metadata.NewResourceMetadataGenerator(cfg, watcher.Client())
podMetaGen := metadata.NewPodMetadataGenerator(cfg, nil, watcher.Client(), nil, nil)
podMetaGen := metadata.NewPodMetadataGenerator(cfg, nil, watcher.Client(), nil, nil, &metadata.AddResourceMetadataConfig{Deployment: true})
Copy link
Member

Choose a reason for hiding this comment

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

Can't we leverage the value from the configuration here instead of setting always to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol I was simply following same like the other arguments and meantime keep the same behavior like previous version. so current configuration doesn't have a section for namespace nor node, wondering if deployment should be added first there..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the later commit I still passed a true to this function for the comment. we can discuss more on how this one should be handled properly.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, I see! I think we can leave it as is for now and try to address it in general in another round. I will open an issue for this :).

@newly12
Copy link
Contributor Author

newly12 commented Nov 4, 2021

@ChrsMark updated per your suggestion.

Copy link
Member

@ChrsMark ChrsMark 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 contributing this!

@ChrsMark
Copy link
Member

ChrsMark commented Nov 4, 2021

/test

@ChrsMark
Copy link
Member

ChrsMark commented Nov 4, 2021

@newly I see some lint errors, could you take a look?

@newly12
Copy link
Contributor Author

newly12 commented Nov 5, 2021

@ChrsMark just fixed. the CI failure seems to be non relevant to the code change(from this log).

@ChrsMark
Copy link
Member

ChrsMark commented Nov 5, 2021

Maybe we could merge the latest upstream/master and check if it helps?

@ChrsMark
Copy link
Member

ChrsMark commented Nov 8, 2021

CI passed, merging! Thank you @newly12 !

@ChrsMark ChrsMark merged commit 3d19ec0 into elastic:master Nov 8, 2021
v1v added a commit to v1v/beats that referenced this pull request Nov 8, 2021
…in-the-package-binareis

* upstream/master:
  allows disable pod events enrichment with deployment name (elastic#28521)
  Remove Docker input from Filebeat (elastic#28817)
  [breaking] Make default_field: false the default for all fields (elastic#28596)
  Osquerybeat: Improve osquery client connect code (elastic#28848)
  Add crawler  metrics into the stats metricset for Enterprise Search (elastic#28790)
  Remove the now deprecated appsearch module from metricbeat (elastic#28850)
  Remove Beat generators (elastic#28816)
  chore: upload files to Google Storage when they exist (elastic#28836)
  Revert "chore(ci): disable E2E tests in Beats (elastic#28715)" (elastic#28812)
  Deprecate generating custom Beats (elastic#28814)
  [Metricbeat] upgrade flatbuffers to 1.12.1 (elastic#28094)
  Osquerybeat: Fix restart flags after previously bad config (elastic#28827)
  Force ECS and JSON logging for libbeat/logp (elastic#28573)
  Filebeat: Error on startup for unconfigured module (elastic#28818)
  Deprecate log input in favour of filestream (elastic#28623)
  Fix some spelling mistakes (elastic#28080)
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…in-the-package-binareis

* upstream/master:
  allows disable pod events enrichment with deployment name (elastic#28521)
  Remove Docker input from Filebeat (elastic#28817)
  [breaking] Make default_field: false the default for all fields (elastic#28596)
  Osquerybeat: Improve osquery client connect code (elastic#28848)
  Add crawler  metrics into the stats metricset for Enterprise Search (elastic#28790)
  Remove the now deprecated appsearch module from metricbeat (elastic#28850)
  Remove Beat generators (elastic#28816)
  chore: upload files to Google Storage when they exist (elastic#28836)
  Revert "chore(ci): disable E2E tests in Beats (elastic#28715)" (elastic#28812)
  Deprecate generating custom Beats (elastic#28814)
  [Metricbeat] upgrade flatbuffers to 1.12.1 (elastic#28094)
  Osquerybeat: Fix restart flags after previously bad config (elastic#28827)
  Force ECS and JSON logging for libbeat/logp (elastic#28573)
  Filebeat: Error on startup for unconfigured module (elastic#28818)
  Deprecate log input in favour of filestream (elastic#28623)
  Fix some spelling mistakes (elastic#28080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants