Skip to content
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

[Step Function][DRAFT] Set up logging #143

Draft
wants to merge 1 commit into
base: yiming.luo/step-function
Choose a base branch
from

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Jan 3, 2025

What does this PR do?

Enables setting up logging for a given state machine:

  1. Set log level to ALL
  2. Set includeExecutionData to true
  3. Set destination log group (if not set already)
  4. Add permissions to the state machine role to log to CloudWatch Logs

Motivation

This is the first step of instrumenting a step function.

Testing Guidelines

Automated Testing

Passed the added tests.

Manual Testing

Steps
  1. Run aws-vault exec sso-serverless-sandbox-account-admin -- tools/create_test_stack.sh to deploy the macro to sandbox
  2. Deploy my SAM app, which includes a State Machine and uses DatadogServerless transform
Result
  1. Both deployments are successful
  2. The state machine has:
    1. log level: ALL
    2. include execution data: true
    3. log group set up
image
  1. The state machine can execute successfully

Additional Notes

Sorry for making this PR so large, but partially set up logging can cause deployment failures in manual test. For example, if log level is ALL and log group is not set, then deployment will fail. Please let me know if any code is not clear to you.

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog


export interface LoggingConfiguration {
Destinations?: LogDestination[];
IncludeExecutionData?: boolean;

Choose a reason for hiding this comment

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

Code Quality Violation

Prop name (IncludeExecutionData) doesn't match rule (is|has) (...read more)

Enforces a consistent naming pattern for boolean props.

The pattern is: "^(is|has)[A-Z]([A-Za-z0-9]?)+" to enforce is and has prefixes.

View in Datadog  Leave us feedback  Documentation


export interface StateMachineProperties {
LoggingConfiguration?: LoggingConfiguration;
RoleArn?: string | { [key: string]: any };

Choose a reason for hiding this comment

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

Code Quality Violation

Unexpected any. Specify a different type. (...read more)

Do not use the any type, as it is too broad and can lead to unexpected behavior.

View in Datadog  Leave us feedback  Documentation


// Same interface as Configuration above, except all parameters are optional, since user does
// not have to provide the values (in which case we will use the default configuration below).
interface CfnParams extends Partial<Configuration> {}

Choose a reason for hiding this comment

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

Code Quality Violation

An empty interface is equivalent to `{}`. (...read more)

Do not use empty interfaces.

View in Datadog  Leave us feedback  Documentation

@lym953 lym953 force-pushed the yiming.luo/step-function-3 branch from c9fcce4 to c1df317 Compare January 3, 2025 21:57
Base automatically changed from yiming.luo/step-function-3 to yiming.luo/step-function January 3, 2025 22:00
@lym953 lym953 mentioned this pull request Jan 3, 2025
10 tasks
@lym953 lym953 force-pushed the yiming.luo/step-function-4 branch from 955f3a6 to a54a52c Compare January 6, 2025 18:54
@lym953 lym953 changed the title [Step Function] 1. Set up logging [Step Function][DRAFT] Set up logging Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant