Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] Step Functions: Telemetry#12581

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
MEPalma wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromMEP-SFN-mock_config_env_var_in_presence

Conversation

MEPalma
Copy link
Contributor

@MEPalmaMEPalma commentedMay 5, 2025
edited
Loading

Motivation

The mocked service integrations feature for Step Functions testing was recently introduced, but no telemetry was added to track its usage. These changes address that gap by recording usage of the associated environment variable,SFN_MOCK_CONFIG, without capturing the file path it points to.
Moreover, these changes introduce a new analytics usage counter to capture the number of executions by type. For now, this includes theis_mock_test_case execution type, which counts whether an execution is initiated as part of a mocked service integrations test case. This counter may be extended to later include additional labels to distinguish between standard and express executions.

Changes

  • addedSFN_MOCK_CONFIG to analytics'PRESENCE_ENV_VAR list
  • added newexecution_type_counter usage counter
  • added counting ofis_mock_test_case uponstart_execution calls

@MEPalmaMEPalma added this to the4.4 milestoneMay 5, 2025
@MEPalmaMEPalma requested a review fromjoe4devMay 5, 2025 15:02
@MEPalmaMEPalma self-assigned thisMay 5, 2025
@MEPalmaMEPalma added the semver: minorNon-breaking changes which can be included in minor releases, but not in patch releases labelMay 5, 2025
@github-actionsGitHub Actions
Copy link

github-actionsbot commentedMay 5, 2025
edited
Loading

S3 Image Test Results (AMD64 / ARM64)

  2 files  ±0    2 suites  ±0   8m 39s ⏱️ -17s
488 tests ±0  438 ✅ ±0   50 💤 ±0  0 ❌ ±0 
976 runs  ±0  876 ✅ ±0  100 💤 ±0  0 ❌ ±0 

Results for commita50fcba. ± Comparison against base commit9b55514.

♻️ This comment has been updated with latest results.

@MEPalmaMEPalma changed the titleStep Functions: Add Telemetry for SFN_MOCK_CONFIG UsageStep Functions: Add Telemetry for Mocked IntegrationsMay 5, 2025
@github-actionsGitHub Actions
Copy link

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 42m 27s ⏱️ +44s
4 399 tests ±0  4 037 ✅ ±0  362 💤 ±0  0 ❌ ±0 
4 401 runs  ±0  4 037 ✅ ±0  364 💤 ±0  0 ❌ ±0 

Results for commita50fcba. ± Comparison against base commit9b55514.

@MEPalmaMEPalma marked this pull request as ready for reviewMay 5, 2025 17:40
Copy link
Member

@joe4devjoe4dev left a comment

Choose a reason for hiding this comment

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

I added some questions and discussion items regarding the optimal place of instrumentation and the trade-off regarding feature/parameter vs. operation tracking.

@@ -6,6 +6,7 @@
import time
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think the new standard name isanalytics.py (following the Notion guide and samples in API Gateway, Lambda, etc)

@@ -789,6 +790,10 @@ def start_execution(
state_machine_arn_parts[1] if len(state_machine_arn_parts) == 2 else None
)

# Count metrics about the execution type.
is_mock_test_case: bool = mock_test_case_name is not None
UsageMetrics.execution_type_counter.labels(is_mock_test_case=is_mock_test_case).increment()
Copy link
Member

Choose a reason for hiding this comment

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

question: Is this the right place to increment the counter given we could raise multiple exceptions following this counter (e.g.,_raise_state_machine_does_not_exist orInvalidExecutionInput)?


# Initialize a counter to record the use of each execution type.
execution_type_counter = Counter(
namespace="stepfunctions", name="execution_type", labels=["is_mock_test_case"]
Copy link
Member

Choose a reason for hiding this comment

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

naming: Isn'texecution sufficient because the_type sounds like an aspect that a label should cover. See "Metric & Label Best Practices" in Notion.

Copy link
Member

Choose a reason for hiding this comment

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

suggestion/idea: Following the Lambda example inlocalstack-core/localstack/services/lambda_/analytics.py:function_counter, what about the following focusing on the main operation(s) rather than having feature-specific counters (e.g., JSONata, is_mock_test_case, workflow_type, invocation_type, ...):

execution_counter=Counter(namespace="stepfunctions"name="execution",labels=["is_mock_test_case","workflow_type",# standard | express"invocation_type",# async | sync    ],)

Is it worthwhile (i.e., can we derive something actionable) from capturing more metadata linked to executions?
In Lambda, we even use anoperation field to capture create and invoke activities separately. Feel free to weigh in on what's the best model for StepFunctions here.

sidenote: The dimensionstatus might be interesting to learn about unexpected/unhandled errors (i.e., try/catch), the more metadata we collect about executions. However, if all executions happen through the API, unhandled exceptions should be tracked generically by our ASF-based telemetry (including actionable stack traces in DEBUG mode).

Copy link
Member

Choose a reason for hiding this comment

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

What is your recommendation/guidance from the data side@vittoriopolverino, especially regarding the trade-off: counters for features/parameters (e.g., JSONata, is_mock_test_case, workflow_type, invocation_type) vs. for operations (e.g., execute, create) with features as labels?

@@ -789,6 +790,10 @@ def start_execution(
state_machine_arn_parts[1] if len(state_machine_arn_parts) == 2 else None
)

# Count metrics about the execution type.
is_mock_test_case: bool = mock_test_case_name is not None
UsageMetrics.execution_type_counter.labels(is_mock_test_case=is_mock_test_case).increment()
Copy link
Member

Choose a reason for hiding this comment

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

question: Are we missing other entry points, such asstart_sync_execution? Are they worth tracking?

@MEPalmaMEPalma modified the milestones:4.4,PlaygroundMay 6, 2025
@MEPalma
Copy link
ContributorAuthor

Thanks@joe4dev for sharing your thoughts!
The objective here was to quickly introduce a basic mechanism to track usage of this new feature in time for the upcoming release. Hence, optimality of this solution was not a goal and aimed to minimize changes ahead of the release. That said, I agree that implementing a more robust and optimal tracking strategy is worth exploring whilst introducing a new counter.
For now, I’m opening a separate PR that only tracks the use of the environment variable, and I’ll continue the broader discussion in this thread.

joe4dev reacted with thumbs up emoji

@MEPalmaMEPalma marked this pull request as draftMay 6, 2025 09:34
@MEPalmaMEPalma changed the titleStep Functions: Add Telemetry for Mocked Integrations[WIP] Step Functions: TelemetryMay 6, 2025
@MEPalma
Copy link
ContributorAuthor

#12584

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@joe4devjoe4devjoe4dev left review comments

@gregfurmangregfurmanAwaiting requested review from gregfurmangregfurman will be requested when the pull request is marked ready for reviewgregfurman is a code owner

@thrauthrauAwaiting requested review from thrauthrau will be requested when the pull request is marked ready for reviewthrau is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

@MEPalmaMEPalma

Labels
semver: minorNon-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Milestone
Playground
Development

Successfully merging this pull request may close these issues.

2 participants
@MEPalma@joe4dev

[8]ページ先頭

©2009-2025 Movatter.jp