Is it possible to configure the Java APM agent to collect metrics but not traces?

We have an edge service that will receive maybe a billion requests per day where it isn't feasible to have much of any transaction sample rate. It is implemented with Spring WebFlux running on Netty which aren't officially supported by APM. The application does, however, use the Micrometer metrics library (which is supported) to define a number of Gauges, Counters, and Timers which we want APM to send them along to Elasticsearch.

My questions are:

  • Can APM be configured to collect and ship metrics but no traces? recording, enabled, and instrument config options do not seem to control this and indeed all seem somewhat similar.

  • Can transaction_sample_rate simply be set to zero? Is the agent still incurring transaction overhead?

We still record overall time and the result for unsampled transactions

  • What will happen with APM in WebFlux & Netty? What are "transactions" in this case?

Hi @bplies

Interesting use case... It will be interesting to see if the APM team chimes in.

Are you looking for just your Micrometer metrics or are you also looking for JVM metrics etc.

I ask because if you are just looking for the micrometer metrics they may be another path besides the APM Agents, though that does seem like a good fit.

Since your framework technologies are not supported yet I don't think you would get much auto instrumentation anyways but you might get the default HTTP capture of transactions.

My first thought if you did not want to capture transactions (and yes even if you don't sample we capture summary transaction which you can interpret as a HTTP POST / PUT / GET etc)

Is just to set to transaction_ignore_urls all the routes so you don't generate / capture any transactions.

If you are JUST looking for your micrometer metrics you could publish them to the prometheus endpoint and then use metricbeat to listen to that and publish to elasticsearch. I would probably not use the micrometer -> elasticsearch direct integration as I think it is may not be up to date but I could be wrong.

So curious what you are looking for...

Are you looking for just your Micrometer metrics or are you also looking for JVM metrics etc

Yes also the standard System/JVM metrics that APM can collect.

I would probably not use the micrometer -> elasticsearch direct integration as I think it is may not be up to date but I could be wrong.

Indeed Micrometer's built-in exporter for Elasticsearch doesn't format the metrics very well.

Good... Cool...

So if you have a test / dev area I would config with the agent first see what you actually collect.

@bplies
If I get a chance I will check instrument... but I think that will shut off the JVM metrics.
UPDATE : Huh looks like instrument = false still sends JVM metrics so that may work!

You will need to test the micrometer see if it still works too.

Back up Choices....

Then I would try the transaction_ignore_urls

I might also try disable-instrumentations that might even be better but can be a bit tricky to identify what to turn off :slight_smile:

Yes indeed. I also tried instrument=false and am receiving the JVM + custom metrics into Elasticsearch. No traces. So this does look like it achieves what we wanted.

Elastic may wish to clarify the description of instrument

A boolean specifying if the agent should instrument the application to collect performance metrics for the app. When set to false, Elastic APM will not affect your application at all.

"... collect performance metrics...for the app" apparently does not mean to exclude metrics from Micrometer.

Very good indeed , I will pass on the documentation comments because it seems it more people are using tools like micrometer and drop wizard.

Thanks for raising those @bplies and @stephenb. I added a word about it to the metrics page, which references to the instrument config, where I also added the relevant clarification.
Please let me know if you think an additional clarification is required.

1 Like

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