Skip to content

Cherry-pick #21671 to 7.x: libbeat/logp: introduce Logger.WithOptions#21704

Merged
axw merged 1 commit intoelastic:7.xfrom
axw:backport_21671_7.x
Oct 13, 2020
Merged

Cherry-pick #21671 to 7.x: libbeat/logp: introduce Logger.WithOptions#21704
axw merged 1 commit intoelastic:7.xfrom
axw:backport_21671_7.x

Conversation

@axw
Copy link
Copy Markdown
Member

@axw axw commented Oct 12, 2020

Cherry-pick of PR #21671 to 7.x branch. Original message:

What does this PR do?

Add a Logger.WithOptions method, which clones the logger and applies given options. For example, this can be used to obtain a clone of the logger with sampling/rate limiting applied (e.g. using https://godoc.org/go.uber.org/zap/zapcore#NewSampler).

Why is it important?

In APM Server we have several would like to log a warning when a limit is reached, but only periodically thereafter to avoid flooding the logs and burning CPU.

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

None.

* libbeat/logp: introduce Logger.WithOptions

Add a Logger.WithOptions method, which clones
the logger and applies given options. For example,
this can be used to obtain a clone of the logger
with sampling/rate limiting applied.

(cherry picked from commit 3aceb31)
@axw axw added [zube]: In Review backport Team:Integrations Label for the Integrations team labels Oct 12, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 12, 2020
@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 Oct 12, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #21704 opened]

  • Start Time: 2020-10-12T04:38:53.373+0000

  • Duration: 94 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 16338
Skipped 1364
Total 17702

@axw axw merged commit 8447647 into elastic:7.x Oct 13, 2020
@axw axw deleted the backport_21671_7.x branch October 13, 2020 01:37
@zube zube bot removed the [zube]: Done label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Team:Integrations Label for the Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants