How to trace non web transactions

Hi
We are using ELK 6.8.4 and APM 6.8.1.
We are able to monitor API based applications using APM but we have a requirement of monitoring Non-API applications (batch jobs) using APM. We couldnt find any way to do it.
Can you please guide us on monitoring Non-API applications.

Thanks,
Sheetal

The simplest way would be to use the Public APi Annotations
https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html (https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-annotation)

Simply annotated your entry method with @Transaction and don't forget to set the application_packages config option.

Thanks for the reply.
Even if i add annotations or write code to begin and end transcation, I still have to send logs to APM server. I have simple "hello_world" program which in python script. Can you suggest me how can i send the logs of this script (without Flask server) to APM because I do not have any option on send logs to APM Server.

Regards,
Sheetal

APM does not collect logs of an application, it only collects performance data (to my knowledge).
For logging you would use a standard logging into a file and read this file with filebeat or do direct insertation of the logs into elasticsearch with the api and the provided client in your programming language.

@SheetalRIL for Python, you need to do 4 steps manually in your Python script

  • Activate instrumentation
import elasticapm
elasticapm.instrument()
  • instantiate the client
client = elasticapm.Client(service_name="foo", server_url="https://example.com:8200")
  • begin a transaction before executing your main logic
client.begin_transaction(transaction_type="script")
  • end the transaction, giving it a name and a result (using __name__ here as name will give it the name of the python module)
client.end_transaction(name=__name__, result="success")

You don't need to manually send the data, as the agent will do that automatically when the Python interpreter exits.

Thanks a lot :slight_smile: It worked.

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