aws-samples / aws-samples/serverless-patterns

New pattern submission - lambda-cloudwatch-otlp-metrics-sam

Offen
#3,299 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.8k
Forks
1.1k
Ø Merge
7 T. 14 Std.
Gemergte PRs (30 T.)
6

Beschreibung

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

**Pull request:** https://github.com/aws-samples/serverless-patterns/pull/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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Prüfe zuerst den verlinkten Pull Request #3298 und dessen lambda-cloudwatch-otlp-metrics-sam-Muster. Überprüfe die Python-3.13-Lambda, die AWS-SAM-Konfiguration, die Berechtigungen und die AWS Distro for OpenTelemetry Lambda layer; verifiziere anschließend die dokumentierte End-to-End-Bereitstellung und die CloudWatch PromQL-Ergebnisse. Erledigt bedeutet, dass das Muster vollständig und bereitstellbar ist und seine exportierten Metriken mit den erwarteten Werten und Labels ankommen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, python
Bereich
cloud, observability-sre
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.