示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public MessageInterceptorDecorator(IMessageInterceptor handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler    = handler;
     _tracer     = tracer;
     _headers    = headers;
     DisplayName = _handler.DisplayName;
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Headers"/> class.
 /// </summary>
 /// <param name="standardHeaders">The standard headers.</param>
 /// <param name="customHeaders">The customer headers.</param>
 public Headers(IStandardHeaders standardHeaders, ICustomHeaders customHeaders)
 {
     Guard.NotNull(() => standardHeaders, standardHeaders);
     Guard.NotNull(() => customHeaders, customHeaders);
     StandardHeaders = standardHeaders;
     CustomHeaders = customHeaders;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public SerializerDecorator(ISerializer handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler    = handler;
     _tracer     = tracer;
     _headers    = headers;
     DisplayName = _handler.DisplayName;
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Headers"/> class.
 /// </summary>
 /// <param name="standardHeaders">The standard headers.</param>
 /// <param name="customHeaders">The customer headers.</param>
 public Headers(IStandardHeaders standardHeaders, ICustomHeaders customHeaders)
 {
     Guard.NotNull(() => standardHeaders, standardHeaders);
     Guard.NotNull(() => customHeaders, customHeaders);
     StandardHeaders = standardHeaders;
     CustomHeaders   = customHeaders;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceivePoisonMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 /// <param name="getHeader">The get header.</param>
 public ReceivePoisonMessageDecorator(IReceivePoisonMessage handler, ActivitySource tracer, IStandardHeaders headers, IGetHeader getHeader)
 {
     _handler   = handler;
     _tracer    = tracer;
     _headers   = headers;
     _getHeader = getHeader;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoveMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 /// <param name="getHeader">The get header.</param>
 public RemoveMessageDecorator(IRemoveMessage handler, ITracer tracer, IStandardHeaders headers, IGetHeader getHeader)
 {
     _handler   = handler;
     _tracer    = tracer;
     _headers   = headers;
     _getHeader = getHeader;
 }
示例#7
0
        /// <summary>
        /// Injects the specified tracer.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="tracer">The tracer.</param>
        /// <param name="context">The context.</param>
        /// <param name="headers">The headers.</param>
        public static void Inject(this IMessage message, ITracer tracer, ISpanContext context,
                                  IStandardHeaders headers)
        {
            var mapping = new DataMappingTextMap();

            tracer.Inject(context, BuiltinFormats.TextMap, mapping);
            message.SetHeader(headers.TraceSpan, mapping);
        }
示例#8
0
 /// <summary>
 /// Extracts the specified tracer.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 /// <returns></returns>
 public static ISpanContext Extract(this IMessage message, ITracer tracer, IStandardHeaders headers)
 {
     if (message.Headers.ContainsKey(headers.TraceSpan.Name))
     {
         var mapping =
             (DataMappingTextMap)message.Headers[headers.TraceSpan.Name];
         return(tracer.Extract(BuiltinFormats.TextMap, mapping));
     }
     return(null);
 }
示例#9
0
        /// <summary>
        /// Injects the specified tracer.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="tracer">The tracer.</param>
        /// <param name="context">The context.</param>
        /// <param name="headers">The headers.</param>
        public static void Inject(this IMessage message, ActivitySource tracer, ActivityContext context,
                                  IStandardHeaders headers)
        {
            var mapping = Propagators.DefaultTextMapPropagator;;

            mapping.Inject(new PropagationContext(context, Baggage.Current), message.Headers, InjectTraceContextIntoBasicProperties);

            //tracer.Inject(context, BuiltinFormats.TextMap, mapping);
            //message.SetHeader(headers.TraceSpan, mapping);
        }
示例#10
0
 /// <summary>
 /// Extracts the specified tracer.
 /// </summary>
 /// <param name="inputHeaders">The input headers.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 /// <returns></returns>
 public static ISpanContext Extract(this IDictionary <string, object> inputHeaders, ITracer tracer, IStandardHeaders headers)
 {
     if (inputHeaders.ContainsKey(headers.TraceSpan.Name))
     {
         var mapping =
             (DataMappingTextMap)inputHeaders[headers.TraceSpan.Name];
         return(tracer.Extract(BuiltinFormats.TextMap, mapping));
     }
     return(null);
 }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResetHeartBeatDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public ResetHeartBeatDecorator(IResetHeartBeat handler, ActivitySource tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public CommitMessageDecorator(ICommitMessage handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public CommitMessageDecorator(ICommitMessage handler, ActivitySource tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageMethodHandlingDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public MessageMethodHandlingDecorator(IMessageMethodHandling handler, ActivitySource tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageHandlerDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public MessageHandlerDecorator(IMessageHandler handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendHeartBeatDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public SendHeartBeatDecorator(ISendHeartBeat handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesErrorDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public ReceiveMessagesErrorDecorator(IReceiveMessagesError handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
示例#18
0
 /// <summary>
 /// Extracts the specified tracer.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 /// <returns></returns>
 public static ActivityContext Extract(this IReceivedMessageInternal message, ActivitySource tracer,
                                       IStandardHeaders headers)
 {
     TextMapPropagator propagator = new TraceContextPropagator();
     var parentContext            = propagator.Extract(default, message.Headers, ExtractTraceContextFromBasicProperties);
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbackMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public RollbackMessageDecorator(IRollbackMessage handler, ITracer tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
示例#20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbackMessageDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public RollbackMessageDecorator(IRollbackMessage handler, ActivitySource tracer, IStandardHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }