# Celery Transaction not stored in the correct service

**URL:** <https://discuss.elastic.co/t/celery-transaction-not-stored-in-the-correct-service/282207>\
**Category:** APM\
**Tags:** python\
**Created:** [August 23, 2021, 9:48am UTC](https://discuss.elastic.co/t/celery-transaction-not-stored-in-the-correct-service/282207 "2021-08-23T09:48:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![francois.tarlier](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@francois.tarlier](https://discuss.elastic.co/u/francois.tarlier)\
**Post date:** [August 23, 2021, 9:48am UTC](https://discuss.elastic.co/t/celery-transaction-not-stored-in-the-correct-service/282207/1 "2021-08-23T09:48:05Z")

</div>

Hi,

We are monitoring several celery services using the elasticapm python agent like follow :

```python
import elasticapm
from elasticapm import Client, instrument, events
from elasticapm.contrib.celery import register_exception_tracking, register_instrumentation
instrument()
apm_client = Client(service_name=app_name)
register_instrumentation(apm_client)
register_exception_tracking(apm_client)

```

we ONLY do celery automatic instrumentation, no custom code monitoring.

For some unknow reasons, some transactions are not stored under the correct service name.  
Lets assume we have ServiceA, ServiceB, ServiceC each reporting celery instrumentations + Metrics via psutils.  
ServiceA, ServiceB and ServiceC are showing up in my services page. But transaction on ServiceA and ServiceB are empty, only metrics are reported. ServiceA is triggered by Celery Beat Schedule every 5 sec. Then ServiceA calls ServiceB via delay().  
Then if I open ServiceC, I can find some of ServiceA, ServiceB transactions, as of some ServiceC.

elasticapm : 5.10.1  
elasticsearch/kibana : 7.9.2

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [August 23, 2021, 1:14pm UTC](https://discuss.elastic.co/t/celery-transaction-not-stored-in-the-correct-service/282207/2 "2021-08-23T13:14:16Z")

</div>

Hi @francois.tarlier

that sounds weird. Can you tell me a bit about the different services and how they are deployed? Are they all running in different processes? And do they share the same code base or are they completely different (the fact that you use `delay` to call ServiceB from ServiceA indicates that they share the same code base)? And can you confirm via e.g. logging that the actual tasks run in the services that you expect them to be running in?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 13, 2021, 9:15am UTC](https://discuss.elastic.co/t/celery-transaction-not-stored-in-the-correct-service/282207/3 "2021-09-13T09:15:15Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
