Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }