예제 #1
0
 public KanekoDiagnosticProcessor(ITracingContext tracingContext,
                                  IEntrySegmentContextAccessor entrySegmentContextAccessor
                                  )
 {
     _tracingContext = tracingContext;
     _entrySegmentContextAccessor = entrySegmentContextAccessor;
 }
 public ClientDiagnosticProcessor(IExitSegmentContextAccessor segmentContextAccessor,
                                  ITracingContext tracingContext, IConfigAccessor configAccessor)
 {
     _tracingContext         = tracingContext;
     _segmentContextAccessor = segmentContextAccessor;
     _tracingConfig          = configAccessor.Get <TracingConfig>();
 }
 public ServerDiagnosticProcessor(IEntrySegmentContextAccessor segmentContextAccessor,
                                  ITracingContext tracingContext, IConfigAccessor configAccessor)
 {
     _tracingContext         = tracingContext;
     _segmentContextAccessor = segmentContextAccessor;
     _tracingConfig          = configAccessor.Get <TracingConfig>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MqttTransportDiagnosticProcessor" /> class.
 /// </summary>
 /// <param name="tracingContext">The tracing context.</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="contextAccessor">The context accessor.</param>
 public MqttTransportDiagnosticProcessor(ITracingContext tracingContext, ISerializer <string> serializer,
                                         IEntrySegmentContextAccessor contextAccessor)
 {
     _tracingContext         = tracingContext;
     _serializer             = serializer;
     _segmentContextAccessor = contextAccessor;
 }
예제 #5
0
 public HttpClientTracingDiagnosticProcessor(ITracingContext tracingContext, IExitSegmentContextAccessor contextAccessor, IOptions <SkyApmHttpClientOption> options)
 {
     _tracingContext   = tracingContext;
     _contextAccessor  = contextAccessor;
     _option           = options.Value;
     IgnoreRequestHost = _option?.IgnoreRequestHost ?? new List <string>();
 }
예제 #6
0
 public HostingTracingDiagnosticProcessor(IEntrySegmentContextAccessor segmentContextAccessor,
                                          ITracingContext tracingContext, IEnumerable <IHostingDiagnosticHandler> diagnosticHandlers)
 {
     _tracingContext         = tracingContext;
     _diagnosticHandlers     = diagnosticHandlers.Reverse();
     _segmentContextAccessor = segmentContextAccessor;
 }
 public SqlClientTracingDiagnosticProcessor(ITracingContext tracingContext,
                                            IExitSegmentContextAccessor contextAccessor, IConfigAccessor configAccessor)
 {
     _tracingContext  = tracingContext;
     _contextAccessor = contextAccessor;
     _tracingConfig   = configAccessor.Get <TracingConfig>();
 }
 public JimuClientDiagnosticProcessor(ITracingContext tracingContext
                                      , IExitSegmentContextAccessor exitSegmentContextAccessor
                                      )
 {
     _tracingContext             = tracingContext;
     _exitSegmentContextAccessor = exitSegmentContextAccessor;
 }
 public SmartSqlTracingDiagnosticProcessor(ITracingContext tracingContext,
                                           ILocalSegmentContextAccessor localSegmentContextAccessor, IConfigAccessor configAccessor)
 {
     _tracingContext = tracingContext;
     _localSegmentContextAccessor = localSegmentContextAccessor;
     _tracingConfig = configAccessor.Get <TracingConfig>();
 }
예제 #10
0
        public void BeginRequest(ITracingContext tracingContext, HttpContext httpContext)
        {
            var context = tracingContext.CreateEntrySegmentContext(httpContext.Request.Path,
                                                                   new HttpRequestCarrierHeaderCollection(httpContext.Request));

            context.Span.SpanLayer = SpanLayer.HTTP;
            context.Span.Component = Common.Components.ASPNETCORE;
            context.Span.Peer      = new StringOrIntValue(httpContext.Connection.RemoteIpAddress.ToString());
            context.Span.AddTag(Tags.URL, httpContext.Request.GetDisplayUrl());
            context.Span.AddTag(Tags.PATH, httpContext.Request.Path);
            context.Span.AddTag(Tags.HTTP_METHOD, httpContext.Request.Method);

            if (_config.CollectCookies?.Count > 0)
            {
                var cookies = CollectCookies(httpContext, _config.CollectCookies);
                if (!string.IsNullOrEmpty(cookies))
                {
                    context.Span.AddTag(Tags.HTTP_COOKIES, cookies);
                }
            }

            if (_config.CollectHeaders?.Count > 0)
            {
                var headers = CollectHeaders(httpContext, _config.CollectHeaders);
                if (!string.IsNullOrEmpty(headers))
                {
                    context.Span.AddTag(Tags.HTTP_HEADERS, headers);
                }
            }
        }
예제 #11
0
 public InstrumentRequestCallback(IConfigAccessor configAccessor, ITracingContext tracingContext,
                                  IEntrySegmentContextAccessor contextAccessor)
 {
     _config          = configAccessor.Get <InstrumentConfig>();
     _tracingContext  = tracingContext;
     _contextAccessor = contextAccessor;
 }
 public JimuServerDiagnosticProcessor(ITracingContext tracingContext
                                      , IEntrySegmentContextAccessor entrySegmentContextAccessor
                                      )
 {
     _tracingContext = tracingContext;
     _entrySegmentContextAccessor = entrySegmentContextAccessor;
 }
 public HttpClientTracingDiagnosticProcessor(ITracingContext tracingContext,
                                             IExitSegmentContextAccessor contextAccessor,
                                             IEnumerable <IRequestDiagnosticHandler> requestDiagnosticHandlers)
 {
     _tracingContext            = tracingContext;
     _contextAccessor           = contextAccessor;
     _requestDiagnosticHandlers = requestDiagnosticHandlers.Reverse();
 }
 public EFCoreTracingDiagnosticProcessor(ITracingContext tracingContext, IExitContextAccessor exitAccessor,
                                         ILocalContextAccessor localAccessor, IEnumerable <IEFCoreDiagnosticHandler> EfDiagnosticHandler)
 {
     TracingContext          = tracingContext;
     ExitAccessor            = exitAccessor;
     LocalAccessor           = localAccessor;
     EFCoreDiagnosticHandler = EfDiagnosticHandler;
 }
 public HostingTracingDiagnosticProcessor(IEntrySegmentContextAccessor segmentContextAccessor,
                                          ITracingContext tracingContext, IEnumerable <IHostingDiagnosticHandler> diagnosticHandlers,
                                          IConfigAccessor configAccessor)
 {
     _tracingContext         = tracingContext;
     _diagnosticHandlers     = diagnosticHandlers.Reverse();
     _segmentContextAccessor = segmentContextAccessor;
     _tracingConfig          = configAccessor.Get <TracingConfig>();
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="tracingContext"></param>
 /// <param name="contextAccessor"></param>
 /// <param name="component"></param>
 public SqlBuilderTracingDiagnosticProcessor(
     ITracingContext tracingContext,
     IExitSegmentContextAccessor contextAccessor,
     StringOrIntValue?component = null)
 {
     _tracingContext  = tracingContext;
     _contextAccessor = contextAccessor;
     _component       = component ?? Components.SQLCLIENT;
 }
예제 #17
0
 public CapTracingDiagnosticProcessor(ITracingContext tracingContext,
                                      IEntrySegmentContextAccessor entrySegmentContextAccessor,
                                      IExitSegmentContextAccessor exitSegmentContextAccessor,
                                      ILocalSegmentContextAccessor localSegmentContextAccessor)
 {
     _tracingContext              = tracingContext;
     _exitSegmentContextAccessor  = exitSegmentContextAccessor;
     _localSegmentContextAccessor = localSegmentContextAccessor;
     _entrySegmentContextAccessor = entrySegmentContextAccessor;
 }
예제 #18
0
        public void BeginRequest(ITracingContext tracingContext, HttpContext httpContext)
        {
            var context = tracingContext.CreateEntrySegmentContext(httpContext.Request.Path,
                                                                   new HttpRequestCarrierHeaderCollection(httpContext.Request));

            context.Span.SpanLayer = SpanLayer.RPC_FRAMEWORK;
            context.Span.Component = Common.Components.GRPC;
            context.Span.Peer      = new StringOrIntValue(httpContext.Connection.RemoteIpAddress.ToString());
            context.Span.AddTag(Tags.URL, httpContext.Request.GetDisplayUrl());
        }
 public EntityFrameworkCoreSegmentContextFactory(
     IEnumerable <IEntityFrameworkCoreSpanMetadataProvider> spanMetadataProviders,
     ITracingContext tracingContext, ILocalSegmentContextAccessor localSegmentContextAccessor,
     IExitSegmentContextAccessor exitSegmentContextAccessor)
 {
     _spanMetadataProviders       = spanMetadataProviders;
     _tracingContext              = tracingContext;
     _localSegmentContextAccessor = localSegmentContextAccessor;
     _exitSegmentContextAccessor  = exitSegmentContextAccessor;
 }
예제 #20
0
 public MySqlDataDiagnosticProcessor(ITracingContext tracingContext,
                                     IExitSegmentContextAccessor contextAccessor)
 {
     _tracingContext  = tracingContext;
     _contextAccessor = contextAccessor;
     MySqlTrace.Listeners.Clear();
     MySqlTrace.Listeners.Add(this);
     MySqlTrace.Switch.Level         = SourceLevels.Information;
     MySqlTrace.QueryAnalysisEnabled = true;
 }
예제 #21
0
        public void Handle(ITracingContext tracingContext, HttpRequestMessage request)
        {
            var Partial = tracingContext.CreateExitPartialContext(request.RequestUri.ToString());

            Partial.Context.Component = "HttpClient";
            Partial.Context.LayerType = ChannelLayerType.HTTP;
            Partial.Context.Add("Method", request.Method.ToString());
            Partial.Context.Add("URL", request.RequestUri.ToString());
            Partial.Context.Add("Path", $"{request.RequestUri.Host}:{request.RequestUri.Port}");
            Partial.Context.Add("Router", request.RequestUri.Host);
        }
예제 #22
0
        public void Handle(ITracingContext tracingContext, HttpRequestMessage request)
        {
            var context = tracingContext.CreateExitSegmentContext(request.RequestUri.ToString(),
                                                                  $"{request.RequestUri.Host}:{request.RequestUri.Port}",
                                                                  new HttpClientICarrierHeaderCollection(request));

            context.Span.SpanLayer = SpanLayer.HTTP;
            context.Span.Component = Common.Components.HTTPCLIENT;
            context.Span.AddTag(Tags.URL, request.RequestUri.ToString());
            context.Span.AddTag(Tags.HTTP_METHOD, request.Method.ToString());
        }
        public void BeginRequest(ITracingContext tracingContext, HttpContext httpContext)
        {
            var Partial = tracingContext.CreateEntryPartialContext(httpContext.Request.Path, new CarrierHeaderCollection(httpContext));

            Partial.Context.Component = "AspNetCore";
            Partial.Context.LayerType = ChannelLayerType.HTTP;
            Partial.Context.Add("Method", httpContext.Request.Method);
            Partial.Context.Add("URL", httpContext.Request.GetDisplayUrl());
            Partial.Context.Add("Path", httpContext.Request.Path);
            Partial.Context.Add("Router", httpContext.Connection.RemoteIpAddress.ToString());
        }
 public HttpClientTracingDiagnosticProcessor(ITracingContext tracingContext,
                                             IExitSegmentContextAccessor contextAccessor,
                                             IEnumerable <IRequestDiagnosticHandler> requestDiagnosticHandlers,
                                             IConfigAccessor configAccessor)
 {
     _tracingContext             = tracingContext;
     _contextAccessor            = contextAccessor;
     _requestDiagnosticHandlers  = requestDiagnosticHandlers.Reverse();
     _tracingConfig              = configAccessor.Get <TracingConfig>();
     _httpClientDiagnosticConfig = configAccessor.Get <HttpClientDiagnosticConfig>();
 }
예제 #25
0
 public MySqlTracingDiagnosticProcessor(
     ITracingContext tracingContext,
     IExitSegmentContextAccessor contextAccessor)
 {
     _tracingContext  = tracingContext;
     _contextAccessor = contextAccessor;
     //to use this,you should add "logging=true" to the connection string
     MySqlTrace.Listeners.Clear();
     MySqlTrace.Listeners.Add(this);
     MySqlTrace.Switch.Level         = SourceLevels.Information;
     MySqlTrace.QueryAnalysisEnabled = true;
 }
예제 #26
0
        public void BeginRequest(ITracingContext tracingContext, HttpContext httpContext)
        {
            var context = tracingContext.CreateEntrySegmentContext(httpContext.Request.Path,
                                                                   new HttpRequestCarrierHeaderCollection(httpContext.Request));

            context.Span.SpanLayer = SpanLayer.HTTP;
            context.Span.Component = Common.Components.ASPNETCORE;
            context.Span.Peer      = new StringOrIntValue(httpContext.Connection.RemoteIpAddress.ToString());
            context.Span.AddTag(Tags.URL, httpContext.Request.GetDisplayUrl());
            context.Span.AddTag(Tags.PATH, httpContext.Request.Path);
            context.Span.AddTag(Tags.HTTP_METHOD, httpContext.Request.Method);
        }
예제 #27
0
 public CacheTracingDiagnosticProcessor(ITracingContext tracingContext,
                                        ILocalSegmentContextAccessor localSegmentContextAccessor
                                        , IEntrySegmentContextAccessor entrySegmentContextAccessor
                                        , IExitSegmentContextAccessor exitSegmentContextAccessor
                                        , IConfigAccessor configAccessor)
 {
     _tracingContext              = tracingContext;
     _exitSegmentContextAccessor  = exitSegmentContextAccessor;
     _localSegmentContextAccessor = localSegmentContextAccessor;
     _entrySegmentContextAccessor = entrySegmentContextAccessor;
     _tracingConfig = configAccessor.Get <TracingConfig>();
 }
예제 #28
0
 public void Handle(ITracingContext tracingContext, Object Provider)
 {
     if (Provider is Dictionary <string, object> ProviderData)
     {
         var MethodName = ProviderData["MethodName"].ToString();
         ProviderData.Remove("MethodName");
         var Parameters = ProviderData.ToJson();
         var Partial    = tracingContext.CreateLocalPartialContext(MethodName);
         Partial.Context.Component = "MethodInvoke";
         Partial.Context.LayerType = ChannelLayerType.Method;
         Partial.Context.Add("Method", MethodName);
         Partial.Context.Add("Parameters", Parameters);
     }
 }
예제 #29
0
        public void Handle(ITracingContext tracingContext, HttpRequestMessage request)
        {
            var operationName         = request.RequestUri.GetLeftPart(UriPartial.Path);
            var shouldStopPropagation = _httpClientDiagnosticConfig.StopHeaderPropagationPaths != null &&
                                        _httpClientDiagnosticConfig.StopHeaderPropagationPaths
                                        .Any(pattern => FastPathMatcher.Match(pattern, operationName));

            var context = tracingContext.CreateExitSegmentContext(operationName,
                                                                  $"{request.RequestUri.Host}:{request.RequestUri.Port}",
                                                                  shouldStopPropagation ? null : new HttpClientICarrierHeaderCollection(request));

            context.Span.SpanLayer = SpanLayer.HTTP;
            context.Span.Component = Common.Components.HTTPCLIENT;
            context.Span.AddTag(Tags.URL, request.RequestUri.ToString());
            context.Span.AddTag(Tags.HTTP_METHOD, request.Method.ToString());
        }
예제 #30
0
        public void Handle(ITracingContext tracingContext, HttpRequestMessage request)
        {
            var operationName = request.RequestUri.GetLeftPart(UriPartial.Path);

            var ignored = _httpClientDiagnosticConfig.IgnorePaths != null &&
                          _httpClientDiagnosticConfig.IgnorePaths
                          .Any(pattern => FastPathMatcher.Match(pattern, operationName));

            if (ignored)
            {
                return;
            }

            var shouldStopPropagation = _httpClientDiagnosticConfig.StopHeaderPropagationPaths != null &&
                                        _httpClientDiagnosticConfig.StopHeaderPropagationPaths
                                        .Any(pattern => FastPathMatcher.Match(pattern, operationName));

            var context = tracingContext.CreateExitSegmentContext(operationName,
                                                                  $"{request.RequestUri.Host}:{request.RequestUri.Port}",
                                                                  shouldStopPropagation ? null : new HttpClientICarrierHeaderCollection(request));

            context.Span.SpanLayer = SpanLayer.HTTP;
            context.Span.Component = Common.Components.HTTPCLIENT;
            context.Span.AddTag(Tags.URL, request.RequestUri.ToString());
            context.Span.AddTag(Tags.HTTP_METHOD, request.Method.ToString());

            if (_httpClientDiagnosticConfig.CollectRequestHeaders?.Count > 0)
            {
                var headers = CollectHeaders(request, _httpClientDiagnosticConfig.CollectRequestHeaders);
                if (!string.IsNullOrEmpty(headers))
                {
                    context.Span.AddTag(Tags.HTTP_HEADERS, headers);
                }
            }

            if (request.Content != null && _httpClientDiagnosticConfig.CollectRequestBodyContentTypes?.Count > 0)
            {
                var requestBody = request.Content.TryCollectAsString(
                    _httpClientDiagnosticConfig.CollectRequestBodyContentTypes,
                    _httpClientDiagnosticConfig.CollectBodyLengthThreshold);
                if (!string.IsNullOrEmpty(requestBody))
                {
                    context.Span.AddTag(Tags.HTTP_REQUEST_BODY, requestBody);
                }
            }
        }