Elastic APM agent not pushing data to APM server from docker but pushing data outside of docker

Rishav_Kr
Fri, 15 Sep 2023 07:18:16 +0000
APM

APM Agent language and version: 6.18.0 with Python (FastAPI)

Issue :
When executing the APM agent with Python (FastAPI) outside docker I am able to view the API transactions in Kibana, however, when I run the FastAPI server from docker, I can't see the transactions in Kibana.

Network checks:
From inside the docker, I have checked using telnet and APM server is accessible. Telnet connected to port 8200, 5044. If I disable the VPN I can see error log stating server url is not accessible, where as with VPN there is no error log wrt to connecting to APM server.
From outside docker, things are working as expected.

Logs :
Agent has status code 202 in logs. Transaction ID is null from the instance inside docker and not from outside docker.
I am unable to figure out why transaction_id, trace_id is null?

(Inside docker) :
{"elasticapm_transaction_id": null, "elasticapm_trace_id": null, "elasticapm_span_id": null, "elasticapm_service_name": "Samiksha", "elasticapm_service_environment": "test", "elasticapm_labels": {"transaction.id": null, "trace.id": null, "span.id": null, "service.name": "Samiksha", "service.environment": "test"}

{"@timestamp":"2023-09-15T06:07:58.112Z","log.level":"debug","message":"Sent request, url=http://xxxxxx:8200/intake/v2/events size=0.48kb **status=202**","ecs":{"version":"1.6.0"},"log":{"logger":"elasticapm.transport.http","origin":{"file":{"line":96,"name":"http.py"},"function":"send"},"original":"Sent request, url=http://xxxxxx:8200/intake/v2/events size=0.48kb status=202"},"process":{"name":"MainProcess","pid":36578,"thread":{"id":140317223352064,"name":"eapm event processor thread"}},"service":{"environment":"test","name":"Samiksha"}}

(Outside docker) :
{"elasticapm_transaction_id": "a8156e7df65e0100", "elasticapm_trace_id": "0a11c5db87c1314ced4ade9862b24f37", "elasticapm_span_id": null, "elasticapm_service_name": "Samiksha", "elasticapm_service_environment": "test", "elasticapm_labels": {"transaction.id": "a8156e7df65e0100", "trace.id": "0a11c5db87c1314ced4ade9862b24f37", "span.id": null, "service.name": "Samiksha", "service.environment": "test"}

6 posts - 3 participants