Skip to content

Pattern submission: lambda-cloudwatch-otlp-metrics-sam #3299

Description

@manishh-13

Pattern name: lambda-cloudwatch-otlp-metrics-sam

Pull request: #3298

Description:

Send custom Lambda metrics to Amazon CloudWatch over OTLP. The function records a counter and a histogram using only the OpenTelemetry metrics API, and the AWS Distro for OpenTelemetry Lambda layer runs a collector that signs each request with SigV4 and forwards it to the CloudWatch OTLP endpoint. The function makes no PutMetricData calls and writes no embedded metric format logs, and the only permission it needs is cloudwatch:PutMetricData.

Compared with embedded metric format there is no per series charge, and the endpoint accepts up to 150 labels per metric against the 30 dimensions allowed by PutMetricData, so high cardinality metrics are much cheaper and richer.

Services used: AWS Lambda, Amazon CloudWatch (OTLP metrics endpoint), AWS Distro for OpenTelemetry Lambda layer.

Language: Python 3.13
Framework: AWS SAM
Level: 300

Tested end to end in a live account: deployed, invoked, confirmed the collector exported without errors, and queried the CloudWatch PromQL endpoint to verify the data points arrived with the expected value and labels. The stack was then deleted.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions