Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move extensions into owning class namespace & rename add instrumentations ext method #276

Merged
merged 2 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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)
Copy link
Contributor Author

@MikeGoldsmith MikeGoldsmith Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a class in another namespace to find this library can lead to conflicts so we're using a class that's in the Honeycomb.OpenTelemetry namespace.

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