Unable to Set sync = false in elastic apm while doing custom instrumentation

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

TIP 1: select at least one tag that further categorizes your topic. For example server for APM Server related questions, java for questions regarding the Elastic APM Java agent, or ui for questions about the APM App within Kibana.

APM Server version: "version": "7.13.0"

APM Agent language and version: Java 11.0.19 apm agent 1.48.1

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
download page

Fresh install or upgraded from other version?
Fresh install
Is there anything special in your setup?
Nothing special in setup

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I am trying to set up some custom instrumentation and tracing
and i know for a fact that the method i am trying to instrument is an async operation since its is called in a background thread always.
I want to show the async badge in apm by some how setting the sync=false in the span but the Elastic apm api does not expose any method to modify this span and make it sync=false.
all i can do is set some label but then those don't show up in the apm ui with the async badge.

 private <T> Callable<T> wrapTask(Callable<T> delegate) {
    return () -> {
      log.info("setting config refresh label to sync false");
      final Span span = ElasticApm.currentSpan();
      span.setLabel("sync", false);
      final T call = delegate.call();
      log.info("setting this to sync ");
      return call;
    };
  }

Hi @amaan75 ,

If you have a clear way to identify your async spans (for example through their name or custom labels), then it should be possible to use a custom ingest pipeline to modify them: Parse data using ingest pipelines | Elastic Observability [8.12] | Elastic

However this <signal>-apm@custom custom pipeline does not apply to the version you are using, however it's possible to modify the APM ingest pipelines themselves to achieve this: Pipelines | APM Server Reference [7.13] | Elastic.

I am not an expert on the ingestion details, especially the older versions, but this usually the recommended way to manually alter the captured data before storage.

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