97 references to TelemetryConstants
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Latency\RequestLatencyTelemetryMiddleware.cs (1)
68httpContext.Response.Headers[TelemetryConstants.ServerApplicationNameHeader] = _applicationName;
Logging\HttpLoggingRedactionInterceptor.cs (1)
85string path = TelemetryConstants.Unknown;
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (16)
Latency\RequestLatencyTelemetryMiddlewareTests.cs (5)
44var header = httpContextMock.Response.Headers[TelemetryConstants.ServerApplicationNameHeader]; 74Assert.False(httpContextMock.Response.Headers.TryGetValue(TelemetryConstants.ServerApplicationNameHeader, out var val)); 98httpContextMock.Response.Headers.Append(TelemetryConstants.ServerApplicationNameHeader, "testValue"); 102var header = httpContextMock.Response.Headers[TelemetryConstants.ServerApplicationNameHeader]; 133Assert.False(httpContextMock.Response.Headers.TryGetValue(TelemetryConstants.ServerApplicationNameHeader, out var val));
Logging\AcceptanceTests.cs (5)
190Assert.Single(state, x => x.Key == HttpLoggingTagNames.Path && x.Value == TelemetryConstants.Unknown); 250Assert.Single(state, x => x.Key == HttpLoggingTagNames.Path && x.Value == TelemetryConstants.Unknown); 322Assert.Single(requestState, x => x.Key == HttpLoggingTagNames.Path && x.Value == TelemetryConstants.Unknown); 378Assert.Single(state, x => x.Key == HttpLoggingTagNames.Path && x.Value == TelemetryConstants.Unknown); 584Assert.Single(state, x => x.Key == HttpLoggingTagNames.Path && x.Value == TelemetryConstants.Unknown);
Logging\AcceptanceTests.Mvc.cs (3)
55[InlineData(HttpRouteParameterRedactionMode.Strict, $"api/users/<redacted:testUserId>/{TelemetryConstants.Redacted}")] 117Assert.Single(state, x => x.Key == NoDataClassParamName && x.Value == TelemetryConstants.Redacted); 246var expectedPath = routeParameterRedactionModeNone ? RequestPath : TelemetryConstants.Unknown;
Logging\AcceptanceTests.Routing.cs (3)
92[InlineData(Strict, "ConventionalRouting/GetData/12345", $"ConventionalRouting/GetData/{TelemetryConstants.Redacted}")] 110[InlineData(Strict, "AttributeRouting/get-4/top10", $"AttributeRouting/get-4/{TelemetryConstants.Redacted}")] 126[InlineData(Strict, "mixed/attribute-routing-4/test1234", $"mixed/attribute-routing-4/{TelemetryConstants.Redacted}")]
Microsoft.Extensions.Http.Diagnostics (14)
Http\Constants.cs (3)
20public const string RequestRouteHeader = $"X-{TelemetryConstants.RequestMetadataKey}-{nameof(RequestMetadata.RequestRoute)}"; 25public const string RequestNameHeader = $"X-{TelemetryConstants.RequestMetadataKey}-{nameof(RequestMetadata.RequestName)}"; 30public const string DependencyNameHeader = $"X-{TelemetryConstants.RequestMetadataKey}-{nameof(RequestMetadata.DependencyName)}";
Http\HttpDiagnosticsHttpRequestMessageExtensions.cs (2)
28_ = request.Options.TryAdd(TelemetryConstants.RequestMetadataKey, metadata); 44_ = request.Options.TryGetValue(new HttpRequestOptionsKey<RequestMetadata>(TelemetryConstants.RequestMetadataKey), out var metadata);
Http\HttpDiagnosticsHttpWebRequestExtensions.cs (2)
51RequestName = string.IsNullOrEmpty(requestName) ? TelemetryConstants.Unknown : requestName, 52DependencyName = string.IsNullOrEmpty(dependencyName) ? TelemetryConstants.Unknown : dependencyName
Latency\Internal\HttpClientLatencyLogEnricher.cs (1)
61if (headers.TryGetValues(TelemetryConstants.ServerApplicationNameHeader, out var values))
Latency\Internal\HttpLatencyTelemetryHandler.cs (1)
49request.Headers.Add(TelemetryConstants.ClientApplicationNameHeader, _applicationName);
Logging\Internal\HttpHeadersRedactor.cs (1)
29_ => TelemetryConstants.Unknown
Logging\Internal\HttpRequestReader.cs (4)
99logRecord.Host = request.RequestUri?.Host ?? TelemetryConstants.Unknown; 139logRecord.Path = TelemetryConstants.Unknown; 155logRecord.Path = TelemetryConstants.Redacted; 160if (route == TelemetryConstants.Unknown)
Microsoft.Extensions.Http.Diagnostics.Tests (25)
HttpHeadersRedactorTests.cs (1)
48Add(null!, TelemetryConstants.Unknown);
Latency\Internal\HttpClientLatencyLogEnricherTest.cs (1)
67httpResponseMessage.Headers.Add(TelemetryConstants.ServerApplicationNameHeader, serverName);
Latency\Internal\HttpLatencyTelemetryHandlerTest.cs (1)
71Assert.True(req.Headers.Contains(TelemetryConstants.ClientApplicationNameHeader));
Logging\AcceptanceTests.cs (4)
47Assert.Equal($"{HttpMethod.Get} {_unreachableRequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.Message); 80Assert.EndsWith($"{HttpMethod.Get} {_unreachableRequestUri.Host}/{TelemetryConstants.Redacted}", firstLogRecord.Message); 88Assert.Equal($"{HttpMethod.Get} {_unreachableRequestUri.Host}/{TelemetryConstants.Redacted}", secondLogRecord.Message); 117Assert.Equal($"{httpRequestMessage.Method} {httpRequestMessage.RequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.Message);
Logging\HttpClientLoggerTest.cs (8)
245logRecordState.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted); 342logRecordRequest.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted); 351logRecordFull.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted); 441Assert.Equal($"{httpRequestMessage.Method} {httpRequestMessage.RequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.Message); 447logRecordState.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted); 562logRecordState.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted); 652logRecordState.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted); 925logRecord.Contains(HttpClientLoggingTagNames.Path, TelemetryConstants.Redacted);
Logging\HttpRequestReaderTest.cs (5)
51Path = TelemetryConstants.Redacted, 117Host = TelemetryConstants.Unknown, 119Path = TelemetryConstants.Unknown, 453Path = TelemetryConstants.Redacted, 520Path = TelemetryConstants.Unknown,
TelemetryCommonExtensionsTests.cs (5)
22Assert.Equal(TelemetryConstants.Unknown, requestMetadata.DependencyName); 34Assert.Equal(TelemetryConstants.Unknown, requestMetadata.RequestRoute); 97Assert.Equal(TelemetryConstants.Unknown, extractedMetadata!.DependencyName); 98Assert.Equal(TelemetryConstants.Unknown, extractedMetadata!.RequestName); 99Assert.Equal(TelemetryConstants.Unknown, extractedMetadata!.RequestRoute);
Microsoft.Extensions.Http.Resilience (1)
Internal\ResilienceKeys.cs (1)
19public static readonly ResiliencePropertyKey<RequestMetadata> RequestMetadata = new(TelemetryConstants.RequestMetadataKey);
Microsoft.Extensions.Http.Resilience.Tests (1)
Resilience\ResilienceHandlerTest.cs (1)
47.GetValue(new ResiliencePropertyKey<RequestMetadata>(TelemetryConstants.RequestMetadataKey), null!)
Microsoft.Extensions.Resilience (1)
Resilience\ResilienceContextExtensions.cs (1)
15private static readonly ResiliencePropertyKey<RequestMetadata?> _requestMetadataKey = new(TelemetryConstants.RequestMetadataKey);
Microsoft.Extensions.Telemetry (2)
Http\HttpRouteFormatter.cs (1)
228_ = outputBuffer.Append(TelemetryConstants.Redacted.AsSpan());
Http\HttpRouteParser.cs (1)
262return TelemetryConstants.Redacted;
Microsoft.Extensions.Telemetry.Abstractions (4)
Http\RequestMetadata.cs (4)
34public RequestMetadata(string methodType, string requestRoute, string requestName = TelemetryConstants.Unknown) 58public string RequestRoute { get; set; } = TelemetryConstants.Unknown; 80public string RequestName { get; set; } = TelemetryConstants.Unknown; 96public string DependencyName { get; set; } = TelemetryConstants.Unknown;
Microsoft.Extensions.Telemetry.Abstractions.Tests (6)
Http\AbstractionTests.cs (6)
16Assert.Equal(TelemetryConstants.Unknown, requestMetadata.DependencyName); 17Assert.Equal(TelemetryConstants.Unknown, requestMetadata.RequestName); 18Assert.Equal(TelemetryConstants.Unknown, requestMetadata.RequestRoute); 38Assert.Equal("Extensions-RequestMetadata", TelemetryConstants.RequestMetadataKey); 39Assert.Equal("unknown", TelemetryConstants.Unknown); 40Assert.Equal("REDACTED", TelemetryConstants.Redacted);
Microsoft.Extensions.Telemetry.Tests (25)
Http\HttpParserTests.cs (6)
90ValidateRouteParameter(httpRouteParameters[1], "chatId", TelemetryConstants.Redacted, true); 109ValidateRouteParameter(httpRouteParameters[1], "chatId", TelemetryConstants.Redacted, true); 169ValidateRouteParameter(httpRouteParameters[0], "routeId", TelemetryConstants.Redacted, true); 187ValidateRouteParameter(httpRouteParameters[0], "routeId", TelemetryConstants.Redacted, true); 209ValidateRouteParameter(httpRouteParameters[1], "chatId", TelemetryConstants.Redacted, true); 240ValidateRouteParameter(httpRouteParameters[0], "routeId", TelemetryConstants.Redacted, true);
Http\HttpRouteFormatterTests.cs (17)
28Assert.Equal($"api/routes/{TelemetryConstants.Redacted}/chats/{TelemetryConstants.Redacted}", formattedPath); 41Assert.Equal($"api/routes/{TelemetryConstants.Redacted}/chats/{TelemetryConstants.Redacted}", formattedPath); 54Assert.Equal($"api/routes/{TelemetryConstants.Redacted}/chats/{TelemetryConstants.Redacted}", formattedPath); 67Assert.Equal($"api/chats:{TelemetryConstants.Redacted}@{TelemetryConstants.Redacted}", formattedPath); 80Assert.Equal($"api/chats:{TelemetryConstants.Redacted}@{TelemetryConstants.Redacted}/messages", formattedPath); 169Assert.Equal($"api/routes/Redacted:routeId123/chats/{TelemetryConstants.Redacted}", formattedPath); 205Assert.Equal($"api/routes/{TelemetryConstants.Redacted}/chats/{TelemetryConstants.Redacted}", formattedPath); 265Assert.Equal($"Redacted:routeId123/chats/{TelemetryConstants.Redacted}", formattedPath); 285Assert.Equal($"Redacted:routeId123/chats/{TelemetryConstants.Redacted}", formattedPath); 305Assert.Equal($"Redacted:routeId123/chats/{TelemetryConstants.Redacted}", formattedPath); 332Assert.Equal($"api/routes/{TelemetryConstants.Redacted}/chats/Redacted:chatId123", formattedPath);
Http\TelemetryCommonExtensionsTests.cs (2)
20Assert.Equal(TelemetryConstants.Unknown, requestMetadata.DependencyName); 32Assert.Equal(TelemetryConstants.Unknown, requestMetadata.RequestRoute);