8000 logs: fix `put_metric_data` client for multi-account/region (#11691) · localstack/localstack@6679ec9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6679ec9

Browse files
logs: fix put_metric_data client for multi-account/region (#11691)
1 parent 32e05ec commit 6679ec9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

localstack-core/localstack/services/logs/provider.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ def put_log_events(
8181
value = float(value) if is_number(value) else 1
8282
data = [{"MetricName": tf["metricName"], "Value": value}]
8383
try:
84-
self.cw_client.put_metric_data(
85-
Namespace=tf["metricNamespace"], MetricData=data
86-
)
84+
client = connect_to(
85+
aws_access_key_id=context.account_id, region_name=context.region
86+
).cloudwatch
87+
client.put_metric_data(Namespace=tf["metricNamespace"], MetricData=data)
8788
except Exception as e:
8889
LOG.info(
8990
"Unable to put metric data for matching CloudWatch log events", e

0 commit comments

Comments
 (0)
0