Skip to content

Commit

Permalink
Move extensions into owning class namespace & rename add instrumentat…
Browse files Browse the repository at this point in the history
…ions ext method (#276)
  • Loading branch information
MikeGoldsmith authored Sep 26, 2022
1 parent 2af039e commit c023766
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Npgsql;
using OpenTelemetry.Trace;

namespace Honeycomb.OpenTelemetry.AutoInstrumentations
namespace OpenTelemetry.Trace
{
/// <summary>
/// Extension methods to add instrumentation support for many common instrumentation packages.
Expand All @@ -13,7 +12,7 @@ public static class TracerProviderBuilderExtensions
/// </summary>
/// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
/// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
public static TracerProviderBuilder AddAllInstrumentation(this TracerProviderBuilder builder)
public static TracerProviderBuilder AddAutoInstrumentations(this TracerProviderBuilder builder)
{
return
builder
Expand Down
4 changes: 2 additions & 2 deletions src/Honeycomb.OpenTelemetry/MeterProviderBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using OpenTelemetry.Metrics;
using Honeycomb.OpenTelemetry;
using OpenTelemetry.Resources;
using System;

namespace Honeycomb.OpenTelemetry
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Extension methods to configure <see cref="MeterProviderBuilder"/> to send metrics telemetry data to Honeycomb.
Expand Down
7 changes: 3 additions & 4 deletions src/Honeycomb.OpenTelemetry/ResourceBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using OpenTelemetry.Resources;
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Reflection;

namespace Honeycomb.OpenTelemetry
namespace OpenTelemetry.Resources
{
/// <summary>
/// Extension methods to configure <see cref="ResourceBuilder"/> with Honeycomb distro attributes.
Expand Down Expand Up @@ -111,7 +110,7 @@ private static ResourceBuilder AddOSResource(this ResourceBuilder builder)

private static string GetFileVersion()
{
var version = typeof(ResourceBuilderExtensions)
var version = typeof(Honeycomb.OpenTelemetry.HoneycombOptions)
.Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion;
Expand All @@ -120,7 +119,7 @@ private static string GetFileVersion()
// the form `{version_prefix}{version_suffix}+{commit_hash}`.
// We should trim the hash if present to just leave the version prefix and suffix
var i = version.IndexOf("+");
return i > 0
return i > 0
? version.Substring(0, i)
: version;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using Honeycomb.OpenTelemetry;
using Microsoft.Extensions.Configuration;
using OpenTelemetry;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using System;

#if NET462
using System.Collections.Generic;
#endif

namespace Honeycomb.OpenTelemetry
namespace OpenTelemetry.Trace
{
/// <summary>
/// Extension methods to configure <see cref="TracerProviderBuilder"/> to send telemetry data to Honeycomb.
Expand Down

0 comments on commit c023766

Please sign in to comment.