From 51505512cdbaed506955c0f09f1623c706859304 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Mon, 25 Mar 2024 10:35:39 +0000 Subject: [PATCH] Renames and code reorg to prepare for release (#56) * Renames and code reorg to prepare for release * Further renames after syncing on design * Formatting --- examples/Example.Console/Usage.cs | 6 +-- .../OpenTelemetryServicesExtensions.cs | 2 +- .../ServiceCollectionExtensions.cs | 12 ++--- .../Diagnostics/LoggerMessages.cs | 4 +- ...tCompositeLogger.cs => CompositeLogger.cs} | 2 +- .../Elastic.OpenTelemetry.csproj | 5 +- ...lder.cs => ElasticOpenTelemetryBuilder.cs} | 12 ++--- ...ions.cs => ElasticOpenTelemetryOptions.cs} | 6 +-- .../EmptyInstrumentationLifetime.cs | 12 +++++ .../OpenTelemetryBuilderExtensions.cs} | 48 ++++--------------- .../Extensions/ResourceBuilderExtensions.cs | 2 +- .../Hosting/ElasticOtelDistroService.cs | 5 +- ...{IAgent.cs => IInstrumentationLifetime.cs} | 4 +- .../InstrumentationLifetime.cs | 34 +++++++++++++ .../IOpenTelemetryBuilder.cs | 0 .../{Agent.cs => VersionHelper.cs} | 9 ++-- .../LoggingTests.cs | 5 +- .../ServiceCollectionTests.cs | 2 +- .../TransactionIdProcessorTests.cs | 5 +- 19 files changed, 94 insertions(+), 81 deletions(-) rename src/Elastic.OpenTelemetry/Diagnostics/Logging/{AgentCompositeLogger.cs => CompositeLogger.cs} (94%) rename src/Elastic.OpenTelemetry/{AgentBuilder.cs => ElasticOpenTelemetryBuilder.cs} (88%) rename src/Elastic.OpenTelemetry/{AgentBuilderOptions.cs => ElasticOpenTelemetryOptions.cs} (82%) create mode 100644 src/Elastic.OpenTelemetry/EmptyInstrumentationLifetime.cs rename src/Elastic.OpenTelemetry/{AgentBuilder.Build.cs => Extensions/OpenTelemetryBuilderExtensions.cs} (54%) rename src/Elastic.OpenTelemetry/{IAgent.cs => IInstrumentationLifetime.cs} (68%) create mode 100644 src/Elastic.OpenTelemetry/InstrumentationLifetime.cs rename src/Elastic.OpenTelemetry/{ => OpenTelemetry}/IOpenTelemetryBuilder.cs (100%) rename src/Elastic.OpenTelemetry/{Agent.cs => VersionHelper.cs} (78%) diff --git a/examples/Example.Console/Usage.cs b/examples/Example.Console/Usage.cs index d49eb8c..36ec1f0 100644 --- a/examples/Example.Console/Usage.cs +++ b/examples/Example.Console/Usage.cs @@ -22,14 +22,14 @@ public static async Task BasicBuilderUsageAsync() // NOTE: This sample assumes ENV VARs have been set to configure the Endpoint and Authorization header. // Build an agent by creating and using an agent builder, adding a single source (for traces and metrics) defined in this sample application. - await using var agent = new AgentBuilder(ActivitySourceName).Build(); + await using var agent = new ElasticOpenTelemetryBuilder(ActivitySourceName).Build(); // This example adds the application activity source and fully customises the resource - await using var agent3 = new AgentBuilder(ActivitySourceName) + await using var agent3 = new ElasticOpenTelemetryBuilder(ActivitySourceName) .WithTracing(b => b.ConfigureResource(r => r.Clear().AddService("CustomServiceName", serviceVersion: "2.2.2"))) .Build(); - await using var agent4 = new AgentBuilder() + await using var agent4 = new ElasticOpenTelemetryBuilder() .WithTracing(t => t .ConfigureResource(rb => rb.AddService("TracerProviderBuilder", "3.3.3")) .AddRedisInstrumentation() // This can currently only be achieved using this overload or adding Elastic processors to the TPB (as below) diff --git a/src/Elastic.OpenTelemetry/DependencyInjection/OpenTelemetryServicesExtensions.cs b/src/Elastic.OpenTelemetry/DependencyInjection/OpenTelemetryServicesExtensions.cs index 8f84121..cec1fb2 100644 --- a/src/Elastic.OpenTelemetry/DependencyInjection/OpenTelemetryServicesExtensions.cs +++ b/src/Elastic.OpenTelemetry/DependencyInjection/OpenTelemetryServicesExtensions.cs @@ -57,7 +57,7 @@ public static class OpenTelemetryServicesExtensions /// public static global::OpenTelemetry.IOpenTelemetryBuilder AddOpenTelemetry( this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services - , AgentBuilderOptions options + , ElasticOpenTelemetryOptions options ) { if (options.Services == null) diff --git a/src/Elastic.OpenTelemetry/DependencyInjection/ServiceCollectionExtensions.cs b/src/Elastic.OpenTelemetry/DependencyInjection/ServiceCollectionExtensions.cs index 20135c2..6b98d26 100644 --- a/src/Elastic.OpenTelemetry/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/Elastic.OpenTelemetry/DependencyInjection/ServiceCollectionExtensions.cs @@ -21,7 +21,7 @@ public static class ServiceCollectionExtensions /// /// public static IOpenTelemetryBuilder AddElasticOpenTelemetry(this IServiceCollection serviceCollection) => - serviceCollection.AddElasticOpenTelemetry(new AgentBuilderOptions { Services = serviceCollection }); + serviceCollection.AddElasticOpenTelemetry(new ElasticOpenTelemetryOptions { Services = serviceCollection }); /// /// TODO @@ -30,22 +30,22 @@ public static IOpenTelemetryBuilder AddElasticOpenTelemetry(this IServiceCollect /// /// public static IOpenTelemetryBuilder AddElasticOpenTelemetry(this IServiceCollection serviceCollection, params string[]? activitySourceNames) => - serviceCollection.AddElasticOpenTelemetry(new AgentBuilderOptions { Services = serviceCollection, ActivitySources = activitySourceNames ?? [] }); + serviceCollection.AddElasticOpenTelemetry(new ElasticOpenTelemetryOptions { Services = serviceCollection, ActivitySources = activitySourceNames ?? [] }); /// /// TODO /// /// - /// + /// /// - public static IOpenTelemetryBuilder AddElasticOpenTelemetry(this IServiceCollection serviceCollection, AgentBuilderOptions options) + public static IOpenTelemetryBuilder AddElasticOpenTelemetry(this IServiceCollection serviceCollection, ElasticOpenTelemetryOptions options) { if (serviceCollection.Any(d => d.ServiceType == typeof(IHostedService) && d.ImplementationType == typeof(ElasticOtelDistroService))) { // TODO - Can we avoid this by storing the instance on the builder (internal access) var sp = serviceCollection.BuildServiceProvider(); - return sp.GetService()!; //already registered as singleton + return sp.GetService()!; //already registered as singleton } - return new AgentBuilder(options); + return new ElasticOpenTelemetryBuilder(options); } } diff --git a/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs b/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs index 3ca235d..6bee78b 100644 --- a/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs +++ b/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs @@ -26,8 +26,8 @@ internal static partial class LoggerMessages public static void LogAgentPreamble(this ILogger logger) { var process = Process.GetCurrentProcess(); - logger.LogInformation("Elastic OpenTelemetry Distribution: {AgentInformationalVersion}", Agent.InformationalVersion); - if (logger is AgentCompositeLogger agentLogger) + logger.LogInformation("Elastic OpenTelemetry Distribution: {AgentInformationalVersion}", VersionHelper.InformationalVersion); + if (logger is CompositeLogger agentLogger) { if (agentLogger.LogFileEnabled) logger.LogInformation("Elastic OpenTelemetry Distribution, log file: {LogFilePath}", agentLogger.LogFilePath); diff --git a/src/Elastic.OpenTelemetry/Diagnostics/Logging/AgentCompositeLogger.cs b/src/Elastic.OpenTelemetry/Diagnostics/Logging/CompositeLogger.cs similarity index 94% rename from src/Elastic.OpenTelemetry/Diagnostics/Logging/AgentCompositeLogger.cs rename to src/Elastic.OpenTelemetry/Diagnostics/Logging/CompositeLogger.cs index 1675acf..596378c 100644 --- a/src/Elastic.OpenTelemetry/Diagnostics/Logging/AgentCompositeLogger.cs +++ b/src/Elastic.OpenTelemetry/Diagnostics/Logging/CompositeLogger.cs @@ -7,7 +7,7 @@ namespace Elastic.OpenTelemetry.Diagnostics.Logging; /// A composite logger for use inside the agent, will dispose -internal sealed class AgentCompositeLogger(ILogger? additionalLogger) : IDisposable, IAsyncDisposable, ILogger +internal sealed class CompositeLogger(ILogger? additionalLogger) : IDisposable, IAsyncDisposable, ILogger { public FileLogger FileLogger { get; } = new(); diff --git a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj index fa71023..9a6c774 100644 --- a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj +++ b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj @@ -23,8 +23,7 @@ - + @@ -32,7 +31,7 @@ - + diff --git a/src/Elastic.OpenTelemetry/AgentBuilder.cs b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs similarity index 88% rename from src/Elastic.OpenTelemetry/AgentBuilder.cs rename to src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs index 6b01501..46f3e70 100644 --- a/src/Elastic.OpenTelemetry/AgentBuilder.cs +++ b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs @@ -16,27 +16,27 @@ namespace Elastic.OpenTelemetry; /// -/// Supports building instances which include Elastic defaults, but can also be customised. +/// Supports building instances which include Elastic defaults, but can also be customised. /// -public class AgentBuilder : IOpenTelemetryBuilder +public class ElasticOpenTelemetryBuilder : IOpenTelemetryBuilder { - internal AgentCompositeLogger Logger { get; } + internal CompositeLogger Logger { get; } internal LoggingEventListener EventListener { get; } /// public IServiceCollection Services { get; } /// TODO - public AgentBuilder(params string[] activitySourceNames) : this(new AgentBuilderOptions + public ElasticOpenTelemetryBuilder(params string[] activitySourceNames) : this(new ElasticOpenTelemetryOptions { ActivitySources = activitySourceNames }) { } /// TODO - public AgentBuilder(AgentBuilderOptions options) + public ElasticOpenTelemetryBuilder(ElasticOpenTelemetryOptions options) { - Logger = new AgentCompositeLogger(options.Logger); + Logger = new CompositeLogger(options.Logger); // Enables logging of OpenTelemetry-SDK event source events EventListener = new LoggingEventListener(Logger); diff --git a/src/Elastic.OpenTelemetry/AgentBuilderOptions.cs b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryOptions.cs similarity index 82% rename from src/Elastic.OpenTelemetry/AgentBuilderOptions.cs rename to src/Elastic.OpenTelemetry/ElasticOpenTelemetryOptions.cs index 23f5520..b35363b 100644 --- a/src/Elastic.OpenTelemetry/AgentBuilderOptions.cs +++ b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryOptions.cs @@ -9,9 +9,9 @@ namespace Elastic.OpenTelemetry; /// -/// Expert options to provide to to control its initial OpenTelemetry registration +/// Expert options to provide to to control its initial OpenTelemetry registration /// -public record AgentBuilderOptions +public record ElasticOpenTelemetryOptions { /// /// Provide an additional logger to the internal file logger. @@ -34,7 +34,7 @@ public record AgentBuilderOptions public string[] ActivitySources { get; init; } = []; /// - /// Stops to register OLTP exporters, useful for testing scenarios + /// Stops to register OLTP exporters, useful for testing scenarios /// public bool SkipOtlpExporter { get; init; } diff --git a/src/Elastic.OpenTelemetry/EmptyInstrumentationLifetime.cs b/src/Elastic.OpenTelemetry/EmptyInstrumentationLifetime.cs new file mode 100644 index 0000000..a32c35b --- /dev/null +++ b/src/Elastic.OpenTelemetry/EmptyInstrumentationLifetime.cs @@ -0,0 +1,12 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +namespace Elastic.OpenTelemetry; + +internal class EmptyInstrumentationLifetime : IInstrumentationLifetime +{ + public void Dispose() { } + + public ValueTask DisposeAsync() => default; +} diff --git a/src/Elastic.OpenTelemetry/AgentBuilder.Build.cs b/src/Elastic.OpenTelemetry/Extensions/OpenTelemetryBuilderExtensions.cs similarity index 54% rename from src/Elastic.OpenTelemetry/AgentBuilder.Build.cs rename to src/Elastic.OpenTelemetry/Extensions/OpenTelemetryBuilderExtensions.cs index 73f2810..b0b4947 100644 --- a/src/Elastic.OpenTelemetry/AgentBuilder.Build.cs +++ b/src/Elastic.OpenTelemetry/Extensions/OpenTelemetryBuilderExtensions.cs @@ -10,7 +10,7 @@ using OpenTelemetry.Metrics; using OpenTelemetry.Trace; -namespace Elastic.OpenTelemetry; +namespace Elastic.OpenTelemetry.Extensions; /// TODO public static class OpenTelemetryBuilderExtensions @@ -18,25 +18,24 @@ public static class OpenTelemetryBuilderExtensions /// TODO public static IOpenTelemetryBuilder WithLogger(this IOpenTelemetryBuilder builder, ILogger logger) { - if (builder is not AgentBuilder agentBuilder) + if (builder is not ElasticOpenTelemetryBuilder agentBuilder) return builder; agentBuilder.Logger.SetAdditionalLogger(logger); return agentBuilder; } - /// - /// Build an instance of . + /// Build an instance of . /// - /// A new instance of . - public static IAgent Build(this IOpenTelemetryBuilder builder, ILogger? logger = null, IServiceProvider? serviceProvider = null) + /// A new instance of . + public static IInstrumentationLifetime Build(this IOpenTelemetryBuilder builder, ILogger? logger = null, IServiceProvider? serviceProvider = null) { // this happens if someone calls Build() while using IServiceCollection and AddOpenTelemetry() and NOT Add*Elastic*OpenTelemetry() // we treat this a NOOP // NOTE for AddElasticOpenTelemetry(this IServiceCollection services) calling Build() manually is NOT required. - if (builder is not AgentBuilder agentBuilder) - return new EmptyAgent(); + if (builder is not ElasticOpenTelemetryBuilder agentBuilder) + return new EmptyInstrumentationLifetime(); var log = agentBuilder.Logger; @@ -46,40 +45,9 @@ public static IAgent Build(this IOpenTelemetryBuilder builder, ILogger? logger = var tracerProvider = sp.GetService()!; var meterProvider = sp.GetService()!; - var agent = new ElasticAgent(log, agentBuilder.EventListener, tracerProvider, meterProvider); + var agent = new InstrumentationLifetime(log, agentBuilder.EventListener, tracerProvider, meterProvider); log.LogAgentBuilderBuiltAgent(); return agent; } } -internal class EmptyAgent : IAgent -{ - public void Dispose() { } - - public ValueTask DisposeAsync() => default; -} - -internal class ElasticAgent( - AgentCompositeLogger logger, - LoggingEventListener loggingEventListener, - TracerProvider tracerProvider, - MeterProvider meterProvider -) : IAgent -{ - public void Dispose() - { - tracerProvider.Dispose(); - meterProvider.Dispose(); - loggingEventListener.Dispose(); - logger.Dispose(); - } - - public async ValueTask DisposeAsync() - { - tracerProvider.Dispose(); - meterProvider.Dispose(); - await loggingEventListener.DisposeAsync().ConfigureAwait(false); - await logger.DisposeAsync().ConfigureAwait(false); - } -} - diff --git a/src/Elastic.OpenTelemetry/Extensions/ResourceBuilderExtensions.cs b/src/Elastic.OpenTelemetry/Extensions/ResourceBuilderExtensions.cs index 7254aeb..d002d17 100644 --- a/src/Elastic.OpenTelemetry/Extensions/ResourceBuilderExtensions.cs +++ b/src/Elastic.OpenTelemetry/Extensions/ResourceBuilderExtensions.cs @@ -13,6 +13,6 @@ internal static ResourceBuilder AddDistroAttributes(this ResourceBuilder builder builder.AddAttributes(new Dictionary { { ResourceSemanticConventions.AttributeTelemetryDistroName, "elastic-dotnet" }, - { ResourceSemanticConventions.AttributeTelemetryDistroVersion, Agent.InformationalVersion } + { ResourceSemanticConventions.AttributeTelemetryDistroVersion, VersionHelper.InformationalVersion } }); } diff --git a/src/Elastic.OpenTelemetry/Hosting/ElasticOtelDistroService.cs b/src/Elastic.OpenTelemetry/Hosting/ElasticOtelDistroService.cs index 1125870..106ca50 100644 --- a/src/Elastic.OpenTelemetry/Hosting/ElasticOtelDistroService.cs +++ b/src/Elastic.OpenTelemetry/Hosting/ElasticOtelDistroService.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using Elastic.OpenTelemetry.Extensions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -10,14 +11,14 @@ namespace Elastic.OpenTelemetry.Hosting; internal sealed class ElasticOtelDistroService(IServiceProvider serviceProvider) : IHostedLifecycleService { - private IAgent? _agent; + private IInstrumentationLifetime? _agent; public Task StartingAsync(CancellationToken cancellationToken) { var loggerFactory = serviceProvider.GetService(); var logger = loggerFactory?.CreateLogger($"{nameof(Elastic)}.{nameof(OpenTelemetry)}"); - _agent = serviceProvider.GetRequiredService().Build(logger, serviceProvider); + _agent = serviceProvider.GetRequiredService().Build(logger, serviceProvider); //logger.LogInformation("Initialising Agent.Current."); //Agent.SetAgent(_agent, logger); diff --git a/src/Elastic.OpenTelemetry/IAgent.cs b/src/Elastic.OpenTelemetry/IInstrumentationLifetime.cs similarity index 68% rename from src/Elastic.OpenTelemetry/IAgent.cs rename to src/Elastic.OpenTelemetry/IInstrumentationLifetime.cs index 410eb03..754da59 100644 --- a/src/Elastic.OpenTelemetry/IAgent.cs +++ b/src/Elastic.OpenTelemetry/IInstrumentationLifetime.cs @@ -4,6 +4,6 @@ namespace Elastic.OpenTelemetry; /// -/// An Elastic OpenTelemetry Distribution agent. +/// A logical Elastic OpenTelemetry Distribution. /// -public interface IAgent : IDisposable, IAsyncDisposable; +public interface IInstrumentationLifetime : IDisposable, IAsyncDisposable; diff --git a/src/Elastic.OpenTelemetry/InstrumentationLifetime.cs b/src/Elastic.OpenTelemetry/InstrumentationLifetime.cs new file mode 100644 index 0000000..4377738 --- /dev/null +++ b/src/Elastic.OpenTelemetry/InstrumentationLifetime.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +using Elastic.OpenTelemetry.Diagnostics; +using Elastic.OpenTelemetry.Diagnostics.Logging; +using OpenTelemetry.Metrics; +using OpenTelemetry.Trace; + +namespace Elastic.OpenTelemetry; + +internal class InstrumentationLifetime( + CompositeLogger logger, + LoggingEventListener loggingEventListener, + TracerProvider tracerProvider, + MeterProvider meterProvider +) : IInstrumentationLifetime +{ + public void Dispose() + { + tracerProvider.Dispose(); + meterProvider.Dispose(); + loggingEventListener.Dispose(); + logger.Dispose(); + } + + public async ValueTask DisposeAsync() + { + tracerProvider.Dispose(); + meterProvider.Dispose(); + await loggingEventListener.DisposeAsync().ConfigureAwait(false); + await logger.DisposeAsync().ConfigureAwait(false); + } +} diff --git a/src/Elastic.OpenTelemetry/IOpenTelemetryBuilder.cs b/src/Elastic.OpenTelemetry/OpenTelemetry/IOpenTelemetryBuilder.cs similarity index 100% rename from src/Elastic.OpenTelemetry/IOpenTelemetryBuilder.cs rename to src/Elastic.OpenTelemetry/OpenTelemetry/IOpenTelemetryBuilder.cs diff --git a/src/Elastic.OpenTelemetry/Agent.cs b/src/Elastic.OpenTelemetry/VersionHelper.cs similarity index 78% rename from src/Elastic.OpenTelemetry/Agent.cs rename to src/Elastic.OpenTelemetry/VersionHelper.cs index ceaaf52..3cec814 100644 --- a/src/Elastic.OpenTelemetry/Agent.cs +++ b/src/Elastic.OpenTelemetry/VersionHelper.cs @@ -5,14 +5,11 @@ namespace Elastic.OpenTelemetry; -/// -/// Supports building and accessing an which collects and ships observability signals. -/// -public static class Agent +internal static class VersionHelper { - static Agent() + static VersionHelper() { - var assemblyInformationalVersion = typeof(Agent).Assembly.GetCustomAttribute()?.InformationalVersion; + var assemblyInformationalVersion = typeof(VersionHelper).Assembly.GetCustomAttribute()?.InformationalVersion; InformationalVersion = ParseAssemblyInformationalVersion(assemblyInformationalVersion); } diff --git a/tests/Elastic.OpenTelemetry.Tests/LoggingTests.cs b/tests/Elastic.OpenTelemetry.Tests/LoggingTests.cs index 5033eba..4aae474 100644 --- a/tests/Elastic.OpenTelemetry.Tests/LoggingTests.cs +++ b/tests/Elastic.OpenTelemetry.Tests/LoggingTests.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using Elastic.OpenTelemetry.Extensions; using OpenTelemetry; using Xunit.Abstractions; @@ -13,12 +14,12 @@ public class LoggingTests(ITestOutputHelper output) public async Task ObserveLogging() { var logger = new TestLogger(output); - var options = new AgentBuilderOptions { Logger = logger, SkipOtlpExporter = true }; + var options = new ElasticOpenTelemetryOptions { Logger = logger, SkipOtlpExporter = true }; const string activitySourceName = nameof(ObserveLogging); var activitySource = new ActivitySource(activitySourceName, "1.0.0"); - await using (new AgentBuilder(options) + await using (new ElasticOpenTelemetryBuilder(options) .WithTracing(tpb => tpb .ConfigureResource(rb => rb.AddService("Test", "1.0.0")) .AddSource(activitySourceName) diff --git a/tests/Elastic.OpenTelemetry.Tests/ServiceCollectionTests.cs b/tests/Elastic.OpenTelemetry.Tests/ServiceCollectionTests.cs index d7d2666..144956e 100644 --- a/tests/Elastic.OpenTelemetry.Tests/ServiceCollectionTests.cs +++ b/tests/Elastic.OpenTelemetry.Tests/ServiceCollectionTests.cs @@ -13,7 +13,7 @@ public class ServiceCollectionTests(ITestOutputHelper output) [Fact] public async Task ServiceCollectionAddIsSafeToCallMultipleTimes() { - var options = new AgentBuilderOptions { Logger = new TestLogger(output), SkipOtlpExporter = true }; + var options = new ElasticOpenTelemetryOptions { Logger = new TestLogger(output), SkipOtlpExporter = true }; const string activitySourceName = nameof(ServiceCollectionAddIsSafeToCallMultipleTimes); var activitySource = new ActivitySource(activitySourceName, "1.0.0"); diff --git a/tests/Elastic.OpenTelemetry.Tests/TransactionIdProcessorTests.cs b/tests/Elastic.OpenTelemetry.Tests/TransactionIdProcessorTests.cs index a2173e8..6da3d94 100644 --- a/tests/Elastic.OpenTelemetry.Tests/TransactionIdProcessorTests.cs +++ b/tests/Elastic.OpenTelemetry.Tests/TransactionIdProcessorTests.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using Elastic.OpenTelemetry.Extensions; using OpenTelemetry; using Xunit.Abstractions; @@ -12,14 +13,14 @@ public class TransactionIdProcessorTests(ITestOutputHelper output) [Fact] public void TransactionId_IsAddedToTags() { - var options = new AgentBuilderOptions { Logger = new TestLogger(output), SkipOtlpExporter = true }; + var options = new ElasticOpenTelemetryOptions { Logger = new TestLogger(output), SkipOtlpExporter = true }; const string activitySourceName = nameof(TransactionId_IsAddedToTags); var activitySource = new ActivitySource(activitySourceName, "1.0.0"); var exportedItems = new List(); - using var agent = new AgentBuilder(options) + using var agent = new ElasticOpenTelemetryBuilder(options) .WithTracing(tpb => { tpb