Set template name for elastic_otel

Kibana version: 8.15.0

Elasticsearch version: 8.15.0

APM Server version: 8.15.0

APM Agent language and version: Elastic-otel-Java agent ; jar file , Release 1.0.0

Original install method (e.g. download page, yum, deb, from source, etc.) and version: elastic-otel-agentextension/1.0.0

Fresh install or upgraded from other version? : Elastic_otel is Fresh Install, but we have elastic APM for a while that we are running without issues.

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc. : NO

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
In elastic APM we had these public API of the Elastic APM Java agent to manually set the Transactions and spans. And allowing us to set transaction name.

Docvument for reference: Public API | APM Java Agent Reference [1.x] | Elastic

Is there any similar document that we can follow to set template name for the elastic_OTEL java agent?

Another question: Is there a way to group all the transaction URL's into the controller's (Such as Documentcontroller, serverstatusController etc) instead of them showing as individual URL's in the transactions? )

Hi @dbalijapalli0264

Please take a look at transaction_name_groups configuration option.

You can use the OpenTelemetry API for that purpose, e.g.:

Span.current().updateName("foobar")

Another question: Is there a way to group all the transaction URL's into the controller's (Such as Documentcontroller, serverstatusController etc) instead of them showing as individual URL's in the transactions? )

For the classic agent please have a look at the option my colleague sent.
For the OpenTelemetry agent, you will have to manually rename your transactions using the method above.

You could enable Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true, but that will give you only an extra span as child of the transaction corresponding to the controller method, which I think is not exactly what you want.

Thank you Surgey_kleyman and Jonas_kiunz,

Span.current().updateName("foobar")
Could you point me to the exact document that has this example for span.current().updateName("foobar") or documentation? We already have the classic agent and it works, we are trying to experiment the elastic_otel agent now.

For the OpenTelemetry agent, you will have to manually rename your transactions using the method above.
From what you mentioned here, it looks like in opentelemetry, we rename spans and not transactions, (like we did in the classic elastic agent)

example of what we did for the classic agent transaction renaming.
Transaction transaction = ElasticApm.startTransaction();
try {
    transaction.setName("MyController#myAction");
    transaction.setType(Transaction.TYPE_REQUEST);
    // do your thing...
}
refer: https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-tracer-api

In OpenTelemetry, there is no such concept as "transactions" - everything are spans. The Elastic backend will just take the root span and interpret it as transaction.

Regarding more documentation links: The link I provided already contains pointers to plenty of examples, for example this one: