-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Events: migrate to new Counter type for Event Rule invocation analytics #12388
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
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 10m 3s ⏱️ - 45m 24s Results for commit 622ad14. ± Comparison against base commit cf90cd4. This pull request removes 1772 tests.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMT - thank you for implementing this :)
rule_invocation.labels( | ||
status=InvocationStatus.error, | ||
service=target_sender.service, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we maybe also capture the error so we know why the invocation failed - we have to capture something that does not reveals any private information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, maybe just the exception type? I'm not sure how many different types we can have, and also in this sense we'd probably need 2 different counters, as the labels would be different for both.
I don't have a lot of context into those and what we actually need for EventBridge, so if you want to add on this PR, you can 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🥳
# number of EventBridge rule invocations per target (e.g., aws:lambda) | ||
# - status label can be `success` or `error`, see InvocationStatus | ||
# - service label is the target service name | ||
rule_invocation = Counter(namespace="events", name="rule_invocations", labels=["status", "service"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: would it be interesting for you to also include the rule type? (standard, scheduled, etc.) or is that a detail that's not really useful at the moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: is there a risk that the namespace "events" is too generic and could collide with other services? Would it make sense to use something like "eventbridge" instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point for events
, it is the true name of the service so if we were to do a general dashboard based on the list of the official service names, that could be easier, but I can also see the issue with collision. 🤔
For the rule type label, I'd defer to @maxhoheiser: what do you think?
Could you please provide some guidance on how to trigger these event rule invocations locally? This would allow me to test the changes end-to-end, send events to Tinybird, and give you a chance to run queries on the test data before merging the PR. That way, we’ll have time to adjust the counter and refine the labels if needed 💪🏼 You can run the queries in the playground I shared with you: Playground |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point Vittorio about the testing instructions. I think running an integration test with against a manually launched LocalStack should do it. I'll update the PR description 😄
rule_invocation.labels( | ||
status=InvocationStatus.error, | ||
service=target_sender.service, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, maybe just the exception type? I'm not sure how many different types we can have, and also in this sense we'd probably need 2 different counters, as the labels would be different for both.
I don't have a lot of context into those and what we actually need for EventBridge, so if you want to add on this PR, you can 😄
# number of EventBridge rule invocations per target (e.g., aws:lambda) | ||
# - status label can be `success` or `error`, see InvocationStatus | ||
# - service label is the target service name | ||
rule_invocation = Counter(namespace="events", name="rule_invocations", labels=["status", "service"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point for events
, it is the true name of the service so if we were to do a general dashboard based on the list of the official service names, that could be easier, but I can also see the issue with collision. 🤔
For the rule type label, I'd defer to @maxhoheiser: what do you think?
66a4532
to
7ed38c2
Compare
@vittoriopolverino @maxhoheiser the PR has been approved, but there were some comments with some open questions. To avoid changing the "schema" of the sent events, do you think we should follow up on those questions now, or do you deem them closed? Thanks! |
Thanks for following up on this, @bentsku , I’d prefer to clear up any doubts now before merging 🙏🏼 Sorry for bringing this up so late 😭 but..... I still have some doubts about the naming. Using "events" as a namespace doesn’t seem very intuitive to me, as it’s actually a subset of EventBridge. If we were to monitor other EventBridge functionalities in the future, "events" wouldn’t really fit under the same umbrella as the other metrics where namespace="eventbridge" 🤔 |
@vittoriopolverino this was already addressed with 7ed38c2, the namespace is now but the true name of the service in AWS (like in the AWS CLI) really is It is true that in AWS, the Maybe if the |
After a quick chat with @bentsku 🙏🏼 , we decided to follow the existing convention already used in the code and repository structure, choosing not to group pipes, events, scheduler, etc., under the EventBridge namespace. |
7ed38c2
to
622ad14
Compare
Motivation
This PR replaces the analytics Counter used for tracking usage of Event rule invocations. We merge both Counter for success and failure into one, and use the new labels instead.
Changes
Testing
To test the changes:
tests.aws.services.events.test_events_targets.TestEventsTargetSqs.test_put_events_with_target_sqs
integration test withTEST_SKIP_LOCALSTACK_START=1
set, to avoid trying to start LocalStack with the testI've tried without sending the events but only printing the collected metrics and this is what I got: