Class CloudTraceIdExtractor

java.lang.Object
com.google.cloud.spring.logging.extractors.CloudTraceIdExtractor
All Implemented Interfaces:
TraceIdExtractor

public class CloudTraceIdExtractor extends Object implements TraceIdExtractor
Extracts trace IDs from HTTP requests using the x-cloud-trace-context header.
  • Field Details

    • X_CLOUD_TRACE_HEADER

      public static final String X_CLOUD_TRACE_HEADER
      The name of the header that contains the trace id.
      See Also:
  • Constructor Details

    • CloudTraceIdExtractor

      public CloudTraceIdExtractor()
  • Method Details

    • extractTraceIdFromRequest

      public String extractTraceIdFromRequest(jakarta.servlet.http.HttpServletRequest req)
      Description copied from interface: TraceIdExtractor
      Extract trace ID from the HTTP request.
      Specified by:
      extractTraceIdFromRequest in interface TraceIdExtractor
      Parameters:
      req - the HTTP servlet request.
      Returns:
      the trace ID or null, if none found.