Class MDCScopeDecorator

  • All Implemented Interfaces:
    brave.propagation.CurrentTraceContext.ScopeDecorator

    public final class MDCScopeDecorator
    extends brave.internal.propagation.CorrelationFieldScopeDecorator
    Adds MDC properties "traceId", "parentId" and "spanId" when a span is current. These can be used in log correlation.

    Ex.

    
     tracing = Tracing.newBuilder()
                      .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder()
                        .addScopeDecorator(MDCScopeDecorator.create())
                        .build()
                      )
                      ...
                      .build();
     
    • Method Detail

      • create

        public static brave.propagation.CurrentTraceContext.ScopeDecorator create()
      • get

        protected String get​(String key)
        Specified by:
        get in class brave.internal.propagation.CorrelationFieldScopeDecorator
      • put

        protected void put​(String key,
                           String value)
        Specified by:
        put in class brave.internal.propagation.CorrelationFieldScopeDecorator
      • remove

        protected void remove​(String key)
        Specified by:
        remove in class brave.internal.propagation.CorrelationFieldScopeDecorator