public Scope CreateScope(OutboundHttpArgs args, out HttpTags tags)
        {
            var otelTags = new OtelHttpTags();

            tags = otelTags;

            string operationName = "HTTP " + args.HttpMethod;
            string serviceName   = _tracer.Settings.GetServiceName(_tracer, "http-client");
            var    scope         = _tracer.StartActiveWithTags(operationName, tags: tags, serviceName: serviceName, spanId: args.SpanId);

            scope.Span.Type = SpanTypes.Http;

            var uri = args.RequestUri;

            otelTags.HttpMethod          = args.HttpMethod;
            otelTags.HttpUrl             = string.Concat(uri.Scheme, Uri.SchemeDelimiter, uri.Authority, uri.PathAndQuery, uri.Fragment);
            otelTags.InstrumentationName = IntegrationRegistry.GetName(args.IntegrationInfo);
            return(scope);
        }
예제 #2
0
        public Scope CreateScope(OutboundHttpArgs args, out HttpTags tags)
        {
            tags = new DatadogHttpTags();
            var requestUri = args.RequestUri;
            var httpMethod = args.HttpMethod;

            string serviceName = _tracer.Settings.GetServiceName(_tracer, "http-client");
            var    scope       = _tracer.StartActiveWithTags("http.request", tags: tags, serviceName: serviceName, spanId: args.SpanId);

            scope.Span.Type = SpanTypes.Http;

            tags.HttpMethod = httpMethod;
            tags.HttpUrl    = UriHelpers.CleanUri(requestUri, removeScheme: false, tryRemoveIds: false);
            string resourceUrl = UriHelpers.CleanUri(requestUri, removeScheme: true, tryRemoveIds: true);

            scope.Span.ResourceName = $"{httpMethod} {resourceUrl}";

            var integrationId = args.IntegrationInfo;

            tags.InstrumentationName = IntegrationRegistry.GetName(integrationId);
            tags.SetAnalyticsSampleRate(integrationId, _tracer.Settings, enabledWithGlobalSetting: false);
            return(scope);
        }