Class ServletContextPath


  • public class ServletContextPath
    extends Object
    The context key here is used to propagate the servlet context path throughout the request, so that routing framework instrumentation that updates the span name with a more specific route can prepend the servlet context path in front of that route.

    This needs to be in the instrumentation-api module, instead of injected as a helper class into the different modules that need it, in order to make sure that there is only a single instance of the context key, since otherwise instrumentation across different class loaders would use different context keys and not be able to share the servlet context path.

    • Field Detail

      • CONTEXT_KEY

        public static final io.opentelemetry.context.ContextKey<String> CONTEXT_KEY
    • Constructor Detail

      • ServletContextPath

        public ServletContextPath()
    • Method Detail

      • prepend

        public static String prepend​(io.opentelemetry.context.Context context,
                                     String spanName)