diff --git a/build/Common.nonprod.props b/build/Common.nonprod.props
index 7e5700a3f8..17782e9532 100644
--- a/build/Common.nonprod.props
+++ b/build/Common.nonprod.props
@@ -27,9 +27,9 @@
$(OpenTelemetryCoreLatestVersion)
$(OpenTelemetryCoreLatestPrereleaseVersion)
net8.0;net7.0;net6.0
- [2.5.0,3.0)
- [2.5.0,3.0)
- [1.5.48,2.0)
+ [2.8.1,3.0)
+ [2.8.1,3.0)
+ [1.5.58,2.0)
diff --git a/build/scripts/post-release.psm1 b/build/scripts/post-release.psm1
index 63cdd1a99a..0cc7e96fd7 100644
--- a/build/scripts/post-release.psm1
+++ b/build/scripts/post-release.psm1
@@ -29,7 +29,7 @@ function CreateRelease {
foreach ($line in $changelogContent)
{
- if ($line -like "## $packageVersion" -and $started -ne $true)
+ if ($line -like "## $version" -and $started -ne $true)
{
$started = $true
}
diff --git a/src/OpenTelemetry.Exporter.OneCollector/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.OneCollector/.publicApi/PublicAPI.Unshipped.txt
index e69de29bb2..9700b06ef0 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/.publicApi/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Exporter.OneCollector/.publicApi/PublicAPI.Unshipped.txt
@@ -0,0 +1,8 @@
+OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder) -> OpenTelemetry.Logs.LoggerProviderBuilder!
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder, Microsoft.Extensions.Configuration.IConfiguration! configuration) -> OpenTelemetry.Logs.LoggerProviderBuilder!
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder, Microsoft.Extensions.Configuration.IConfiguration! configuration, System.Action! configure) -> OpenTelemetry.Logs.LoggerProviderBuilder!
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder, string! connectionString) -> OpenTelemetry.Logs.LoggerProviderBuilder!
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder, string! connectionString, System.Action! configure) -> OpenTelemetry.Logs.LoggerProviderBuilder!
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder, string? name, string? connectionString, Microsoft.Extensions.Configuration.IConfiguration? configuration, System.Action? configure) -> OpenTelemetry.Logs.LoggerProviderBuilder!
+static OpenTelemetry.Logs.OneCollectorLoggerProviderBuilderExtensions.AddOneCollectorExporter(this OpenTelemetry.Logs.LoggerProviderBuilder! builder, System.Action! configure) -> OpenTelemetry.Logs.LoggerProviderBuilder!
diff --git a/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md b/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md
index 6781b8e445..f3ad78eb10 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md
@@ -2,6 +2,16 @@
## Unreleased
+## 1.9.0-rc.1
+
+Released 2024-Jun-11
+
+* Update OpenTelemetry SDK version to `1.9.0-rc.1`.
+ ([#1876](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1876))
+
+* Added `LoggerProviderBuilder.AddOneCollectorExporter` registration extension.
+ ([#1876](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1876))
+
## 1.8.0
Released 2024-Apr-22
diff --git a/src/OpenTelemetry.Exporter.OneCollector/Internal/Serialization/LogRecordCommonSchemaJsonSerializer.cs b/src/OpenTelemetry.Exporter.OneCollector/Internal/Serialization/LogRecordCommonSchemaJsonSerializer.cs
index 6edcaba58b..33ac460af9 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/Internal/Serialization/LogRecordCommonSchemaJsonSerializer.cs
+++ b/src/OpenTelemetry.Exporter.OneCollector/Internal/Serialization/LogRecordCommonSchemaJsonSerializer.cs
@@ -114,7 +114,14 @@ protected override void SerializeItemToJson(Resource resource, LogRecord item, C
writer.WriteNumber(EventIdProperty, item.EventId.Id);
}
+#if EXPOSE_EXPERIMENTAL_FEATURES
+#pragma warning disable CS0618 // Type or member is obsolete
+ // TODO: Update to use LogRecord.Severity
var logLevel = (int)item.LogLevel;
+#pragma warning restore CS0618 // Type or member is obsolete
+#else
+ var logLevel = (int)item.LogLevel;
+#endif
writer.WriteString(SeverityTextProperty, LogLevelToSeverityTextMappings[logLevel]);
writer.WriteNumber(SeverityNumberProperty, LogLevelToSeverityNumberMappings[logLevel]);
diff --git a/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLogExportProcessorBuilder.cs b/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLogExportProcessorBuilder.cs
index 659a56e5c7..3e61545d34 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLogExportProcessorBuilder.cs
+++ b/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLogExportProcessorBuilder.cs
@@ -1,10 +1,10 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
-#if NETFRAMEWORK
-using System.Net.Http;
-#endif
+using System.Diagnostics;
using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
using OpenTelemetry.Exporter.OneCollector;
using OpenTelemetry.Internal;
@@ -17,19 +17,34 @@ namespace OpenTelemetry.Logs;
///
public sealed class OneCollectorLogExportProcessorBuilder
{
- private static readonly Func DefaultHttpClientFactory = () => new HttpClient();
- private readonly OneCollectorLogExporterOptions exporterOptions = new();
- private readonly BatchExportProcessorOptions batchOptions = new();
- private readonly List>> configureExporterActions = new();
- private Func? httpClientFactory;
+ private readonly string? name;
+ private readonly IServiceCollection services;
+ private readonly bool ownsServices;
internal OneCollectorLogExportProcessorBuilder(
+ string? name,
+ IServiceCollection? services,
IConfiguration? configuration)
{
+ this.name = name;
+
+ if (services == null)
+ {
+ this.services = new ServiceCollection();
+ this.services.AddOptions();
+ this.ownsServices = true;
+ }
+ else
+ {
+ this.services = services;
+ }
+
if (configuration != null)
{
- configuration.Bind(this.exporterOptions);
- configuration.GetSection("BatchOptions").Bind(this.batchOptions);
+ this.services.Configure(this.name, configuration);
+ this.services.Configure(
+ this.name,
+ batchOptions => configuration.GetSection("BatchOptions").Bind(batchOptions));
}
}
@@ -47,7 +62,9 @@ public OneCollectorLogExportProcessorBuilder ConfigureBatchOptions(
{
Guard.ThrowIfNull(configure);
- configure(this.batchOptions);
+ this.services.Configure(
+ this.name,
+ batchOptions => configure(batchOptions));
return this;
}
@@ -66,7 +83,10 @@ public OneCollectorLogExportProcessorBuilder ConfigureExporter(
{
Guard.ThrowIfNull(configure);
- this.configureExporterActions.Add(configure);
+ this.services.AddSingleton(
+ new ConfigureOneCollectorExporter(
+ this.name,
+ (sp, e) => configure(e)));
return this;
}
@@ -86,7 +106,9 @@ public OneCollectorLogExportProcessorBuilder ConfigureSerializationOptions(
{
Guard.ThrowIfNull(configure);
- configure(this.exporterOptions.SerializationOptions);
+ this.services.Configure(
+ this.name,
+ exporterOptions => configure(exporterOptions.SerializationOptions));
return this;
}
@@ -105,7 +127,9 @@ public OneCollectorLogExportProcessorBuilder ConfigureTransportOptions(
{
Guard.ThrowIfNull(configure);
- configure(this.exporterOptions.TransportOptions);
+ this.services.Configure(
+ this.name,
+ exporterOptions => configure(exporterOptions.TransportOptions));
return this;
}
@@ -126,7 +150,9 @@ public OneCollectorLogExportProcessorBuilder SetConnectionString(
{
Guard.ThrowIfNullOrWhitespace(connectionString);
- this.exporterOptions.ConnectionString = connectionString;
+ this.services.Configure(
+ this.name,
+ exporterOptions => exporterOptions.ConnectionString = connectionString);
return this;
}
@@ -148,61 +174,62 @@ public OneCollectorLogExportProcessorBuilder SetDefaultEventName(
{
Guard.ThrowIfNullOrWhitespace(defaultEventName);
- this.exporterOptions.DefaultEventName = defaultEventName;
+ this.services.Configure(
+ this.name,
+ exporterOptions => exporterOptions.DefaultEventName = defaultEventName);
return this;
}
- ///
- /// Sets the factory function called to create the
- /// instance that will be used at runtime to transmit telemetry over HTTP
- /// transports. The returned instance will be reused for all export
- /// invocations.
- ///
- ///
- /// Note: The default behavior is an will be
- /// instantiated directly.
- ///
- /// Factory function which returns the instance to use.
- /// The supplied for call
- /// chaining.
- internal OneCollectorLogExportProcessorBuilder SetHttpClientFactory(
- Func httpClientFactory)
+ internal BaseProcessor BuildProcessor(
+ IServiceProvider serviceProvider)
{
- Guard.ThrowIfNull(httpClientFactory);
+ Debug.Assert(serviceProvider != null, "serviceProvider was null");
- this.httpClientFactory = httpClientFactory;
+ ServiceProvider? ownedServiceProvider = null;
+ if (this.ownsServices)
+ {
+ ownedServiceProvider = this.services.BuildServiceProvider();
+ }
- return this;
- }
+ var exporterOptions = (ownedServiceProvider ?? serviceProvider!).GetRequiredService>().Get(this.name);
+ var batchOptions = (ownedServiceProvider ?? serviceProvider!).GetRequiredService>().Get(this.name);
- internal BaseProcessor BuildProcessor()
- {
+ try
+ {
#pragma warning disable CA2000 // Dispose objects before losing scope
- return new BatchLogRecordExportProcessor(
- this.BuildExporter(),
- this.batchOptions.MaxQueueSize,
- this.batchOptions.ScheduledDelayMilliseconds,
- this.batchOptions.ExporterTimeoutMilliseconds,
- this.batchOptions.MaxExportBatchSize);
+ return new BatchLogRecordExportProcessor(
+ CreateExporter(this.name, serviceProvider!, exporterOptions, (ownedServiceProvider ?? serviceProvider!).GetServices()),
+ batchOptions.MaxQueueSize,
+ batchOptions.ScheduledDelayMilliseconds,
+ batchOptions.ExporterTimeoutMilliseconds,
+ batchOptions.MaxExportBatchSize);
#pragma warning restore CA2000 // Dispose objects before losing scope
+ }
+ finally
+ {
+ ownedServiceProvider?.Dispose();
+ }
}
- private OneCollectorExporter BuildExporter()
+ private static OneCollectorExporter CreateExporter(
+ string? name,
+ IServiceProvider serviceProvider,
+ OneCollectorLogExporterOptions exporterOptions,
+ IEnumerable configurations)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
- var exporter = new OneCollectorExporter(this.CreateSink());
+ var exporter = new OneCollectorExporter(CreateSink(exporterOptions));
#pragma warning restore CA2000 // Dispose objects before losing scope
try
{
- int index = 0;
- while (index < this.configureExporterActions.Count)
+ foreach (var configuration in configurations)
{
- var action = this.configureExporterActions[index++];
- action(exporter);
+ if (name == configuration.Name)
+ {
+ configuration.Configure(serviceProvider, exporter);
+ }
}
}
catch
@@ -214,27 +241,40 @@ private OneCollectorExporter BuildExporter()
return exporter;
}
- private WriteDirectlyToTransportSink CreateSink()
+ private static WriteDirectlyToTransportSink CreateSink(OneCollectorLogExporterOptions exporterOptions)
{
- this.exporterOptions.Validate();
-
- var transportOptions = this.exporterOptions.TransportOptions;
+ exporterOptions.Validate();
- var httpClient = (this.httpClientFactory ?? DefaultHttpClientFactory)() ?? throw new NotSupportedException("HttpClientFactory cannot return a null instance.");
+ var transportOptions = exporterOptions.TransportOptions;
#pragma warning disable CA2000 // Dispose objects before losing scope
return new WriteDirectlyToTransportSink(
new LogRecordCommonSchemaJsonSerializer(
- new EventNameManager(this.exporterOptions.DefaultEventNamespace, this.exporterOptions.DefaultEventName),
- this.exporterOptions.TenantToken!,
- this.exporterOptions.SerializationOptions.ExceptionStackTraceHandling,
+ new EventNameManager(exporterOptions.DefaultEventNamespace, exporterOptions.DefaultEventName),
+ exporterOptions.TenantToken!,
+ exporterOptions.SerializationOptions.ExceptionStackTraceHandling,
transportOptions.MaxPayloadSizeInBytes == -1 ? int.MaxValue : transportOptions.MaxPayloadSizeInBytes,
transportOptions.MaxNumberOfItemsPerPayload == -1 ? int.MaxValue : transportOptions.MaxNumberOfItemsPerPayload),
new HttpJsonPostTransport(
- this.exporterOptions.InstrumentationKey!,
+ exporterOptions.InstrumentationKey!,
transportOptions.Endpoint,
transportOptions.HttpCompression,
- new HttpClientWrapper(httpClient)));
+ new HttpClientWrapper(transportOptions.GetHttpClient())));
#pragma warning restore CA2000 // Dispose objects before losing scope
}
+
+ private sealed class ConfigureOneCollectorExporter
+ {
+ public ConfigureOneCollectorExporter(
+ string? name,
+ Action> configure)
+ {
+ this.Name = name;
+ this.Configure = configure;
+ }
+
+ public string? Name { get; }
+
+ public Action> Configure { get; }
+ }
}
diff --git a/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLoggerProviderBuilderExtensions.cs b/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLoggerProviderBuilderExtensions.cs
new file mode 100644
index 0000000000..5ac3e607c5
--- /dev/null
+++ b/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorLoggerProviderBuilderExtensions.cs
@@ -0,0 +1,174 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+using Microsoft.Extensions.Configuration;
+using OpenTelemetry.Exporter.OneCollector;
+using OpenTelemetry.Internal;
+
+namespace OpenTelemetry.Logs;
+
+///
+/// Contains extension methods to register the OneCollector log exporter.
+///
+public static class OneCollectorLoggerProviderBuilderExtensions
+{
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ /// .
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder)
+ {
+ return AddOneCollectorExporter(builder, name: null, connectionString: null, configuration: null, configure: null);
+ }
+
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ /// .
+ /// Callback action for configuring .
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder,
+ Action configure)
+ {
+ Guard.ThrowIfNull(configure);
+
+ return AddOneCollectorExporter(builder, name: null, connectionString: null, configuration: null, configure);
+ }
+
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ /// .
+ /// OneCollector connection string.
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder,
+ string connectionString)
+ {
+ Guard.ThrowIfNullOrWhitespace(connectionString);
+
+ return AddOneCollectorExporter(builder, name: null, connectionString, configuration: null, configure: null);
+ }
+
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ /// .
+ /// OneCollector connection string.
+ /// Callback action for configuring .
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder,
+ string connectionString,
+ Action configure)
+ {
+ Guard.ThrowIfNullOrWhitespace(connectionString);
+ Guard.ThrowIfNull(configure);
+
+ return AddOneCollectorExporter(builder, name: null, connectionString, configuration: null, configure);
+ }
+
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ /// Note: Batch options () are bound to the "BatchOptions"
+ /// sub-section of the supplied in the
+ /// parameter.
+ /// .
+ /// Configuration used to build and .
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder,
+ IConfiguration configuration)
+ {
+ Guard.ThrowIfNull(configuration);
+
+ return AddOneCollectorExporter(builder, name: null, connectionString: null, configuration, configure: null);
+ }
+
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ ///
+ /// .
+ ///
+ /// Callback action for configuring .
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder,
+ IConfiguration configuration,
+ Action configure)
+ {
+ Guard.ThrowIfNull(configuration);
+ Guard.ThrowIfNull(configure);
+
+ return AddOneCollectorExporter(builder, name: null, connectionString: null, configuration, configure);
+ }
+
+ ///
+ /// Add OneCollector exporter to the .
+ ///
+ ///
+ /// .
+ /// Optional name which is used when retrieving
+ /// options.
+ /// Optional OneCollector connection
+ /// string.
+ /// Optional configuration used to build and .
+ /// Optional callback action for configuring .
+ /// The supplied for call
+ /// chaining.
+ public static LoggerProviderBuilder AddOneCollectorExporter(
+ this LoggerProviderBuilder builder,
+ string? name,
+ string? connectionString,
+ IConfiguration? configuration,
+ Action? configure)
+ {
+ Guard.ThrowIfNull(builder);
+
+ return builder.ConfigureServices(services =>
+ {
+ var processorBuilder = new OneCollectorLogExportProcessorBuilder(name, services, configuration);
+
+ if (!string.IsNullOrWhiteSpace(connectionString))
+ {
+ processorBuilder.SetConnectionString(connectionString!);
+ }
+
+ configure?.Invoke(processorBuilder);
+
+ builder.AddProcessor(processorBuilder.BuildProcessor);
+ });
+ }
+}
diff --git a/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorOpenTelemetryLoggerOptionsExtensions.cs b/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorOpenTelemetryLoggerOptionsExtensions.cs
index 1b4287def2..36169f0cc5 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorOpenTelemetryLoggerOptionsExtensions.cs
+++ b/src/OpenTelemetry.Exporter.OneCollector/Logs/OneCollectorOpenTelemetryLoggerOptionsExtensions.cs
@@ -123,7 +123,7 @@ private static OpenTelemetryLoggerOptions AddOneCollectorExporter(
{
Guard.ThrowIfNull(options);
- var builder = new OneCollectorLogExportProcessorBuilder(configuration);
+ var builder = new OneCollectorLogExportProcessorBuilder(name: null, services: null, configuration);
if (!string.IsNullOrWhiteSpace(connectionString))
{
@@ -132,10 +132,7 @@ private static OpenTelemetryLoggerOptions AddOneCollectorExporter(
configure?.Invoke(builder);
-#pragma warning disable CA2000 // Dispose objects before losing scope
- options.AddProcessor(
- builder.BuildProcessor());
-#pragma warning restore CA2000 // Dispose objects before losing scope
+ options.AddProcessor(builder.BuildProcessor);
return options;
}
diff --git a/src/OpenTelemetry.Exporter.OneCollector/OneCollectorExporterTransportOptions.cs b/src/OpenTelemetry.Exporter.OneCollector/OneCollectorExporterTransportOptions.cs
index 6f818948a5..28a14abb53 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/OneCollectorExporterTransportOptions.cs
+++ b/src/OpenTelemetry.Exporter.OneCollector/OneCollectorExporterTransportOptions.cs
@@ -2,6 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
using System.ComponentModel.DataAnnotations;
+#if NETFRAMEWORK
+using System.Net.Http;
+#endif
namespace OpenTelemetry.Exporter.OneCollector;
@@ -14,6 +17,8 @@ public sealed class OneCollectorExporterTransportOptions
internal const int DefaultMaxPayloadSizeInBytes = 1024 * 1024 * 4;
internal const int DefaultMaxNumberOfItemsPerPayload = 1500;
+ private static readonly Func DefaultHttpClientFactory = () => new HttpClient();
+
internal OneCollectorExporterTransportOptions()
{
}
@@ -59,6 +64,23 @@ internal OneCollectorExporterTransportOptions()
///
internal OneCollectorExporterHttpTransportCompressionType HttpCompression { get; set; } = OneCollectorExporterHttpTransportCompressionType.Deflate;
+ ///
+ /// Gets or sets the factory function called to create the instance that will be used at runtime to transmit
+ /// telemetry over HTTP transports. The returned instance will be reused for
+ /// all export invocations.
+ ///
+ ///
+ /// Note: The default behavior is an will be
+ /// instantiated directly.
+ ///
+ internal Func? HttpClientFactory { get; set; }
+
+ internal HttpClient GetHttpClient()
+ {
+ return (this.HttpClientFactory ?? DefaultHttpClientFactory)() ?? throw new NotSupportedException("HttpClientFactory cannot return a null instance.");
+ }
+
internal void Validate()
{
if (this.Endpoint == null)
diff --git a/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj b/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj
index 8aceaff990..3a3a2cffb9 100644
--- a/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj
+++ b/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj
@@ -18,8 +18,13 @@
1.8.0
+
+ $(OpenTelemetryCoreLatestPrereleaseVersion)
+ $(DefineConstants);EXPOSE_EXPERIMENTAL_FEATURES
+
+
-
+
diff --git a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md
index d1433f2e15..a8de77fcd7 100644
--- a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+* Added `rpc.system`, `rpc.service`, and `rpc.method` to activity tags based on
+ [semantic convention v1.26.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes).
+ ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865))
+
## 1.1.0-beta.4
Released 2024-Apr-12
diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs
index dc5bbda9ad..ce6f1fe325 100644
--- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs
+++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs
@@ -17,4 +17,8 @@ internal static class AWSSemanticConventions
public const string AttributeHttpResponseContentLength = "http.response_content_length";
public const string AttributeValueDynamoDb = "dynamodb";
+
+ public const string AttributeValueRPCSystem = "rpc.system";
+ public const string AttributeValueRPCService = "rpc.service";
+ public const string AttributeValueRPCMethod = "rpc.method";
}
diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs
index 84cbc01490..a58298b79a 100644
--- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs
+++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs
@@ -233,6 +233,11 @@ private static string FetchRequestId(IRequestContext requestContext, IResponseCo
{
activity.SetTag(AWSSemanticConventions.AttributeAWSServiceName, service);
activity.SetTag(AWSSemanticConventions.AttributeAWSOperationName, operation);
+
+ // Follow: https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes
+ activity.SetTag(AWSSemanticConventions.AttributeValueRPCSystem, "aws-api");
+ activity.SetTag(AWSSemanticConventions.AttributeValueRPCService, service);
+ activity.SetTag(AWSSemanticConventions.AttributeValueRPCMethod, operation);
var client = executionContext.RequestContext.ClientConfig;
if (client != null)
{
diff --git a/src/OpenTelemetry.Instrumentation.Hangfire/HangfireInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.Hangfire/HangfireInstrumentationOptions.cs
index baec4e1dba..562ee11878 100644
--- a/src/OpenTelemetry.Instrumentation.Hangfire/HangfireInstrumentationOptions.cs
+++ b/src/OpenTelemetry.Instrumentation.Hangfire/HangfireInstrumentationOptions.cs
@@ -30,7 +30,7 @@ public class HangfireInstrumentationOptions
///
/// Gets or sets a filter function that determines whether or not to
- /// collect telemetry about the the being executed.
+ /// collect telemetry about the being executed.
///
///
/// Notes:
diff --git a/test/OpenTelemetry.Contrib.Shared.Tests/ActivityInstrumentationHelperTest.cs b/test/OpenTelemetry.Contrib.Shared.Tests/ActivityInstrumentationHelperTest.cs
index e5841f53e6..fd99bee0d2 100644
--- a/test/OpenTelemetry.Contrib.Shared.Tests/ActivityInstrumentationHelperTest.cs
+++ b/test/OpenTelemetry.Contrib.Shared.Tests/ActivityInstrumentationHelperTest.cs
@@ -11,7 +11,7 @@ public class ActivityInstrumentationHelperTest
[Theory]
[InlineData("TestActivitySource", null)]
[InlineData("TestActivitySource", "1.0.0")]
- public void SetActivitySource(string name, string version)
+ public void SetActivitySource(string name, string? version)
{
using var activity = new Activity("Test");
using var activitySource = new ActivitySource(name, version);
diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaLogExporterTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaLogExporterTests.cs
index 321eaae6c6..fb9ed3168e 100644
--- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaLogExporterTests.cs
+++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaLogExporterTests.cs
@@ -1520,8 +1520,8 @@ private void AssertFluentdForwardModeForLogRecord(GenevaExporterOptions exporter
}
else
{
- _ = mapping.TryGetValue("env_properties", out object envProprties);
- var envPropertiesMapping = envProprties as IDictionary