-
Notifications
You must be signed in to change notification settings - Fork 1
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
DNM: feat: support metrics log stream #28
base: main
Are you sure you want to change the base?
Conversation
@computed_field | ||
@property | ||
def aws_cloudwatch_metrics_log_group(self) -> str: | ||
return ( | ||
f"/aws/greengrass/edge/{self.region}/" | ||
f"{self.account_id}/{self.profile}-edge-otaclient-metrics" | ||
) | ||
|
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.
new log group name for metrics
from queue import Queue | ||
from typing import Literal, TypedDict | ||
|
||
from typing_extensions import NotRequired, TypeAlias | ||
|
||
LogsQueue: TypeAlias = "Queue[tuple[str, LogMessage]]" | ||
LogsQueue: TypeAlias = "Queue[tuple[LogGroupType, str, LogMessage]]" |
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.
change the data format of the queue.
@@ -76,10 +76,13 @@ def generate_random_msgs( | |||
) -> list[tuple[str, LogMessage]]: | |||
_res: list[tuple[str, LogMessage]] = [] | |||
for _ in range(msg_num): | |||
_ecu, *_ = random.sample(ecus_list, 1) | |||
_ecu_id, *_ = random.sample(ecus_list, 1) | |||
_log_group_type = random.choice(list(LogGroupType)) |
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.
test both log group type.
This PR should be merged after #27.
Why
https://tier4.atlassian.net/browse/RT4-13461
This PR support a new log group for metrics.
The reason why we switch the log group is that AWS subscription filter apply its filter based on the target log group level. Thus, by dividing log group, cloudwatch can apply the filter efficiently.
The log group name for metrics will be
/aws/greengrass/edge/{self.region}/{self.account_id}/{self.profile}-edge-otaclient-metrics
, log stream name will be same as the existing log stream name.What
Change the existing data format in the queue and add
LogGroupType
field.Once logging thread receives the log group type, handle the target log group based on it.
Test
Verified that the modified pytests are passed.