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

Log Matched Events #63

Merged
merged 9 commits into from
Feb 23, 2023
Merged

Log Matched Events #63

merged 9 commits into from
Feb 23, 2023

Conversation

asatwal
Copy link
Collaborator

@asatwal asatwal commented Feb 7, 2023

Trello-975

Create an events filter for logging, so that we log only the events of interest. This will allow targeted logging for diagnostic and debugging purposes.

The events filter is held in a YAML config.

Event filter example:

#
# Allows logging of events that match the type and given filters on the fields
#
# All values are converted to regular expressions for matching
#
# Any filter fields can be defined as long as the field exists in the target event
#
# If there are mutiple filters then at least one must match the event
#
# All filter fields must match the event fields for a filter to match
#
shared:
  event_filters:
    -
      type: (create|update|delete)_entity
      entity_table_name: course_options
      data:
        key: id
        value: 12345

@asatwal asatwal requested a review from duncanjbrown February 7, 2023 21:05
@asatwal asatwal marked this pull request as draft February 7, 2023 21:12
@asatwal asatwal marked this pull request as ready for review February 21, 2023 17:43
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@duncanjbrown duncanjbrown left a comment

Choose a reason for hiding this comment

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

Great! Comments inline. I think there are a couple more things to think about re nested fields, and I'm not convinced we need to support them at this stage (unless something has changed), so I've proposed keeping this PR minimal and focussed on the use case at hand, ie matching top-level strings in the event payload.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
lib/dfe/analytics.rb Show resolved Hide resolved
lib/dfe/analytics.rb Outdated Show resolved Hide resolved
lib/dfe/analytics/event_matcher.rb Show resolved Hide resolved
spec/dfe/analytics/send_events_spec.rb Outdated Show resolved Hide resolved
@asatwal
Copy link
Collaborator Author

asatwal commented Feb 22, 2023

Great! Comments inline. I think there are a couple more things to think about re nested fields, and I'm not convinced we need to support them at this stage (unless something has changed), so I've proposed keeping this PR minimal and focussed on the use case at hand, ie matching top-level strings in the event payload.

@duncanjbrown - Thanks for the review. Some very useful feedback. I've added corrections and hopefully clarified the nested fields. We can remove the matching of nested fields and match at the top level only, that would simplify.

I've explained the nested fields through examples, so maybe we can add the examples below to the READ.me ? Or we can remove altogether, I'm not too fussed either way. I think it's not too complex, but then again I implemented this. I'll let you decide :-)

Copy link
Contributor

@duncanjbrown duncanjbrown left a comment

Choose a reason for hiding this comment

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

Brill, thanks for changes @asatwal !

Copy link
Contributor

@stevenleggdfe stevenleggdfe left a comment

Choose a reason for hiding this comment

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

Looks good to me; I think @duncanjbrown should approve though rather than me.

@asatwal asatwal self-assigned this Feb 23, 2023
@asatwal asatwal merged commit 86ebf54 into main Feb 23, 2023
@asatwal asatwal deleted the log-matched-events branch February 23, 2023 11:30
@asatwal asatwal mentioned this pull request Feb 24, 2023
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.

3 participants