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

feat(meter): filter meter events by data properties #736

Closed

Conversation

Oltier
Copy link

@Oltier Oltier commented Mar 28, 2024

Filter ingested events by data properties

I came across #629 while looking for an issue to practice Go :) I decided to give it a Go (pun intended) and see what I can come up with and saw that you already had some FilterBy definitions.

This PR implements the EQ operation on event data for strings, and makes is so that events that don't match the Filter are not merged into the materialized view of the meter.

i.e.:
for input

{
   ...
   data: {
      duration: 123,
      result: 'success'
   }
}

the following meters

# tracks only success queries
meters:
  - slug: successful_duration
    description: Successful Requests
    eventType: request
    aggregation: SUM
    valueProperty: $.duration
    filterBy:
      - property: $.result
        operator: EQ
        value: success

# tracks all durations
  - slug: all_durations
    description: All request durations
    eventType: request
    aggregation: SUM
    valueProperty: $.duration

Partially fixes #629

Notes for reviewer

Before implementing any further, I wanted to check in with you, whether this Filter format is something you'd like to stick to and how deep you want to go with the supported types for filter values, what use cases are you aware of so far?

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Oltier Oltier closed this Apr 4, 2024
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.

Filter events by data properties
1 participant