8000 Step Functions: Migrate Usage Metrics to New Counter Standards by MEPalma · Pull Request #12389 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Step Functions: Migrate Usage Metrics to New Counter Standards #12389

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 4 commits into from
Mar 18, 2025

Conversation

MEPalma
Copy link
Contributor
@MEPalma MEPalma commented Mar 13, 2025

Motivation

This PR migrates our step functions usage metrics to the new Counter standards. It increases transparency by accurately reflecting the query language usage within each state machine. Previously, JSONata was always counted as used—even when combined with JSONPath. Since interleaved usage of both modes is critical for testing the shared memory model and understanding user reliance on this mechanism, the updated metrics now provide a clearer picture.

Changes

  • Migrated step functions usage metrics to the new Counter standards
  • Consolidated tracking of language features into a single Counter per state machine on creation
  • Updated query language detection logic to differentiate between exclusive and interleaved usage of JSONPath and JSONata

@MEPalma MEPalma added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Mar 13, 2025
@MEPalma MEPalma added this to the 4.3 milestone Mar 13, 2025
@MEPalma MEPalma self-assigned this Mar 13, 2025
Copy link
github-actions bot commented Mar 13, 2025

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   32m 8s ⏱️ - 1h 19m 53s
1 453 tests  - 2 835  1 380 ✅  - 2 588  73 💤  - 247  0 ❌ ±0 
1 455 runs   - 2 835  1 380 ✅  - 2 588  75 💤  - 247  0 ❌ ±0 

Results for commit 27aace5. ± Comparison against base commit c3bf23a.

This pull request removes 2836 and adds 1 tests. Note that renamed tests count towards both.
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]
…
tests.aws.services.apigateway.test_apigateway_common.TestApiGatewayCommon ‑ test_input_path_template_formatting

♻️ This comment has been updated with latest results.

error_counter = UsageCounter("stepfunctions:error")
# Initialize a counter to record the usage of language features for each state machine.
language_features_counter = Counter(
namespace="stepfunctions", name="language_features_used", labels=["query_language", "variables"]
Copy link
Member
@vittoriopolverino vittoriopolverino Mar 13, 2025

Choose a reason for hiding this comment

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

not-blocking: for the label variables, we might consider naming it are_variables_used or uses_variables, which makes the intent even clearer. What do you think?

@vittoriopolverino
Copy link
Member
vittoriopolverino commented Mar 13, 2025

Could you please provide some guidance on how to trigger these StepFunctions "functions" 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

Copy link
Member
@vittoriopolverino vittoriopolverino left a comment

Choose a reason for hiding this comment

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

LGTM! 👍 I'm happy to see that you’ve condensed the three events into a single one, that was exactly one of the goal of the counter refactoring 🚀

@MEPalma MEPalma merged commit b6c4b8a into master Mar 18, 2025
31 checks passed
@MEPalma MEPalma deleted the MEP-SFN-metrics_migration branch March 18, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0