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

feat(lambda): add tracingConfig property to a Function #32320

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ren-yamanashi
Copy link
Contributor

@ren-yamanashi ren-yamanashi commented Nov 28, 2024

Reason for this change

We can set a tracingConfig for an Function(Lambda) from cloudformation, but this was not supported in the AWS CDK L2 construct.

Description of changes

Add tracingConfig property to FunctionProps and set it in the CfnFunction.

Description of how you validated changes

Added both unit and integration tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label Nov 28, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team November 28, 2024 14:44
@github-actions github-actions bot added the p2 label Nov 28, 2024
@ren-yamanashi ren-yamanashi changed the title feat(lambda): add availabilityZoneDistribution property to an AutoScalingGroup feat(lambda): add tracingConfig property to a Function Nov 28, 2024
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-tracingconfig.html#cfn-lambda-function-tracingconfig-mode
*/
readonly tracingConfig?: TracingConfig;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tracingConfig property of L1 Construct has the following type

  export interface TracingConfigProperty {
    readonly mode?: string;
  }

public tracingConfig?: cdk.IResolvable | CfnFunction.TracingConfigProperty;

However, the type of the mode property of this CfnFunction.TracingConfigProperty is not strict, so L2 Construct does not use CfnFunction.TracingConfigProperty.

Instead, I have a more strict type (a type that uses enum for the mode property) and specify it.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: d1db0ee
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@ren-yamanashi
Copy link
Contributor Author

ren-yamanashi commented Dec 2, 2024

     [2024-12-02T23:56:35.036] [ERROR] jsii/compiler - Type model errors prevented the JSII assembly from being created
      warning JSII6: A "peerDependency" on "constructs" at "^10.0.0" means you should take a "devDependency" on "constructs" at "10.0.0" (found "^10.0.0")
      aws-apigateway/lib/domain-name.ts:132:19 - warning JSII5019: The property name "domainName" conflicts with the declaring class "DomainName". This will result in renaming the class to "_DomainName" in C#. Consider renaming "domainName".
      
      132   public readonly domainName: string;
                            ~~~~~~~~~~
      
        aws-apigateway/lib/domain-name.ts:117:14
          117 export class DomainName extends Resource implements IDomainName {
                           ~~~~~~~~~~
          The declaring class is introduced here
      aws-apigateway/lib/gateway-response.ts:217:19 - warning JSII5019: The property name "responseType" conflicts with the declaring class "ResponseType". This will result in renaming the class to "_ResponseType" in C#. Consider renaming "responseType".

I don't think this is an error caused by the code I added, but it doesn't seem to happen on the main branch... 🤔

(Error when running build after making changes to packages/aws-cdk-lib/aws-lambda/lib/function.ts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants