File: Latency\Internal\HttpLatencyMediator.netfx.cs
Web Access
Project: src\src\Libraries\Microsoft.Extensions.Http.Diagnostics\Microsoft.Extensions.Http.Diagnostics.csproj (Microsoft.Extensions.Http.Diagnostics)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#if !NET
 
using System.Net.Http;
using Microsoft.Extensions.Diagnostics.Latency;
 
namespace Microsoft.Extensions.Http.Latency.Internal;
 
internal sealed class HttpLatencyMediator
{
    private readonly TagToken _httpVersionTag;
 
    public HttpLatencyMediator(ILatencyContextTokenIssuer tokenIssuer)
    {
        _httpVersionTag = tokenIssuer.GetTagToken(HttpTags.HttpVersion);
    }
 
    public void RecordEnd(ILatencyContext latencyContext, HttpResponseMessage? response = null)
    {
        if (response != null)
        {
            latencyContext?.SetTag(_httpVersionTag, response.Version.ToString());
        }
    }
}
#endif