Skip to content

Turn one event into multiple metrics #554

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

Merged
merged 2 commits into from
Jul 2, 2019
Merged

Turn one event into multiple metrics #554

merged 2 commits into from
Jul 2, 2019

Conversation

lukesteensen
Copy link
Member

This is a little funky, but it seemed to hit the right spot of non-invasive, flexible, and no perf impact (I was worried but the benches say I'm ok). Basically, transforms now have the option to implement a transform_into method where they can push as many events as they want into an output vec. The weird part is that this "overrides" the transform function but you still have to implement it.

Reasons I didn't do other things:

  • Returning a vec from transform required a bunch of changes and made most transforms more annoying to write, plus required allocating that vec no matter what
  • Passing in the output channel would mean transforms have to become more complicated stream adapters since send is async
  • Making a whole new stream adapter so we could reuse the same output vec would have been a lot more work and the benchmarks showed that we're not any slower than before
  • Doing a properly layered two-trait thing for transform and transform into would have gotten rid of the weirdness, but that also seemed like too much work for the moment. I think it's more likely that we rework this before too long than someone gets confused about the two methods.

Closes #379

@lukesteensen lukesteensen requested a review from LucioFranco July 2, 2019 15:27
@LucioFranco
Copy link
Contributor

check stable got sigkilled :(

@LucioFranco
Copy link
Contributor

@lukesteensen I bumped the box size here #555

@lukesteensen lukesteensen merged commit d8eadb0 into master Jul 2, 2019
@lukesteensen lukesteensen deleted the new-transform branch July 2, 2019 21:36
@binarylogic
Copy link
Contributor

Nice, I didn't realize this actually fixed the log_to_metric transform 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Derive multiple metrics from a single log event
3 participants