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

[HACKATHON] Initial crack at an IdV matcher #11624

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/summarize-user-events
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require 'reporting/cloudwatch_client'
require 'reporting/cloudwatch_query_quoting'

require 'event_summarizer/example_matcher'
require 'event_summarizer/idv_matcher'

class SummarizeUserEvents
attr_reader :uuid, :from_date, :to_date
Expand All @@ -30,12 +31,15 @@ class SummarizeUserEvents

def matchers
@matchers ||= [
EventSummarizer::ExampleMatcher.new
EventSummarizer::ExampleMatcher.new,
EventSummarizer::IdvMatcher.new
]
end

def run
find_cloudwatch_events do |event|
Time.zone ||= 'America/New_York'

Copy link
Contributor

Choose a reason for hiding this comment

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

probably easier to set the timezone once, instead of for each event?

Suggested change
find_cloudwatch_events do |event|
Time.zone ||= 'America/New_York'
Time.zone ||= 'America/New_York'
find_cloudwatch_events do |event|

Copy link
Contributor

Choose a reason for hiding this comment

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

Done in #11627

Copy link
Member Author

Choose a reason for hiding this comment

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

I ran into an issue with this--I think that when the Cloudwatch client uses multiple threads each thread needs its time zone initialized.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I'll update it to use the configured zone.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm maybe we need to update the CW client to call that block back on the main thread only?

event['@message'] = JSON.parse(event['@message']) if event['@message'].is_a?(String)

matchers.each do |matcher|
Expand Down
Loading