DSM Queue tab CloudWatch metrics empty: eventSourceARN used as queue identifier instead of short name
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- aws, python
- Ambito
- cloud, observability-sre
Direzione di ricerca
Inizia in datadog_lambda/tracing.py, in _dsm_set_checkpoint(), poi confronta la gestione dei nomi delle code in ddtrace/internal/datastreams/botocore.py, in particolare get_queue_name() e i chiamanti dei checkpoint SQS. Il lavoro è completato quando i checkpoint Lambda DSM usano il formato dell’identificatore della coda previsto dall’integrazione CloudWatch, in modo che le query della scheda Queue corrispondano ai tag delle metriche SQS.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
The DSM (Data Streams Monitoring) Queue tab shows empty CloudWatch metric graphs for SQS queues consumed by Lambda functions. The root cause is a mismatch between how datadog-lambda-python identifies queues in DSM checkpoints vs how the AWS CloudWatch integration tags SQS metrics.
Root Cause
In datadog_lambda/tracing.py, _dsm_set_checkpoint() passes the full eventSourceARN to set_consume_checkpoint():
# tracing.py line ~262
source_arn = first_record.get("eventSourceARN", "")
# ...
_dsm_set_checkpoint(context_json, event_type, source_arn) # full ARN
This results in a DSM checkpoint with:
topic:arn:aws:sqs:eu-west-2:123456789012:my-queue.fifo
The DSM Queue tab then uses this full ARN value to construct CloudWatch metric queries:
sum:aws.sqs.number_of_messages_received{queuename:arn:aws:sqs:eu-west-2:123456789012:my-queue.fifo}
But the AWS CloudWatch integration tags SQS metrics with just the short queue name (from the CloudWatch QueueName dimension):
queuename:my-queue.fifo
Result: the query returns no data, and all Queue tab graphs are empty.
Comparison with botocore SDK path
The botocore instrumentation in dd-trace-py correctly extracts the short name:
# ddtrace/internal/datastreams/botocore.py
def get_queue_name(params):
queue_url = params["QueueUrl"]
url = parse.urlparse(queue_url)
return url.path.rsplit("/", 1)[-1] # returns "my-queue.fifo"
Both handle_sqs_sns_produce() and handle_sqs_receive() use this short name as the DSM topic: tag. When SQS messages are consumed by a long-running process polling with sqs.receive_message(), the botocore instrumentation handles the DSM checkpoint and the Queue tab works correctly. The bug is specific to Lambda functions triggered by SQS event source mappings, where datadog-lambda-python handles the checkpoint instead.
Expected Behavior
_dsm_set_checkpoint() should extract the short queue name from the ARN before passing it to set_consume_checkpoint(), e.g.:
queue_name = source_arn.rsplit(":", 1)[-1] # "my-queue.fifo"
set_consume_checkpoint(event_type, queue_name, carrier_get, manual_checkpoint=False)
This would align the Lambda consumption path with the botocore SDK path, and the DSM Queue tab CloudWatch queries would match the actual queuename tag values.
Workaround
Users can manually change the metric filter from queuename to dd_resource_key (which contains the full ARN) to see data. But this must be done for each graph individually and doesn't persist.
Environment
datadog-lambdav8.123.0dd-trace-pyv4.6.0- Lambda Extension v92-next
- Python 3.14
- SQS FIFO queue consumed via Lambda event source mapping
- AWS region: eu-west-2
- Lingua principale
- Python
- Stelle
- 102
- Fork
- 52
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DataDog/datadog-lambda-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DataDog/datadog-lambda-python#758 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
DataDog/datadog-lambda-python#688 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
DataDog/datadog-lambda-python#682 · 1 commento ·
-
Migrate from ujson to orjson Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
DataDog/datadog-lambda-python#666 · 1 reazione ·
-
DataDog/datadog-lambda-python#633 · 2 commenti · 1 assegnatario ·
Tutte le issue di DataDog/datadog-lambda-python
Issue simili
-
Add: hunch Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DiamondLightSource/dodal#2211 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openml/openml-python#1749 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sipyourdrink-ltd/bernstein#6191 ·