What are the criteria for transaction&span?

Kibana version: 7.5.2

Elasticsearch version: 7.5.2

APM Server version: 7.5.2

APM Agent language and version: java agent 1.12

  1. I know that one transaction is generated for every http request.
    So how is a transaction created with batch processing without external requests?
    Should I use a public API?
    Or is there a way to collect them automatically in this case?

  2. What are the criteria for span?
    My app consists of spring, and when a user request comes in, it proceeds in the order of controller-> service-> query-> service-> query-> view rendering.
    Three spans are generated in this process. 2 queries, 1 view rendering.
    What are the criteria for dividing the span?

Hi @Yungyoung_Ok,

  1. For batch processing, we don't have any plugin that supports that out-of-the-box yet, thus you have to use agent API to manually wrap your batch execution in a transaction. Do you use any batch framework (like spring- batch) or is it a plain java program where everything is in a main method ?

  2. For spans and transactions, there are two ways to define their boundaries:

  • if there is a relevant plugin in agent to auto-instrument a known framework or API like JDBC, agent will automatically create transactions & spans for them
  • if agent API is called explicitly from application code, for example to cover the use-case you mentioned above with batches.

How can I tell what range I am measuring automatically?
For example, in the case of spring framework, the service component is not measured in span, only view rendering is measured in span. What is the difference?

Transactions and spans created automatically by the agent are defined by agent plugins, and you can have a good overview of what is being monitored by looking at the list of supported technologies.

In your case view rendering using Spring MVC is something that we instrument out-of-the box, which explains why this part is being monitored as a separate span.

In the agent code, support for all those are provided using plugins, and are embedded in the agent binary. For things that aren't supported out of the box, there are a few alternatives:

  • create a new plugin for it, all pull-requests are welcome.
  • create an ad-hoc instrumentation using agent API directly within your application.

I have seen the supported technologies documentation already.
In this document, we found the creation criteria of'transaction', but we could not find the creation criteria of 'span'.
If 'span of Spring MVC' is automatically measured by the agent, is there a document on that list or criteria?
If I don't use the public API, I want to know exactly the scope and criteria of how much is collected.