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

Instrument RDK with observability and monitoring #376

Open
mbeacom opened this issue Jan 6, 2023 · 1 comment
Open

Instrument RDK with observability and monitoring #376

mbeacom opened this issue Jan 6, 2023 · 1 comment

Comments

@mbeacom
Copy link
Contributor

mbeacom commented Jan 6, 2023

This can likely be easily achieved (initially) with AWS Powertools and liberal usage of the metrics / tracer / logger modules.

@austindimmer
Copy link

In my use case we want to be able to use AWS Lambda Powertools and this means I need to be able to set TracingConfig and Environment variables. I do not currently see any documented way I can achieve this. I currently copy the deployed CF template and update it to include these properties as follows:

    "Ec2TestRuleLambdaFunction": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "FunctionName": "RDK-Rule-Function-Ec2TestRule",
        "Code": {
          "S3Bucket": {
            "Ref": "SourceBucket"
          },
          "S3Key": "Ec2TestRule/Ec2TestRule.zip"
        },
        "Description": "Function for AWS Config Rule Ec2TestRule",
        "Environment": {
          "Variables": {
            "POWERTOOLS_SERVICE_NAME": "config-rdk-rules",
            "LOG_LEVEL": "Debug",
            "POWERTOOLS_LOGGER_SAMPLE_RATE": "1",
            "POWERTOOLS_LOGGER_LOG_EVENT": "true",
            "POWERTOOLS_METRICS_NAMESPACE": "rdk_config"
          }
        },
        "TracingConfig": {
          "Mode": "Active"
        },
        "Handler": "Ec2TestRule.lambda_handler",
        "MemorySize": "256",
        "Role": "arn:aws:iam::123456789012:role/ConfigRulesCentralizedLambdaRole",
        "Runtime": "python3.9",
        "Timeout": "60",
        "Tags": []
      }
    },

And that configuration does get XRay tracing to work which is very useful.

Interestingly the powertools repo has an open PR to add typing support for config rules
feat(event_sources): add AWS Config Rule event data class #2175 that feature combined with the ability to add the required properties to the centralized lambdas would allow XRay tracing to be setup out of the box.

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

No branches or pull requests

2 participants