Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
utpilla committed Dec 12, 2023
1 parent 0278deb commit c95f96e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ namespace OpenTelemetry.Instrumentation.Http;

internal static class HttpRequestMessageContextPropagation
{
internal static Func<HttpRequestMessage, string, IEnumerable<string>> HeaderValuesGetter => (request, name) =>
{
if (request.Headers.TryGetValues(name, out var values))
{
return values;
}

return null;
};

internal static Action<HttpRequestMessage, string, string> HeaderValueSetter => (request, name, value) =>
{
request.Headers.Remove(name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,13 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

using System.Collections.Concurrent;
#if NETFRAMEWORK
using System.Net.Http;
#endif

namespace OpenTelemetry.Instrumentation.Http.Implementation;

/// <summary>
/// A collection of helper methods to be used when building Http activities.
/// </summary>
internal static class HttpTagHelper
{
private static readonly ConcurrentDictionary<string, string> MethodOperationNameCache = new();
private static readonly ConcurrentDictionary<HttpMethod, string> HttpMethodOperationNameCache = new();
private static readonly ConcurrentDictionary<HttpMethod, string> HttpMethodNameCache = new();

private static readonly Func<string, string> ConvertMethodToOperationNameRef = ConvertMethodToOperationName;
private static readonly Func<HttpMethod, string> ConvertHttpMethodToOperationNameRef = ConvertHttpMethodToOperationName;
private static readonly Func<HttpMethod, string> ConvertHttpMethodToNameRef = ConvertHttpMethodToName;

/// <summary>
/// Gets the OpenTelemetry standard name for an activity based on its Http method.
/// </summary>
/// <param name="method">Http method.</param>
/// <returns>Activity name.</returns>
public static string GetOperationNameForHttpMethod(string method) => MethodOperationNameCache.GetOrAdd(method, ConvertMethodToOperationNameRef);

/// <summary>
/// Gets the OpenTelemetry standard operation name for a span based on its <see cref="HttpMethod"/>.
/// </summary>
/// <param name="method"><see cref="HttpMethod"/>.</param>
/// <returns>Span operation name.</returns>
public static string GetOperationNameForHttpMethod(HttpMethod method) => HttpMethodOperationNameCache.GetOrAdd(method, ConvertHttpMethodToOperationNameRef);

/// <summary>
/// Gets the OpenTelemetry standard method name for a span based on its <see cref="HttpMethod"/>.
/// </summary>
/// <param name="method"><see cref="HttpMethod"/>.</param>
/// <returns>Span method name.</returns>
public static string GetNameForHttpMethod(HttpMethod method) => HttpMethodNameCache.GetOrAdd(method, ConvertHttpMethodToNameRef);

/// <summary>
/// Gets the OpenTelemetry standard uri tag value for a span based on its request <see cref="Uri"/>.
/// </summary>
Expand All @@ -65,10 +31,4 @@ public static string GetUriTagValueFromRequestUri(Uri uri)
(3, 0) => "3",
_ => httpVersion.ToString(),
};

private static string ConvertMethodToOperationName(string method) => $"HTTP {method}";

private static string ConvertHttpMethodToOperationName(HttpMethod method) => $"HTTP {method}";

private static string ConvertHttpMethodToName(HttpMethod method) => method.ToString();
}

0 comments on commit c95f96e

Please sign in to comment.