HTTP header does not include traceparent

I am trying to use RUM on the spring-boot application I would like to link the transactions from the Client side (i.e. JavaScript) to the Server side (i.e. Java).

From the documentation I found that I could do this with distributet tracing. I also looked at this blog entry for instructions on how to do this.

On the Client side I configured the RUM-agent as follows:

    <script src=""></script>
      serviceName: 'PetClinic',
      serviceVersion: '1.0',

      serverUrl: 'http://localhost:8200', // APM server
      transactionThrottleInterval: 1,

      // distributedTracingOrigins: ['localhost:8080', 'http://localhost:8080', 'http://localhost:8080/'],
      propagateTracestate: true

On the Server side I configured the HTTP-Headers and HTTP-Methods as described in this blog entry.

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

import java.util.logging.Level;
import java.util.logging.Logger;

public class MyCorsConfiguration {
	public FilterRegistrationBean<CorsFilter> corsFilter() {
		UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
		CorsConfiguration config = new CorsConfiguration();
		source.registerCorsConfiguration("/**", config);
		FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));

		Logger.getLogger(MyCorsConfiguration.class.getName()).log(Level.INFO, "Add CORS configuration");

		return bean;

The server is started with the Java elastic APM agent to monitor the Server side operations.


Unfortunately, the HTTP requests that are recorded on the server side to not contain the traceparent or tracestate headers.

      "title":"C:\\Program Files\\Java\\jdk-11.0.5\\bin\\java.exe"
         "platform":"Windows 10"
               "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
               "gzip, deflate, br"
               "\"Google Chrome\";v=\"95\", \"Chromium\";v=\"95\", \";Not A Brand\";v=\"99\""
               "Mon, 08 Nov 2021 14:27:18 GMT"
      "result":"HTTP 2xx",
         "name":"Spring Web MVC",
      "original":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"

If I understood the documentation correctly traceparent and tracestate should be added to the HTTP-Headers of the requests. Am I correct in that understanding or did I get something wrong here?

Does anyone know what is wrong or missing in my configuration?

APM Agent language and version:

JavaScript; v 5.9.1
Java; v 1.26.0

Browser version:

I tried it with Firefox 93.0 (64-Bit)
and Chrome Version 95.0.4638.69 (Official Build) (64-bit)

Thanks for reading!

Your CORS handling may not be set properly.
You can open your browser debugging tools (e.g. Chrome Developer Tools) and debug such a request. Each request should be preflighted with an OPTIONS HTTP request containing some CORS-related headers, and the response should contain all headers added through MyCorsConfiguration.
If there is no such OPTIONS request at all before the GET, it may be because you omitted the distributedTracingOrigins setting. Try to uncomment it as is and it should fix that.

If this doesn't help, please add here all details from both OPTIONS and GET requests as you see them in the browser dev tools.

I hope this helps.


Thanks for helping!

Unfortunatly, I do not see a OPTIONS HTTP request, even after removing the comment from distributedTracingOrigins.

The elastic RUM agent should be able to work also for the type document requests right? Or does it only work for XHR or other fetch requests?

Hi @sfischer ,

Distributed tracing headers are added only for API calls (XHR and Fetch) by the RUM agent. If you want to trace the HTML document generation, you would have to set up the RUM agent with appropriate page-load trace details.

Please let us know if you need any help.


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