Can we have different apm service name for subset of microservices

Hey hi,

Can we create a new APM service from a subset of APIs which represent a common business logic, as check logs in one big APM service doesn't make sense

Service 1 has multiple child services. Services 5 to 10 are a subset of service_1 which service_1 uses anytime. Can we have separate APM service_name for Service 1 and Services 5 to 10.? So a team can view only their own transactions and not get lost in distributed tracings spans.

Welcome, @NikeshN!

I think your best bet may be to set labels for different parts of your app using elasticapm.label() -- then, you can filter by them in the UI. But they still won't show up as separate services, unfortunately.

1 Like

how about using custom instrumentation code in python decorator. I tried but errors are not getting captured in APM dashboard by capture_exception, requests are shown as transactions but errors are not captured. I followed this blog, tweaked a bit little for flask.

In v5.10.0 we introduced the ability to replace the global excepthook with an Elastic handler. If you set USE_ELASTIC_EXCEPTHOOK=True you can enable this feature and that should help plug some of the holes in your exception reporting.

Note that if a framework catches uncaught exceptions automatically, this feature may not solve your problem. In that case you need to hook into the framework's exception handling and capture_exception there.

1 Like

okay, I think I have a newer problem on my side, so we have log handlers and use filebeat to send logs, which works perfectly fine. Now, after adding elastic APM agent, all requests which have 200 stat are shown as errors.

we are using pythonjsonlogger package.

That sounds very odd. Anything in the application/agent logs?

You might also consider checking out ecs-logging-python which provides ECS-compliant formatters for easy ingestion via Filebeat, including log correlation with APM traces.