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

enhancement(reduce transform): New setting for reduce transform: end_every_period_ms #20440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charlesconnell
Copy link

I propose a new setting available for use on reduce transforms: end_every_period_ms.

In my organization's use of vector, we are tailing Java log files to look for garbage collection events. We want to know the duration of the longest garbage collection that happened lately, for a rolling "lately," and report that value to Prometheus. I don't believe we can accomplish this with vector at present, but this PR will enable it. We can collect values and reduce them with a max merge strategy, then flush them every 60 seconds.

I am sure that this will be useful to many users in the long run. Periodically flushing a reducer surely has many applications.

I have compiled vector with this change and deployed it within my organization, and confirmed that it works for us. For example, here is a snippet of our config:

      "gc-log/parse0/g1Pauses0/pauseTimeMax0": {
         "end_every_period_ms": 60000,
         "group_by": [
            "reason",
            "subtype",
            "type"
         ],
         "inputs": [
            "gc-log/parse0/g1Pauses0"
         ],
         "merge_strategies": {
            "gc_millis": "max"
         },
         "type": "reduce"
      },

This PR does not include new test coverage. I am new to Rust and not familiar with best testing practices. My new code has behavior dependent on the system clock, and that seems hard to test.

@charlesconnell charlesconnell requested review from a team as code owners May 7, 2024 02:18
@bits-bot
Copy link

bits-bot commented May 7, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added domain: transforms Anything related to Vector's transform components domain: external docs Anything related to Vector's external, public documentation labels May 7, 2024
@jszwedko
Copy link
Member

jszwedko commented May 7, 2024

Thanks for this @charlesconnell ! We actually had a previous attempt at this that we had to revert: #16146. I think your PR resolves the issue that led to the revert by adding a new option rather than changing the behavior of an existing one.

I think this would close #16695.

@jszwedko jszwedko requested a review from lukesteensen May 9, 2024 14:21
Copy link
Member

@lukesteensen lukesteensen left a comment

Choose a reason for hiding this comment

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

Hi @charlesconnell, sorry for the delay in reviewing this! What you have here makes good sense to me and I'm glad to hear it's working well for you internally. I think successful use in production is a good substitute for tests, at least initially 😄. I agree they're a bit tricky with the time aspect, and that's something we can add after the initial PR if we deem it worthwhile.

It looks like the PR is slightly out of date, so would you mind merging or rebasing with master? Otherwise I think this is largely good to go.

@charlesconnell
Copy link
Author

thank you @lukesteensen , I've rebased now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: external docs Anything related to Vector's external, public documentation domain: transforms Anything related to Vector's transform components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants