Skip to content

CFn telemetry: capture actions on resources #12798

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

Merged
merged 3 commits into from
Jul 1, 2025
Merged

CFn telemetry: capture actions on resources #12798

merged 3 commits into from
Jul 1, 2025

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented Jun 25, 2025

Motivation

We want to know which operations are being used with our resources. This change means that we capture the operation/action the user is performing on the resource. We want to see which resources are most common to be updated.

Changes

When we load a resource provider, we capture which operation we are applying to that resource provider.

Note: for v1 and v2 we have to handle the case of both str and ChangeAction. This can be simplified when we remove the v1, HOWEVER we must not change the names of the event actions from create, update and delete or else we won't be able to map metrics captured from different times.

@simonrw simonrw added the semver: patch Non-breaking changes which can be included in patch releases label Jun 25, 2025
Copy link

github-actions bot commented Jun 25, 2025

Test Results - Preflight, Unit

21 795 tests  ±0   20 138 ✅ ±0   6m 22s ⏱️ -6s
     1 suites ±0    1 657 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit b7308e1. ± Comparison against base commit a6ec498.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 25, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 20s ⏱️ +11s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit b7308e1. ± Comparison against base commit a6ec498.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 25, 2025

Test Results (amd64) - Integration, Bootstrap

  5 files    5 suites   34m 20s ⏱️
911 tests 348 ✅ 563 💤 0 ❌
917 runs  348 ✅ 569 💤 0 ❌

Results for commit b7308e1.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 25, 2025

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   23m 12s ⏱️ - 1h 23m 6s
887 tests  - 4 019  323 ✅  - 3 807  564 💤  - 212  0 ❌ ±0 
889 runs   - 4 019  323 ✅  - 3 807  566 💤  - 212  0 ❌ ±0 

Results for commit b7308e1. ± Comparison against base commit a6ec498.

This pull request removes 4019 tests.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…

♻️ This comment has been updated with latest results.

@simonrw simonrw marked this pull request as ready for review June 26, 2025 03:10
Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

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

Thanks a lot for improving the resource provider usage analytics. This will help us a lot in prioritizing work on the resource providers 👏

@@ -559,7 +560,7 @@ def execute_action(
raise NotImplementedError(change_type) # TODO: change error type

@staticmethod
def try_load_resource_provider(resource_type: str) -> ResourceProvider | None:
def try_load_resource_provider(action: str, resource_type: str) -> ResourceProvider | None:
Copy link
Member

Choose a reason for hiding this comment

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

nit (but mostly just a comment): I get the intent but it does feel a bit weird passing it in here like this just for analytics purposes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that when I wrote it. I might have a think about how to reorganise this information. I wonder if I can capture the same intent from the caller scope (where the action is available).

from localstack.utils.analytics.metrics import LabeledCounter

COUNTER_NAMESPACE = "cloudformation"
COUNTER_VERSION = 2
Copy link
Member

Choose a reason for hiding this comment

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

nice, already coming in useful here!

@simonrw simonrw added this to the 4.6 milestone Jun 30, 2025
simonrw added 2 commits June 30, 2025 17:07
We want to know which operations are being used with our resources. This
change means that we capture the operation/action the user is performing
on the resource. We want to see which resources are most common to be
updated.
@simonrw simonrw merged commit 6a0e8ee into master Jul 1, 2025
39 checks passed
@simonrw simonrw deleted the cfn/analytics branch July 1, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants