-
Notifications
You must be signed in to change notification settings - Fork 289
Open
Labels
Description
Description
The current Instance Scheduler stacks do not expose a CloudFormation parameter to control AWS X-Ray tracing for the solution’s Lambda functions. As a result, tracing behavior is fixed and cannot be adjusted by customers via stack parameters. There is a non-trivial ongoing cost associated with X-Ray, and customers should be able to choose whether to enable it.
Per AWS CloudFormation, Lambda X-Ray tracing is controlled via:
https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-function-tracingconfig.html
The solution should allow configuration of tracing and default to PassThrough (disabled) to avoid unexpected cost for users who do not require X-Ray.
Impact
- Cost control: X-Ray adds per-trace sampling, storage, and retrieval costs. Defaulting to
PassThroughavoids unintended charges. - Operational flexibility: Some environments prohibit tracing or require explicit opt-in.
- Consistency: Aligns with best practices to disable optional observability features by default and allow opt-in via parameters.
Expected Behavior
- All Lambda functions in the Instance Scheduler solution respect a new CloudFormation parameter (e.g.,
EnableXRayTracing) to toggle tracing. - When the parameter is disabled (default), all Lambda
TracingConfig.Modevalues are set toPassThrough. - When enabled, all Lambda
TracingConfig.Modevalues are set toActive.
Actual Behavior
- No CloudFormation parameter exists to control X-Ray tracing.
- Tracing configuration cannot be easily changed post-deployment without template edits.
Proposal
Add parameter to control X-ray tracing
Parameters:
EnableXRayTracing:
Type: String
AllowedValues:
- Enabled
- Disabled
Default: Disabled
Description: >
Controls AWS X-Ray tracing for all solution Lambda functions.
Set to Enabled to use TracingConfig.Mode=Active. Disabled uses PassThrough.and apply to Lambda function resource
Mappings:
XRayTracingModeMap:
Enabled:
Mode: Active
Disabled:
Mode: PassThrough
Resources:
SchedulerFunction:
Type: AWS::Lambda::Function
Properties:
# ... existing properties ...
TracingConfig:
Mode: !FindInMap [ XRayTracingModeMap, !Ref EnableXRayTracing, Mode ]