From ac56c9f0df9743841ad9f14de0a8e2ee183972c3 Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Thu, 7 Dec 2023 10:53:37 -0800
Subject: [PATCH 01/32] Update documentation comments for
`OpenTelemetryDependencyInjectionMeterProviderBuilderExtensions.ConfigureServices`
(#5139)
---
.../Metrics/IMeterProviderBuilder.cs | 4 ++--
...emetryDependencyInjectionMeterProviderBuilderExtensions.cs | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/IMeterProviderBuilder.cs b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/IMeterProviderBuilder.cs
index e52858935f6..a7f2bf609fd 100644
--- a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/IMeterProviderBuilder.cs
+++ b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/IMeterProviderBuilder.cs
@@ -23,10 +23,10 @@ internal interface IMeterProviderBuilder : IDeferredMeterProviderBuilder
///
/// Register a callback action to configure the where metric services are configured.
+ /// cref="IServiceCollection"/> where metrics services are configured.
///
///
- /// Note: Metric services are only available during the application
+ /// Note: Metrics services are only available during the application
/// configuration phase. This method should throw a if services are configured after the
/// application has been created.
diff --git a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/OpenTelemetryDependencyInjectionMeterProviderBuilderExtensions.cs b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/OpenTelemetryDependencyInjectionMeterProviderBuilderExtensions.cs
index 04ac51efe67..457ddc87663 100644
--- a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/OpenTelemetryDependencyInjectionMeterProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Metrics/OpenTelemetryDependencyInjectionMeterProviderBuilderExtensions.cs
@@ -112,10 +112,10 @@ public static MeterProviderBuilder AddInstrumentation(
///
/// Register a callback action to configure the where tracing services are configured.
+ /// cref="IServiceCollection"/> where metrics services are configured.
///
///
- /// Note: Tracing services are only available during the application
+ /// Note: Metrics services are only available during the application
/// configuration phase.
///
/// .
From ff3956350efc39ada6ba5c246272ff8fc0e92d29 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 7 Dec 2023 11:06:27 -0800
Subject: [PATCH 02/32] Bump actions/stale from 8 to 9 (#5142)
---
.github/workflows/stale.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 95287991b18..f5657aa9f54 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -10,7 +10,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- - uses: actions/stale@v8
+ - uses: actions/stale@v9
with:
stale-pr-message: 'This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day.'
close-pr-message: 'Closed as inactive. Feel free to reopen if this PR is still being worked on.'
From 58e8f24782dc014ec82c03658b335f60583b4857 Mon Sep 17 00:00:00 2001
From: Vishwesh Bankwar
Date: Thu, 7 Dec 2023 14:58:57 -0800
Subject: [PATCH 03/32] Add grpc instrumentation with experimental feature flag
(#5130)
---
.../AspNetCoreTraceInstrumentationOptions.cs | 40 ++++++---
.../CHANGELOG.md | 14 +++
.../Implementation/HttpInListener.cs | 46 ++++------
...elemetry.Instrumentation.AspNetCore.csproj | 5 +-
.../TracerProviderBuilderExtensions.cs | 2 +
.../GrpcTests.server.cs | 85 ++++++++++---------
6 files changed, 108 insertions(+), 84 deletions(-)
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreTraceInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreTraceInstrumentationOptions.cs
index 9c6f210a71d..f66a5e04344 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreTraceInstrumentationOptions.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreTraceInstrumentationOptions.cs
@@ -3,6 +3,8 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Configuration;
+using OpenTelemetry.Internal;
namespace OpenTelemetry.Instrumentation.AspNetCore;
@@ -11,6 +13,24 @@ namespace OpenTelemetry.Instrumentation.AspNetCore;
///
public class AspNetCoreTraceInstrumentationOptions
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AspNetCoreTraceInstrumentationOptions()
+ : this(new ConfigurationBuilder().AddEnvironmentVariables().Build())
+ {
+ }
+
+ internal AspNetCoreTraceInstrumentationOptions(IConfiguration configuration)
+ {
+ Debug.Assert(configuration != null, "configuration was null");
+
+ if (configuration.TryGetBoolValue("OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION", out var enableGrpcInstrumentation))
+ {
+ this.EnableGrpcAspNetCoreSupport = enableGrpcInstrumentation;
+ }
+ }
+
///
/// Gets or sets a filter function that determines whether or not to
/// collect telemetry on a per request basis.
@@ -64,17 +84,11 @@ public class AspNetCoreTraceInstrumentationOptions
///
public bool RecordException { get; set; }
- /*
- * Removing for stable release of http instrumentation.
- * grpc semantic conventions are not yet stable so this option will not be part of stable package.
- #if NET6_0_OR_GREATER
- ///
- /// Gets or sets a value indicating whether RPC attributes are added to an Activity when using Grpc.AspNetCore. Default is true.
- ///
- ///
- /// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md.
- ///
- public bool EnableGrpcAspNetCoreSupport { get; set; } = true;
- #endif
- */
+ ///
+ /// Gets or sets a value indicating whether RPC attributes are added to an Activity when using Grpc.AspNetCore.
+ ///
+ ///
+ /// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md.
+ ///
+ internal bool EnableGrpcAspNetCoreSupport { get; set; }
}
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
index d6dc29b65c5..5db9434309a 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
@@ -2,6 +2,20 @@
## Unreleased
+* Re-introduced support for gRPC instrumentation as an opt-in experimental
+ feature. From now onwards, gRPC can be enabled by setting
+ `OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION` flag to
+ `True`. `OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION` can
+ be set as an environment variable or via IConfiguration. The change is
+ introduced in order to support stable release of `http` instrumentation.
+ Semantic conventions for RPC is still
+ [experimental](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/rpc)
+ and hence the package will only support it as an opt-in experimental feature.
+ Note that the support was removed in `1.6.0-rc.1` version of the package and
+ versions released before `1.6.0-rc.1` had gRPC instrumentation enabled by
+ default.
+ ([#5130](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5130))
+
## 1.6.0-rc.1
Released 2023-Dec-01
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
index 67a79c50eb8..471b131fc1e 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
@@ -6,17 +6,13 @@
using System.Diagnostics.CodeAnalysis;
#endif
using System.Reflection;
-#if !NETSTANDARD2_0
using System.Runtime.CompilerServices;
-#endif
using Microsoft.AspNetCore.Http;
#if !NETSTANDARD
using Microsoft.AspNetCore.Routing;
#endif
using OpenTelemetry.Context.Propagation;
-#if !NETSTANDARD2_0
using OpenTelemetry.Instrumentation.GrpcNetClient;
-#endif
using OpenTelemetry.Internal;
using OpenTelemetry.Trace;
@@ -170,7 +166,7 @@ public void OnStartActivity(Activity activity, object payload)
#endif
var path = (request.PathBase.HasValue || request.Path.HasValue) ? (request.PathBase + request.Path).ToString() : "/";
- activity.DisplayName = this.GetDisplayName(request.Method);
+ activity.DisplayName = GetDisplayName(request.Method);
// see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-spans.md
@@ -233,20 +229,18 @@ public void OnStopActivity(Activity activity, object payload)
var routePattern = (context.GetEndpoint() as RouteEndpoint)?.RoutePattern.RawText;
if (!string.IsNullOrEmpty(routePattern))
{
- activity.DisplayName = this.GetDisplayName(context.Request.Method, routePattern);
+ activity.DisplayName = GetDisplayName(context.Request.Method, routePattern);
activity.SetTag(SemanticConventions.AttributeHttpRoute, routePattern);
}
#endif
activity.SetTag(SemanticConventions.AttributeHttpResponseStatusCode, TelemetryHelper.GetBoxedStatusCode(response.StatusCode));
- /*
- #if !NETSTANDARD2_0
-
- if (this.options.EnableGrpcAspNetCoreSupport && TryGetGrpcMethod(activity, out var grpcMethod))
- {
- this.AddGrpcAttributes(activity, grpcMethod, context);
- }
- */
+
+ if (this.options.EnableGrpcAspNetCoreSupport && TryGetGrpcMethod(activity, out var grpcMethod))
+ {
+ AddGrpcAttributes(activity, grpcMethod, context);
+ }
+
if (activity.Status == ActivityStatusCode.Unset)
{
activity.SetStatus(SpanHelper.ResolveSpanStatusForHttpStatusCode(activity.Kind, response.StatusCode));
@@ -327,27 +321,15 @@ static bool TryFetchException(object payload, out Exception exc)
=> ExceptionPropertyFetcher.TryFetch(payload, out exc) && exc != null;
}
-#if !NETSTANDARD2_0
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryGetGrpcMethod(Activity activity, out string grpcMethod)
{
grpcMethod = GrpcTagHelper.GetGrpcMethodFromActivity(activity);
return !string.IsNullOrEmpty(grpcMethod);
}
-#endif
-
- private string GetDisplayName(string httpMethod, string httpRoute = null)
- {
- var normalizedMethod = RequestMethodHelper.GetNormalizedHttpMethod(httpMethod);
-
- return string.IsNullOrEmpty(httpRoute)
- ? normalizedMethod
- : $"{normalizedMethod} {httpRoute}";
- }
-#if !NETSTANDARD2_0
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private void AddGrpcAttributes(Activity activity, string grpcMethod, HttpContext context)
+ private static void AddGrpcAttributes(Activity activity, string grpcMethod, HttpContext context)
{
// The RPC semantic conventions indicate the span name
// should not have a leading forward slash.
@@ -389,5 +371,13 @@ private void AddGrpcAttributes(Activity activity, string grpcMethod, HttpContext
}
}
}
-#endif
+
+ private static string GetDisplayName(string httpMethod, string httpRoute = null)
+ {
+ var normalizedMethod = RequestMethodHelper.GetNormalizedHttpMethod(httpMethod);
+
+ return string.IsNullOrEmpty(httpRoute)
+ ? normalizedMethod
+ : $"{normalizedMethod} {httpRoute}";
+ }
}
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
index e3782aa277f..83b9e4e25bc 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
@@ -11,11 +11,13 @@
+
+
@@ -28,10 +30,11 @@
-
+
+
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
index 38919cb1156..5bf6a77ded7 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
@@ -62,6 +62,8 @@ public static TracerProviderBuilder AddAspNetCoreInstrumentation(
{
services.Configure(name, configureAspNetCoreTraceInstrumentationOptions);
}
+
+ services.RegisterOptionsFactory(configuration => new AspNetCoreTraceInstrumentationOptions(configuration));
});
if (builder is IDeferredTracerProviderBuilder deferredTracerProviderBuilder)
diff --git a/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.server.cs b/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.server.cs
index 6b16c081d13..9ef4eaf9e79 100644
--- a/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.server.cs
+++ b/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.server.cs
@@ -3,8 +3,19 @@
#if NET6_0_OR_GREATER
using System.Diagnostics;
+using System.Net;
+using Greet;
+using Grpc.Core;
+using Grpc.Net.Client;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Instrumentation.Grpc.Services.Tests;
+using OpenTelemetry.Instrumentation.GrpcNetClient;
+using OpenTelemetry.Trace;
using Xunit;
+using static OpenTelemetry.Internal.HttpSemanticConventionHelper;
+using Status = OpenTelemetry.Trace.Status;
namespace OpenTelemetry.Instrumentation.Grpc.Tests;
@@ -21,34 +32,26 @@ public GrpcTests()
this.server = new GrpcServer();
}
- /*
[Theory]
[InlineData(null)]
- [InlineData(true)]
- [InlineData(false)]
- public void GrpcAspNetCoreInstrumentationAddsCorrectAttributes(bool? enableGrpcAspNetCoreSupport)
+ [InlineData("true")]
+ [InlineData("false")]
+ [InlineData("True")]
+ [InlineData("False")]
+ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributes(string enableGrpcAspNetCoreSupport)
{
var configuration = new ConfigurationBuilder()
- .AddInMemoryCollection(new Dictionary { [SemanticConventionOptInKeyName] = "http" })
+ .AddInMemoryCollection(new Dictionary
+ {
+ [SemanticConventionOptInKeyName] = "http",
+ ["OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION"] = enableGrpcAspNetCoreSupport,
+ })
.Build();
var exportedItems = new List();
- var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder()
- .ConfigureServices(services => services.AddSingleton(configuration));
-
- if (enableGrpcAspNetCoreSupport.HasValue)
- {
- tracerProviderBuilder.AddAspNetCoreInstrumentation(options =>
- {
- options.EnableGrpcAspNetCoreSupport = enableGrpcAspNetCoreSupport.Value;
- });
- }
- else
- {
- tracerProviderBuilder.AddAspNetCoreInstrumentation();
- }
-
- using var tracerProvider = tracerProviderBuilder
+ using var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder()
+ .ConfigureServices(services => services.AddSingleton(configuration))
+ .AddAspNetCoreInstrumentation()
.AddInMemoryExporter(exportedItems)
.Build();
@@ -66,7 +69,7 @@ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributes(bool? enableGrpcA
Assert.Equal(ActivityKind.Server, activity.Kind);
- if (!enableGrpcAspNetCoreSupport.HasValue || enableGrpcAspNetCoreSupport.Value)
+ if (enableGrpcAspNetCoreSupport != null && enableGrpcAspNetCoreSupport.Equals("true", StringComparison.OrdinalIgnoreCase))
{
Assert.Equal("grpc", activity.GetTagValue(SemanticConventions.AttributeRpcSystem));
Assert.Equal("greet.Greeter", activity.GetTagValue(SemanticConventions.AttributeRpcService));
@@ -99,30 +102,28 @@ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributes(bool? enableGrpcA
[Theory(Skip = "Skipping for .NET 6 and higher due to bug #3023")]
#endif
[InlineData(null)]
- [InlineData(true)]
- [InlineData(false)]
- public void GrpcAspNetCoreInstrumentationAddsCorrectAttributesWhenItCreatesNewActivity(bool? enableGrpcAspNetCoreSupport)
+ [InlineData("true")]
+ [InlineData("false")]
+ [InlineData("True")]
+ [InlineData("False")]
+ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributesWhenItCreatesNewActivity(string enableGrpcAspNetCoreSupport)
{
try
{
// B3Propagator along with the headers passed to the client.SayHello ensure that the instrumentation creates a sibling activity
Sdk.SetDefaultTextMapPropagator(new Extensions.Propagators.B3Propagator());
var exportedItems = new List();
- var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder();
-
- if (enableGrpcAspNetCoreSupport.HasValue)
- {
- tracerProviderBuilder.AddAspNetCoreInstrumentation(options =>
- {
- options.EnableGrpcAspNetCoreSupport = enableGrpcAspNetCoreSupport.Value;
- });
- }
- else
- {
- tracerProviderBuilder.AddAspNetCoreInstrumentation();
- }
-
- using var tracerProvider = tracerProviderBuilder
+ var configuration = new ConfigurationBuilder()
+ .AddInMemoryCollection(new Dictionary
+ {
+ [SemanticConventionOptInKeyName] = "http",
+ ["OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION"] = enableGrpcAspNetCoreSupport,
+ })
+ .Build();
+
+ using var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder()
+ .ConfigureServices(services => services.AddSingleton(configuration))
+ .AddAspNetCoreInstrumentation()
.AddInMemoryExporter(exportedItems)
.Build();
@@ -146,7 +147,7 @@ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributesWhenItCreatesNewAc
Assert.Equal(ActivityKind.Server, activity.Kind);
- if (!enableGrpcAspNetCoreSupport.HasValue || enableGrpcAspNetCoreSupport.Value)
+ if (enableGrpcAspNetCoreSupport != null && enableGrpcAspNetCoreSupport.Equals("true", StringComparison.OrdinalIgnoreCase))
{
Assert.Equal("grpc", activity.GetTagValue(SemanticConventions.AttributeRpcSystem));
Assert.Equal("greet.Greeter", activity.GetTagValue(SemanticConventions.AttributeRpcService));
@@ -183,7 +184,7 @@ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributesWhenItCreatesNewAc
}));
}
}
- */
+
public void Dispose()
{
this.server.Dispose();
From 93fd7d34a718278abfa533fa3e9436eb205cab88 Mon Sep 17 00:00:00 2001
From: Cijo Thomas
Date: Thu, 7 Dec 2023 17:57:16 -0800
Subject: [PATCH 04/32] Doc fix for RecordException (#5143)
---
src/OpenTelemetry.Api/Trace/ActivityExtensions.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs b/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs
index 036d8c11a7c..d8ac769b9c9 100644
--- a/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs
+++ b/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs
@@ -57,20 +57,26 @@ public static Status GetStatus(this Activity activity)
}
///
- /// Adds an activity event containing information from the specified exception.
+ /// Adds an containing information from the specified exception.
///
/// Activity instance.
/// Exception to be recorded.
+ /// The exception is recorded as per specification.
+ /// "exception.stacktrace" is represented using the value of Exception.ToString.
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void RecordException(this Activity activity, Exception? ex)
=> RecordException(activity, ex, default);
///
- /// Adds an activity event containing information from the specified exception and additional tags.
+ /// Adds an containing information from the specified exception and additional tags.
///
/// Activity instance.
/// Exception to be recorded.
/// Additional tags to record on the event.
+ /// The exception is recorded as per specification.
+ /// "exception.stacktrace" is represented using the value of Exception.ToString.
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void RecordException(this Activity activity, Exception? ex, in TagList tags)
{
From f5c116001f8c57a42a707392d949dfc89109cd99 Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Fri, 8 Dec 2023 09:31:54 -0800
Subject: [PATCH 05/32] [api-logs] Define OTEL1000 & OTEL1001 diagnostics and
decorate APIs (#4963)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
---
OpenTelemetry.sln | 18 +++++++-
build/Common.props | 2 +
docs/diagnostics/README.md | 23 ++++++++++
.../diagnostics/experimental-apis/OTEL1000.md | 42 +++++++++++++++++++
.../diagnostics/experimental-apis/OTEL1001.md | 35 ++++++++++++++++
docs/diagnostics/experimental-apis/README.md | 42 +++++++++++++++++++
docs/metrics/exemplars/docker-compose.yaml | 1 -
.../Logs/IDeferredLoggerProviderBuilder.cs | 10 ++++-
.../Logs/LogRecordAttributeList.cs | 6 +++
src/OpenTelemetry.Api/Logs/LogRecordData.cs | 7 ++++
.../Logs/LogRecordSeverity.cs | 8 ++++
.../Logs/LogRecordSeverityExtensions.cs | 8 ++++
src/OpenTelemetry.Api/Logs/Logger.cs | 10 ++++-
src/OpenTelemetry.Api/Logs/LoggerProvider.cs | 18 ++++++++
.../Logs/LoggerProviderBuilder.cs | 8 ++++
.../OpenTelemetry.Api.csproj | 1 +
src/Shared/DiagnosticDefinitions.cs | 14 +++++++
17 files changed, 248 insertions(+), 5 deletions(-)
create mode 100644 docs/diagnostics/README.md
create mode 100644 docs/diagnostics/experimental-apis/OTEL1000.md
create mode 100644 docs/diagnostics/experimental-apis/OTEL1001.md
create mode 100644 docs/diagnostics/experimental-apis/README.md
create mode 100644 src/Shared/DiagnosticDefinitions.cs
diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln
index 337b5953028..f4d72580bb3 100644
--- a/OpenTelemetry.sln
+++ b/OpenTelemetry.sln
@@ -32,7 +32,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E
build\docfx.cmd = build\docfx.cmd
build\docker-compose.net6.0.yml = build\docker-compose.net6.0.yml
build\docker-compose.net7.0.yml = build\docker-compose.net7.0.yml
- build\docker-compose.net8.0.yml = build\docker-compose.net8.0.yml
build\finalize-publicapi.ps1 = build\finalize-publicapi.ps1
build\GlobalAttrExclusions.txt = build\GlobalAttrExclusions.txt
build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png
@@ -92,8 +91,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
ProjectSection(SolutionItems) = preProject
.github\workflows\ci-aot-md.yml = .github\workflows\ci-aot-md.yml
.github\workflows\ci-aot.yml = .github\workflows\ci-aot.yml
- .github\workflows\ci-concurrency.yml = .github\workflows\ci-concurrency.yml
.github\workflows\ci-concurrency-md.yml = .github\workflows\ci-concurrency-md.yml
+ .github\workflows\ci-concurrency.yml = .github\workflows\ci-concurrency.yml
.github\workflows\ci-instrumentation-libraries-md.yml = .github\workflows\ci-instrumentation-libraries-md.yml
.github\workflows\ci-instrumentation-libraries.yml = .github\workflows\ci-instrumentation-libraries.yml
.github\workflows\ci-md.yml = .github\workflows\ci-md.yml
@@ -266,6 +265,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A49299
ProjectSection(SolutionItems) = preProject
src\Shared\ActivityHelperExtensions.cs = src\Shared\ActivityHelperExtensions.cs
src\Shared\ActivityInstrumentationHelper.cs = src\Shared\ActivityInstrumentationHelper.cs
+ src\Shared\DiagnosticDefinitions.cs = src\Shared\DiagnosticDefinitions.cs
src\Shared\ExceptionExtensions.cs = src\Shared\ExceptionExtensions.cs
src\Shared\Guard.cs = src\Shared\Guard.cs
src\Shared\HttpSemanticConventionHelper.cs = src\Shared\HttpSemanticConventionHelper.cs
@@ -323,6 +323,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started-aspnetcore"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "links-creation", "docs\trace\links-creation-with-new-activities\links-creation.csproj", "{B4856711-6D4C-4246-A686-49458D4C1301}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "diagnostics", "diagnostics", "{52AF6D7D-9E66-4234-9A2C-5D16C6F22B40}"
+ ProjectSection(SolutionItems) = preProject
+ docs\diagnostics\README.md = docs\diagnostics\README.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "experimental-apis", "experimental-apis", "{17A22B0E-6EC3-4A39-B955-0A486AD06699}"
+ ProjectSection(SolutionItems) = preProject
+ docs\diagnostics\experimental-apis\OTEL1000.md = docs\diagnostics\experimental-apis\OTEL1000.md
+ docs\diagnostics\experimental-apis\OTEL1001.md = docs\diagnostics\experimental-apis\OTEL1001.md
+ docs\diagnostics\experimental-apis\README.md = docs\diagnostics\experimental-apis\README.md
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -650,6 +662,8 @@ Global
{1C459B5B-C702-46FF-BF1A-EE795E420FFA} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
{99B4D965-8782-4694-8DFA-B7A3630CEF60} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
{B4856711-6D4C-4246-A686-49458D4C1301} = {5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818}
+ {52AF6D7D-9E66-4234-9A2C-5D16C6F22B40} = {7C87CAF9-79D7-4C26-9FFB-F3F1FB6911F1}
+ {17A22B0E-6EC3-4A39-B955-0A486AD06699} = {52AF6D7D-9E66-4234-9A2C-5D16C6F22B40}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
diff --git a/build/Common.props b/build/Common.props
index 8a0a062ca07..758306e5571 100644
--- a/build/Common.props
+++ b/build/Common.props
@@ -9,6 +9,8 @@
true
enable
enable
+
+ $(NoWarn);OTEL1000;OTEL1001
diff --git a/docs/diagnostics/README.md b/docs/diagnostics/README.md
new file mode 100644
index 00000000000..2c959a6278e
--- /dev/null
+++ b/docs/diagnostics/README.md
@@ -0,0 +1,23 @@
+# OpenTelemetry Diagnostics
+
+This document describes the diagnostic categories used in OpenTelemetry .NET
+components. Diagnostics are used by the compiler to report information to users
+about experimental and/or obsolete code being invoked or to suggest improvements
+to specific code patterns identified through static analysis.
+
+## Experimental APIs
+
+Range: OTEL1XXX
+
+Experimental APIs exposed in OpenTelemetry .NET pre-relase builds. APIs are
+exposed experimentally when either the OpenTelemetry Specification has
+explicitly marked some feature as
+[experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md)
+or when the SIG members are still working through the design for a feature and
+want to solicit feedback from the community.
+
+> **Note** Experimental APIs are exposed as `public` in pre-release builds and
+> `internal` in stable builds.
+
+For defined diagnostics see: [OpenTelemetry .NET Experimental
+APIs](./experimental-apis/README.md)
diff --git a/docs/diagnostics/experimental-apis/OTEL1000.md b/docs/diagnostics/experimental-apis/OTEL1000.md
new file mode 100644
index 00000000000..5febb4f7ab4
--- /dev/null
+++ b/docs/diagnostics/experimental-apis/OTEL1000.md
@@ -0,0 +1,42 @@
+# OpenTelemetry .NET Diagnostic: OTEL1000
+
+## Overview
+
+This is an Experimental API diagnostic covering the following APIs:
+
+* `LoggerProviderBuilder`
+* `LoggerProvider`
+* `IDeferredLoggerProviderBuilder`
+
+Experimental APIs may be changed or removed in the future.
+
+## Details
+
+The OpenTelemetry Specification defines a `LoggerProvider` as part of its
+[API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md)
+&
+[SDK](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md)
+components.
+
+The SDK allows calling `Shutdown` and `ForceFlush` on the `LoggerProvider` and
+also allows processors to be added dynamically to a pipeline after its creation.
+
+Today the OpenTelemetry .NET log pipeline is built on top of the
+Microsoft.Extensions.Logging `ILogger` \ `ILoggerProvider` \ `ILoggerFactory`
+APIs which do not expose such features.
+
+We also have an issue with the `ILoggingBuilder.AddOpenTelemetry` API in that it
+interacts with the `OpenTelemetryLoggerOptions` class. Options classes are NOT
+available until the `IServiceProvider` is available and services can no longer
+be registered at that point. This prevents the current logging pipeline from
+exposing the same dependency injection surface we have for traces and metrics.
+
+We are exposing these APIs to solve these issues and gather feedback about their
+usefulness.
+
+## Log Bridge API
+
+The OpenTelemetry Specification defines a Log Bridge API which is rooted off of
+the `LoggerProvider` (`GetLogger`) and exposes a `Logger` API to submit log
+records. See [OTEL1001](./OTEL1001.md) for details about the Log Bridge API
+implementation status.
diff --git a/docs/diagnostics/experimental-apis/OTEL1001.md b/docs/diagnostics/experimental-apis/OTEL1001.md
new file mode 100644
index 00000000000..66c1f7627ec
--- /dev/null
+++ b/docs/diagnostics/experimental-apis/OTEL1001.md
@@ -0,0 +1,35 @@
+# OpenTelemetry .NET Diagnostic: OTEL1001
+
+## Overview
+
+This is an Experimental API diagnostic covering the following APIs:
+
+* `LoggerProvider.GetLogger`
+* `Logger`
+* `LogRecordAttributeList`
+* `LogRecordData`
+* `LogRecordSeverity`
+
+Experimental APIs may be changed or removed in the future.
+
+## Details
+
+The OpenTelemetry Specification defines a [Logs Bridge
+API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md).
+
+The log bridge API is used by library authors to build log appenders which route
+messages from different log frameworks into OpenTelemetry.
+
+Today the OpenTelemetry .NET log pipeline is built on top of the
+Microsoft.Extensions.Logging `ILogger` \ `ILoggerProvider` \ `ILoggerFactory`
+APIs.
+
+We are exposing these APIs gather feedback about their usefulness. An
+alternative approach may be taken which would be to append into `ILogger`
+instead of OpenTelemetry directly.
+
+## LoggerProvider API
+
+The OpenTelemetry Specification defines a `LoggerProvider` API. See
+[OTEL1000](./OTEL1000.md) for details about the `LoggerProvider` implementation
+status.
diff --git a/docs/diagnostics/experimental-apis/README.md b/docs/diagnostics/experimental-apis/README.md
new file mode 100644
index 00000000000..6333099f527
--- /dev/null
+++ b/docs/diagnostics/experimental-apis/README.md
@@ -0,0 +1,42 @@
+# OpenTelemetry .NET Experimental APIs
+
+This document describes experimental APIs exposed in OpenTelemetry .NET
+pre-relase builds. APIs are exposed experimentally when either the OpenTelemetry
+Specification has explicitly marked some feature as
+[experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md)
+or when the SIG members are still working through the design for a feature and
+want to solicit feedback from the community.
+
+> **Note**
+> Experimental APIs are exposed as `public` in pre-release builds and `internal`
+> in stable builds.
+
+## Active
+
+Experimental APIs available in the pre-release builds:
+
+### OTEL1000
+
+Description: `LoggerProvider` and `LoggerProviderBuilder`
+
+Details: [OTEL1000](./OTEL1000.md)
+
+### OTEL1001
+
+Description: Log Bridge API
+
+Details: [OTEL1001](./OTEL1001.md)
+
+## Inactive
+
+Experimental APIs which have been released stable or removed:
+
+
+
+None
diff --git a/docs/metrics/exemplars/docker-compose.yaml b/docs/metrics/exemplars/docker-compose.yaml
index 87cd7a6c6d6..c8cc94fa4b1 100644
--- a/docs/metrics/exemplars/docker-compose.yaml
+++ b/docs/metrics/exemplars/docker-compose.yaml
@@ -48,4 +48,3 @@ services:
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
ports:
- "3000:3000"
-
diff --git a/src/OpenTelemetry.Api/Logs/IDeferredLoggerProviderBuilder.cs b/src/OpenTelemetry.Api/Logs/IDeferredLoggerProviderBuilder.cs
index b7f5f3b0811..70528fe6cb7 100644
--- a/src/OpenTelemetry.Api/Logs/IDeferredLoggerProviderBuilder.cs
+++ b/src/OpenTelemetry.Api/Logs/IDeferredLoggerProviderBuilder.cs
@@ -3,6 +3,11 @@
#nullable enable
+#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Logs;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -12,6 +17,9 @@ namespace OpenTelemetry.Logs;
/// dependency injection.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -21,7 +29,7 @@ namespace OpenTelemetry.Logs;
///
internal
#endif
- interface IDeferredLoggerProviderBuilder
+interface IDeferredLoggerProviderBuilder
{
///
/// Register a callback action to configure the
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordData.cs b/src/OpenTelemetry.Api/Logs/LogRecordData.cs
index ab5af385266..cf7cc550dec 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordData.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordData.cs
@@ -4,6 +4,10 @@
#nullable enable
using System.Diagnostics;
+#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
namespace OpenTelemetry.Logs;
@@ -12,6 +16,9 @@ namespace OpenTelemetry.Logs;
/// Stores details about a log message.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs b/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs
index 760f6882997..d3a0442cabb 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs
@@ -3,6 +3,11 @@
#nullable enable
+#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Logs;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -10,6 +15,9 @@ namespace OpenTelemetry.Logs;
/// Describes the severity level of a log record.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs b/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs
index c7f180294b7..cf22c26a23f 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs
@@ -3,6 +3,11 @@
#nullable enable
+#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Logs;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -10,6 +15,9 @@ namespace OpenTelemetry.Logs;
/// Contains extension methods for the enum.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Api/Logs/Logger.cs b/src/OpenTelemetry.Api/Logs/Logger.cs
index 6db679016fb..b112a81cdbb 100644
--- a/src/OpenTelemetry.Api/Logs/Logger.cs
+++ b/src/OpenTelemetry.Api/Logs/Logger.cs
@@ -3,6 +3,11 @@
#nullable enable
+#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Logs;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -10,6 +15,9 @@ namespace OpenTelemetry.Logs;
/// Logger is the class responsible for creating log records.
///
/// WARNING: This is an experimental API which might change or be removed in the future. Use at your own risk.
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -17,7 +25,7 @@ namespace OpenTelemetry.Logs;
///
internal
#endif
- abstract class Logger
+abstract class Logger
{
///
/// Initializes a new instance of the class.
diff --git a/src/OpenTelemetry.Api/Logs/LoggerProvider.cs b/src/OpenTelemetry.Api/Logs/LoggerProvider.cs
index fd8099715cf..f29ec12d38c 100644
--- a/src/OpenTelemetry.Api/Logs/LoggerProvider.cs
+++ b/src/OpenTelemetry.Api/Logs/LoggerProvider.cs
@@ -6,6 +6,9 @@
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif
+#if NET8_0_OR_GREATER
+using OpenTelemetry.Internal;
+#endif
namespace OpenTelemetry.Logs;
@@ -14,6 +17,9 @@ namespace OpenTelemetry.Logs;
/// LoggerProvider is the entry point of the OpenTelemetry API. It provides access to .
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -36,6 +42,9 @@ protected LoggerProvider()
/// Gets a logger.
///
/// instance.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public Logger GetLogger()
=> this.GetLogger(name: null, version: null);
@@ -44,6 +53,9 @@ public Logger GetLogger()
///
/// Optional name identifying the instrumentation library.
/// instance.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public Logger GetLogger(string? name)
=> this.GetLogger(name, version: null);
@@ -53,6 +65,9 @@ public Logger GetLogger(string? name)
/// Optional name identifying the instrumentation library.
/// Optional version of the instrumentation library.
/// instance.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public Logger GetLogger(string? name, string? version)
{
if (!this.TryCreateLogger(name, out var logger))
@@ -71,6 +86,9 @@ public Logger GetLogger(string? name, string? version)
/// Optional name identifying the instrumentation library.
/// .
/// if the logger was created.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
protected virtual bool TryCreateLogger(
string? name,
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
diff --git a/src/OpenTelemetry.Api/Logs/LoggerProviderBuilder.cs b/src/OpenTelemetry.Api/Logs/LoggerProviderBuilder.cs
index 617a51ead09..3fa9c6fc743 100644
--- a/src/OpenTelemetry.Api/Logs/LoggerProviderBuilder.cs
+++ b/src/OpenTelemetry.Api/Logs/LoggerProviderBuilder.cs
@@ -3,6 +3,11 @@
#nullable enable
+#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Logs;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -10,6 +15,9 @@ namespace OpenTelemetry.Logs;
/// LoggerProviderBuilder base class.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj
index 27aa7389a8d..0a781a94173 100644
--- a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj
+++ b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj
@@ -15,6 +15,7 @@
+
diff --git a/src/Shared/DiagnosticDefinitions.cs b/src/Shared/DiagnosticDefinitions.cs
new file mode 100644
index 00000000000..7e6fb6af6cf
--- /dev/null
+++ b/src/Shared/DiagnosticDefinitions.cs
@@ -0,0 +1,14 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#nullable enable
+
+namespace OpenTelemetry.Internal;
+
+internal static class DiagnosticDefinitions
+{
+ public const string ExperimentalApiUrlFormat = "https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/diagnostics/experimental-apis/README.md#{0}";
+
+ public const string LoggerProviderExperimentalApi = "OTEL1000";
+ public const string LogBridgeApiExperimentalApi = "OTEL1001";
+}
From f075128b1253be77962277ae946bb7b2f9d878da Mon Sep 17 00:00:00 2001
From: Nils Gruson
Date: Fri, 8 Dec 2023 20:43:00 +0100
Subject: [PATCH 06/32] Solve 404 error in unit test (#5145)
---
.../BasicTests.cs | 18 +++++++-------
test/TestApp.AspNetCore/Program.cs | 2 ++
test/TestApp.AspNetCore/TestMiddleware.cs | 24 +++++++++++++++++++
3 files changed, 36 insertions(+), 8 deletions(-)
create mode 100644 test/TestApp.AspNetCore/TestMiddleware.cs
diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs
index 9888ab9a172..2d3f6d2c21a 100644
--- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs
+++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs
@@ -947,6 +947,7 @@ public async Task DiagnosticSourceExceptionCallBackIsNotReceivedForExceptionsHan
int numberOfUnSubscribedEvents = 0;
int numberOfSubscribedEvents = 0;
int numberOfExceptionCallbacks = 0;
+ bool exceptionHandled = false;
// configure SDK
this.tracerProvider = Sdk.CreateTracerProviderBuilder()
@@ -991,18 +992,18 @@ public async Task DiagnosticSourceExceptionCallBackIsNotReceivedForExceptionsHan
})
.Build();
+ TestMiddleware.Create(builder => builder
+ .UseExceptionHandler(handler =>
+ handler.Run(async (ctx) =>
+ {
+ exceptionHandled = true;
+ await ctx.Response.WriteAsync("handled");
+ })));
+
using (var client = this.factory
.WithWebHostBuilder(builder =>
{
builder.ConfigureLogging(loggingBuilder => loggingBuilder.ClearProviders());
- builder.Configure(app => app
- .UseExceptionHandler(handler =>
- {
- handler.Run(async (ctx) =>
- {
- await ctx.Response.WriteAsync("handled");
- });
- }));
})
.CreateClient())
{
@@ -1020,6 +1021,7 @@ public async Task DiagnosticSourceExceptionCallBackIsNotReceivedForExceptionsHan
Assert.Equal(0, numberOfExceptionCallbacks);
Assert.Equal(0, numberOfUnSubscribedEvents);
Assert.Equal(2, numberOfSubscribedEvents);
+ Assert.True(exceptionHandled);
}
public void Dispose()
diff --git a/test/TestApp.AspNetCore/Program.cs b/test/TestApp.AspNetCore/Program.cs
index 49b801fb6c3..06071eab4bd 100644
--- a/test/TestApp.AspNetCore/Program.cs
+++ b/test/TestApp.AspNetCore/Program.cs
@@ -47,6 +47,8 @@ public static void Main(string[] args)
app.UseMiddleware();
+ app.AddTestMiddleware();
+
app.Run();
}
}
diff --git a/test/TestApp.AspNetCore/TestMiddleware.cs b/test/TestApp.AspNetCore/TestMiddleware.cs
new file mode 100644
index 00000000000..39acf58db3d
--- /dev/null
+++ b/test/TestApp.AspNetCore/TestMiddleware.cs
@@ -0,0 +1,24 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+namespace TestApp.AspNetCore;
+
+public static class TestMiddleware
+{
+ private static readonly AsyncLocal?> Current = new();
+
+ public static IApplicationBuilder AddTestMiddleware(this IApplicationBuilder builder)
+ {
+ if (Current.Value is { } configure)
+ {
+ configure(builder);
+ }
+
+ return builder;
+ }
+
+ public static void Create(Action action)
+ {
+ Current.Value = action;
+ }
+}
From ecef81d551275507708bccd9406f0066ef7bb556 Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Fri, 8 Dec 2023 15:00:50 -0800
Subject: [PATCH 07/32] [api-extensions-logs] ExperimentalAttribute decoration
for experimental APIs (#5148)
---
...tryDependencyInjectionLoggerProviderBuilderExtensions.cs | 3 +++
...DependencyInjectionLoggingServiceCollectionExtensions.cs | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggerProviderBuilderExtensions.cs b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggerProviderBuilderExtensions.cs
index 72b3f21de77..257b7332bec 100644
--- a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggerProviderBuilderExtensions.cs
@@ -14,6 +14,9 @@ namespace OpenTelemetry.Logs;
/// Contains extension methods for the class.
///
#if EXPOSE_EXPERIMENTAL_FEATURES
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
internal
diff --git a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggingServiceCollectionExtensions.cs b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggingServiceCollectionExtensions.cs
index b30085b5744..8e6f899b24e 100644
--- a/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggingServiceCollectionExtensions.cs
+++ b/src/OpenTelemetry.Api.ProviderBuilderExtensions/Logs/OpenTelemetryDependencyInjectionLoggingServiceCollectionExtensions.cs
@@ -1,6 +1,9 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry.Internal;
@@ -10,6 +13,9 @@ namespace OpenTelemetry.Logs;
/// Extension methods for setting up OpenTelemetry logging services in an .
///
#if EXPOSE_EXPERIMENTAL_FEATURES
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
internal
From f69c025178216d1879e5884f0a74ab15ca759a23 Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Fri, 8 Dec 2023 15:54:02 -0800
Subject: [PATCH 08/32] Update CHANGLEOG for 1.7.0 (#5149)
---
.../CHANGELOG.md | 4 +
.../.publicApi/Stable/PublicAPI.Shipped.txt | 109 +++++++++---------
.../.publicApi/Stable/PublicAPI.Unshipped.txt | 1 -
src/OpenTelemetry.Api/CHANGELOG.md | 4 +
.../CHANGELOG.md | 4 +
.../CHANGELOG.md | 4 +
.../.publicApi/Stable/PublicAPI.Shipped.txt | 19 +--
.../.publicApi/Stable/PublicAPI.Unshipped.txt | 6 -
.../CHANGELOG.md | 4 +
.../CHANGELOG.md | 4 +
.../.publicApi/Stable/PublicAPI.Unshipped.txt | 1 -
.../CHANGELOG.md | 4 +
.../CHANGELOG.md | 4 +
.../CHANGELOG.md | 4 +
.../.publicApi/Stable/PublicAPI.Shipped.txt | 47 ++++----
.../.publicApi/Stable/PublicAPI.Unshipped.txt | 1 -
src/OpenTelemetry/CHANGELOG.md | 4 +
17 files changed, 131 insertions(+), 93 deletions(-)
diff --git a/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md b/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md
index 12cac97046c..25df4b8179a 100644
--- a/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md
+++ b/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Shipped.txt b/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Shipped.txt
index 6599b613303..a87bb701214 100644
--- a/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Shipped.txt
+++ b/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Shipped.txt
@@ -2,11 +2,6 @@
~abstract OpenTelemetry.Context.Propagation.TextMapPropagator.Extract(OpenTelemetry.Context.Propagation.PropagationContext context, T carrier, System.Func> getter) -> OpenTelemetry.Context.Propagation.PropagationContext
~abstract OpenTelemetry.Context.Propagation.TextMapPropagator.Fields.get -> System.Collections.Generic.ISet
~abstract OpenTelemetry.Context.Propagation.TextMapPropagator.Inject(OpenTelemetry.Context.Propagation.PropagationContext context, T carrier, System.Action setter) -> void
-abstract OpenTelemetry.Metrics.MeterProviderBuilder.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder!
-abstract OpenTelemetry.Metrics.MeterProviderBuilder.AddMeter(params string![]! names) -> OpenTelemetry.Metrics.MeterProviderBuilder!
-abstract OpenTelemetry.Trace.TracerProviderBuilder.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
-abstract OpenTelemetry.Trace.TracerProviderBuilder.AddLegacySource(string! operationName) -> OpenTelemetry.Trace.TracerProviderBuilder!
-abstract OpenTelemetry.Trace.TracerProviderBuilder.AddSource(params string![]! names) -> OpenTelemetry.Trace.TracerProviderBuilder!
~OpenTelemetry.Baggage.GetBaggage() -> System.Collections.Generic.IReadOnlyDictionary
~OpenTelemetry.Baggage.GetBaggage(string name) -> string
~OpenTelemetry.Baggage.GetEnumerator() -> System.Collections.Generic.Dictionary.Enumerator
@@ -25,44 +20,6 @@ abstract OpenTelemetry.Trace.TracerProviderBuilder.AddSource(params string![]! n
~OpenTelemetry.Context.ThreadLocalRuntimeContextSlot.ThreadLocalRuntimeContextSlot(string name) -> void
~OpenTelemetry.Context.ThreadLocalRuntimeContextSlot.Value.get -> object
~OpenTelemetry.Context.ThreadLocalRuntimeContextSlot.Value.set -> void
-OpenTelemetry.Metrics.IDeferredMeterProviderBuilder.Configure(System.Action! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
-OpenTelemetry.Trace.IDeferredTracerProviderBuilder.Configure(System.Action! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
-OpenTelemetry.Trace.Link.Attributes.get -> System.Collections.Generic.IEnumerable>?
-OpenTelemetry.Trace.Link.Link(in OpenTelemetry.Trace.SpanContext spanContext, OpenTelemetry.Trace.SpanAttributes? attributes) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, bool value) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, bool[]? values) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, double value) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, double[]? values) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, long value) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, long[]? values) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, string? value) -> void
-OpenTelemetry.Trace.SpanAttributes.Add(string! key, string?[]? values) -> void
-OpenTelemetry.Trace.SpanAttributes.SpanAttributes(System.Collections.Generic.IEnumerable>! attributes) -> void
-OpenTelemetry.Trace.SpanContext.SpanContext(in System.Diagnostics.ActivityTraceId traceId, in System.Diagnostics.ActivitySpanId spanId, System.Diagnostics.ActivityTraceFlags traceFlags, bool isRemote = false, System.Collections.Generic.IEnumerable>? traceState = null) -> void
-OpenTelemetry.Trace.SpanContext.TraceState.get -> System.Collections.Generic.IEnumerable>!
-OpenTelemetry.Trace.Status.Description.get -> string?
-OpenTelemetry.Trace.Status.WithDescription(string? description) -> OpenTelemetry.Trace.Status
-OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name, OpenTelemetry.Trace.SpanAttributes? attributes) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name, System.DateTimeOffset timestamp) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name, System.DateTimeOffset timestamp, OpenTelemetry.Trace.SpanAttributes? attributes) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.RecordException(string? type, string? message, string? stacktrace) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.RecordException(System.Exception? ex) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, bool value) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, bool[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, double value) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, double[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, int value) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, int[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, string? value) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, string?[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TelemetrySpan.UpdateName(string! name) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.Tracer.StartActiveSpan(string! name, OpenTelemetry.Trace.SpanKind kind = OpenTelemetry.Trace.SpanKind.Internal, in OpenTelemetry.Trace.SpanContext parentContext = default(OpenTelemetry.Trace.SpanContext), OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.Tracer.StartActiveSpan(string! name, OpenTelemetry.Trace.SpanKind kind, in OpenTelemetry.Trace.TelemetrySpan? parentSpan, OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.Tracer.StartRootSpan(string! name, OpenTelemetry.Trace.SpanKind kind = OpenTelemetry.Trace.SpanKind.Internal, OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.Tracer.StartSpan(string! name, OpenTelemetry.Trace.SpanKind kind = OpenTelemetry.Trace.SpanKind.Internal, in OpenTelemetry.Trace.SpanContext parentContext = default(OpenTelemetry.Trace.SpanContext), OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.Tracer.StartSpan(string! name, OpenTelemetry.Trace.SpanKind kind, in OpenTelemetry.Trace.TelemetrySpan? parentSpan, OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
-OpenTelemetry.Trace.TracerProvider.GetTracer(string! name, string? version = null) -> OpenTelemetry.Trace.Tracer!
~override OpenTelemetry.Baggage.Equals(object obj) -> bool
~override OpenTelemetry.Context.Propagation.B3Propagator.Extract(OpenTelemetry.Context.Propagation.PropagationContext context, T carrier, System.Func> getter) -> OpenTelemetry.Context.Propagation.PropagationContext
~override OpenTelemetry.Context.Propagation.B3Propagator.Fields.get -> System.Collections.Generic.ISet
@@ -77,10 +34,6 @@ OpenTelemetry.Trace.TracerProvider.GetTracer(string! name, string? version = nul
~override OpenTelemetry.Context.Propagation.TraceContextPropagator.Extract(OpenTelemetry.Context.Propagation.PropagationContext context, T carrier, System.Func> getter) -> OpenTelemetry.Context.Propagation.PropagationContext
~override OpenTelemetry.Context.Propagation.TraceContextPropagator.Fields.get -> System.Collections.Generic.ISet
~override OpenTelemetry.Context.Propagation.TraceContextPropagator.Inject(OpenTelemetry.Context.Propagation.PropagationContext context, T carrier, System.Action setter) -> void
-override OpenTelemetry.Trace.Link.Equals(object? obj) -> bool
-override OpenTelemetry.Trace.SpanContext.Equals(object? obj) -> bool
-override OpenTelemetry.Trace.Status.Equals(object? obj) -> bool
-override OpenTelemetry.Trace.Status.ToString() -> string!
~static OpenTelemetry.Baggage.Create(System.Collections.Generic.Dictionary baggageItems = null) -> OpenTelemetry.Baggage
~static OpenTelemetry.Baggage.GetBaggage(OpenTelemetry.Baggage baggage = default(OpenTelemetry.Baggage)) -> System.Collections.Generic.IReadOnlyDictionary
~static OpenTelemetry.Baggage.GetBaggage(string name, OpenTelemetry.Baggage baggage = default(OpenTelemetry.Baggage)) -> string
@@ -97,15 +50,13 @@ override OpenTelemetry.Trace.Status.ToString() -> string!
~static OpenTelemetry.Context.RuntimeContext.RegisterSlot(string slotName) -> OpenTelemetry.Context.RuntimeContextSlot
~static OpenTelemetry.Context.RuntimeContext.SetValue(string slotName, object value) -> void
~static OpenTelemetry.Context.RuntimeContext.SetValue(string slotName, T value) -> void
-static OpenTelemetry.Trace.ActivityExtensions.GetStatus(this System.Diagnostics.Activity! activity) -> OpenTelemetry.Trace.Status
-static OpenTelemetry.Trace.ActivityExtensions.RecordException(this System.Diagnostics.Activity! activity, System.Exception? ex) -> void
-static OpenTelemetry.Trace.ActivityExtensions.RecordException(this System.Diagnostics.Activity! activity, System.Exception? ex, in System.Diagnostics.TagList tags) -> void
-static OpenTelemetry.Trace.ActivityExtensions.SetStatus(this System.Diagnostics.Activity! activity, OpenTelemetry.Trace.Status status) -> void
-static OpenTelemetry.Trace.Tracer.CurrentSpan.get -> OpenTelemetry.Trace.TelemetrySpan!
-static OpenTelemetry.Trace.Tracer.WithSpan(OpenTelemetry.Trace.TelemetrySpan? span) -> OpenTelemetry.Trace.TelemetrySpan?
-static OpenTelemetry.Trace.TracerProvider.Default.get -> OpenTelemetry.Trace.TracerProvider!
abstract OpenTelemetry.Context.RuntimeContextSlot.Get() -> T
abstract OpenTelemetry.Context.RuntimeContextSlot.Set(T value) -> void
+abstract OpenTelemetry.Metrics.MeterProviderBuilder.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder!
+abstract OpenTelemetry.Metrics.MeterProviderBuilder.AddMeter(params string![]! names) -> OpenTelemetry.Metrics.MeterProviderBuilder!
+abstract OpenTelemetry.Trace.TracerProviderBuilder.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
+abstract OpenTelemetry.Trace.TracerProviderBuilder.AddLegacySource(string! operationName) -> OpenTelemetry.Trace.TracerProviderBuilder!
+abstract OpenTelemetry.Trace.TracerProviderBuilder.AddSource(params string![]! names) -> OpenTelemetry.Trace.TracerProviderBuilder!
OpenTelemetry.ActivityContextExtensions
OpenTelemetry.Baggage
OpenTelemetry.Baggage.Baggage() -> void
@@ -140,28 +91,43 @@ OpenTelemetry.Context.RuntimeContextSlot
OpenTelemetry.Context.RuntimeContextSlot.Dispose() -> void
OpenTelemetry.Context.ThreadLocalRuntimeContextSlot
OpenTelemetry.Metrics.IDeferredMeterProviderBuilder
+OpenTelemetry.Metrics.IDeferredMeterProviderBuilder.Configure(System.Action! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
OpenTelemetry.Metrics.MeterProvider
OpenTelemetry.Metrics.MeterProvider.MeterProvider() -> void
OpenTelemetry.Metrics.MeterProviderBuilder
OpenTelemetry.Metrics.MeterProviderBuilder.MeterProviderBuilder() -> void
OpenTelemetry.Trace.ActivityExtensions
OpenTelemetry.Trace.IDeferredTracerProviderBuilder
+OpenTelemetry.Trace.IDeferredTracerProviderBuilder.Configure(System.Action! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
OpenTelemetry.Trace.Link
+OpenTelemetry.Trace.Link.Attributes.get -> System.Collections.Generic.IEnumerable>?
OpenTelemetry.Trace.Link.Context.get -> OpenTelemetry.Trace.SpanContext
OpenTelemetry.Trace.Link.Equals(OpenTelemetry.Trace.Link other) -> bool
OpenTelemetry.Trace.Link.Link() -> void
OpenTelemetry.Trace.Link.Link(in OpenTelemetry.Trace.SpanContext spanContext) -> void
+OpenTelemetry.Trace.Link.Link(in OpenTelemetry.Trace.SpanContext spanContext, OpenTelemetry.Trace.SpanAttributes? attributes) -> void
OpenTelemetry.Trace.SpanAttributes
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, bool value) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, bool[]? values) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, double value) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, double[]? values) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, long value) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, long[]? values) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, string? value) -> void
+OpenTelemetry.Trace.SpanAttributes.Add(string! key, string?[]? values) -> void
OpenTelemetry.Trace.SpanAttributes.SpanAttributes() -> void
+OpenTelemetry.Trace.SpanAttributes.SpanAttributes(System.Collections.Generic.IEnumerable>! attributes) -> void
OpenTelemetry.Trace.SpanContext
OpenTelemetry.Trace.SpanContext.Equals(OpenTelemetry.Trace.SpanContext other) -> bool
OpenTelemetry.Trace.SpanContext.IsRemote.get -> bool
OpenTelemetry.Trace.SpanContext.IsValid.get -> bool
OpenTelemetry.Trace.SpanContext.SpanContext() -> void
OpenTelemetry.Trace.SpanContext.SpanContext(in System.Diagnostics.ActivityContext activityContext) -> void
+OpenTelemetry.Trace.SpanContext.SpanContext(in System.Diagnostics.ActivityTraceId traceId, in System.Diagnostics.ActivitySpanId spanId, System.Diagnostics.ActivityTraceFlags traceFlags, bool isRemote = false, System.Collections.Generic.IEnumerable>? traceState = null) -> void
OpenTelemetry.Trace.SpanContext.SpanId.get -> System.Diagnostics.ActivitySpanId
OpenTelemetry.Trace.SpanContext.TraceFlags.get -> System.Diagnostics.ActivityTraceFlags
OpenTelemetry.Trace.SpanContext.TraceId.get -> System.Diagnostics.ActivityTraceId
+OpenTelemetry.Trace.SpanContext.TraceState.get -> System.Collections.Generic.IEnumerable>!
OpenTelemetry.Trace.SpanKind
OpenTelemetry.Trace.SpanKind.Client = 3 -> OpenTelemetry.Trace.SpanKind
OpenTelemetry.Trace.SpanKind.Consumer = 5 -> OpenTelemetry.Trace.SpanKind
@@ -169,23 +135,46 @@ OpenTelemetry.Trace.SpanKind.Internal = 1 -> OpenTelemetry.Trace.SpanKind
OpenTelemetry.Trace.SpanKind.Producer = 4 -> OpenTelemetry.Trace.SpanKind
OpenTelemetry.Trace.SpanKind.Server = 2 -> OpenTelemetry.Trace.SpanKind
OpenTelemetry.Trace.Status
+OpenTelemetry.Trace.Status.Description.get -> string?
OpenTelemetry.Trace.Status.Equals(OpenTelemetry.Trace.Status other) -> bool
OpenTelemetry.Trace.Status.Status() -> void
OpenTelemetry.Trace.Status.StatusCode.get -> OpenTelemetry.Trace.StatusCode
+OpenTelemetry.Trace.Status.WithDescription(string? description) -> OpenTelemetry.Trace.Status
OpenTelemetry.Trace.StatusCode
OpenTelemetry.Trace.StatusCode.Error = 2 -> OpenTelemetry.Trace.StatusCode
OpenTelemetry.Trace.StatusCode.Ok = 1 -> OpenTelemetry.Trace.StatusCode
OpenTelemetry.Trace.StatusCode.Unset = 0 -> OpenTelemetry.Trace.StatusCode
OpenTelemetry.Trace.TelemetrySpan
+OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name, OpenTelemetry.Trace.SpanAttributes? attributes) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name, System.DateTimeOffset timestamp) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.AddEvent(string! name, System.DateTimeOffset timestamp, OpenTelemetry.Trace.SpanAttributes? attributes) -> OpenTelemetry.Trace.TelemetrySpan!
OpenTelemetry.Trace.TelemetrySpan.Context.get -> OpenTelemetry.Trace.SpanContext
OpenTelemetry.Trace.TelemetrySpan.Dispose() -> void
OpenTelemetry.Trace.TelemetrySpan.End() -> void
OpenTelemetry.Trace.TelemetrySpan.End(System.DateTimeOffset endTimestamp) -> void
OpenTelemetry.Trace.TelemetrySpan.IsRecording.get -> bool
OpenTelemetry.Trace.TelemetrySpan.ParentSpanId.get -> System.Diagnostics.ActivitySpanId
+OpenTelemetry.Trace.TelemetrySpan.RecordException(string? type, string? message, string? stacktrace) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.RecordException(System.Exception? ex) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, bool value) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, bool[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, double value) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, double[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, int value) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, int[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, string? value) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.TelemetrySpan.SetAttribute(string! key, string?[]? values) -> OpenTelemetry.Trace.TelemetrySpan!
OpenTelemetry.Trace.TelemetrySpan.SetStatus(OpenTelemetry.Trace.Status value) -> void
+OpenTelemetry.Trace.TelemetrySpan.UpdateName(string! name) -> OpenTelemetry.Trace.TelemetrySpan!
OpenTelemetry.Trace.Tracer
+OpenTelemetry.Trace.Tracer.StartActiveSpan(string! name, OpenTelemetry.Trace.SpanKind kind = OpenTelemetry.Trace.SpanKind.Internal, in OpenTelemetry.Trace.SpanContext parentContext = default(OpenTelemetry.Trace.SpanContext), OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.Tracer.StartActiveSpan(string! name, OpenTelemetry.Trace.SpanKind kind, in OpenTelemetry.Trace.TelemetrySpan? parentSpan, OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.Tracer.StartRootSpan(string! name, OpenTelemetry.Trace.SpanKind kind = OpenTelemetry.Trace.SpanKind.Internal, OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.Tracer.StartSpan(string! name, OpenTelemetry.Trace.SpanKind kind = OpenTelemetry.Trace.SpanKind.Internal, in OpenTelemetry.Trace.SpanContext parentContext = default(OpenTelemetry.Trace.SpanContext), OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
+OpenTelemetry.Trace.Tracer.StartSpan(string! name, OpenTelemetry.Trace.SpanKind kind, in OpenTelemetry.Trace.TelemetrySpan? parentSpan, OpenTelemetry.Trace.SpanAttributes? initialAttributes = null, System.Collections.Generic.IEnumerable? links = null, System.DateTimeOffset startTime = default(System.DateTimeOffset)) -> OpenTelemetry.Trace.TelemetrySpan!
OpenTelemetry.Trace.TracerProvider
+OpenTelemetry.Trace.TracerProvider.GetTracer(string! name, string? version = null) -> OpenTelemetry.Trace.Tracer!
OpenTelemetry.Trace.TracerProvider.TracerProvider() -> void
OpenTelemetry.Trace.TracerProviderBuilder
OpenTelemetry.Trace.TracerProviderBuilder.TracerProviderBuilder() -> void
@@ -196,9 +185,14 @@ override OpenTelemetry.Context.Propagation.PropagationContext.GetHashCode() -> i
override OpenTelemetry.Context.ThreadLocalRuntimeContextSlot.Dispose(bool disposing) -> void
override OpenTelemetry.Context.ThreadLocalRuntimeContextSlot.Get() -> T
override OpenTelemetry.Context.ThreadLocalRuntimeContextSlot.Set(T value) -> void
+override OpenTelemetry.Trace.Link.Equals(object? obj) -> bool
override OpenTelemetry.Trace.Link.GetHashCode() -> int
+override OpenTelemetry.Trace.SpanContext.Equals(object? obj) -> bool
override OpenTelemetry.Trace.SpanContext.GetHashCode() -> int
+override OpenTelemetry.Trace.Status.Equals(object? obj) -> bool
override OpenTelemetry.Trace.Status.GetHashCode() -> int
+override OpenTelemetry.Trace.Status.ToString() -> string!
+override OpenTelemetry.Trace.TracerProvider.Dispose(bool disposing) -> void
static OpenTelemetry.ActivityContextExtensions.IsValid(this System.Diagnostics.ActivityContext ctx) -> bool
static OpenTelemetry.Baggage.ClearBaggage(OpenTelemetry.Baggage baggage = default(OpenTelemetry.Baggage)) -> OpenTelemetry.Baggage
static OpenTelemetry.Baggage.Current.get -> OpenTelemetry.Baggage
@@ -207,6 +201,10 @@ static OpenTelemetry.Baggage.operator !=(OpenTelemetry.Baggage left, OpenTelemet
static OpenTelemetry.Baggage.operator ==(OpenTelemetry.Baggage left, OpenTelemetry.Baggage right) -> bool
static OpenTelemetry.Context.Propagation.PropagationContext.operator !=(OpenTelemetry.Context.Propagation.PropagationContext left, OpenTelemetry.Context.Propagation.PropagationContext right) -> bool
static OpenTelemetry.Context.Propagation.PropagationContext.operator ==(OpenTelemetry.Context.Propagation.PropagationContext left, OpenTelemetry.Context.Propagation.PropagationContext right) -> bool
+static OpenTelemetry.Trace.ActivityExtensions.GetStatus(this System.Diagnostics.Activity! activity) -> OpenTelemetry.Trace.Status
+static OpenTelemetry.Trace.ActivityExtensions.RecordException(this System.Diagnostics.Activity! activity, System.Exception? ex) -> void
+static OpenTelemetry.Trace.ActivityExtensions.RecordException(this System.Diagnostics.Activity! activity, System.Exception? ex, in System.Diagnostics.TagList tags) -> void
+static OpenTelemetry.Trace.ActivityExtensions.SetStatus(this System.Diagnostics.Activity! activity, OpenTelemetry.Trace.Status status) -> void
static OpenTelemetry.Trace.Link.operator !=(OpenTelemetry.Trace.Link link1, OpenTelemetry.Trace.Link link2) -> bool
static OpenTelemetry.Trace.Link.operator ==(OpenTelemetry.Trace.Link link1, OpenTelemetry.Trace.Link link2) -> bool
static OpenTelemetry.Trace.SpanContext.implicit operator System.Diagnostics.ActivityContext(OpenTelemetry.Trace.SpanContext spanContext) -> System.Diagnostics.ActivityContext
@@ -214,6 +212,9 @@ static OpenTelemetry.Trace.SpanContext.operator !=(OpenTelemetry.Trace.SpanConte
static OpenTelemetry.Trace.SpanContext.operator ==(OpenTelemetry.Trace.SpanContext spanContext1, OpenTelemetry.Trace.SpanContext spanContext2) -> bool
static OpenTelemetry.Trace.Status.operator !=(OpenTelemetry.Trace.Status status1, OpenTelemetry.Trace.Status status2) -> bool
static OpenTelemetry.Trace.Status.operator ==(OpenTelemetry.Trace.Status status1, OpenTelemetry.Trace.Status status2) -> bool
+static OpenTelemetry.Trace.Tracer.CurrentSpan.get -> OpenTelemetry.Trace.TelemetrySpan!
+static OpenTelemetry.Trace.Tracer.WithSpan(OpenTelemetry.Trace.TelemetrySpan? span) -> OpenTelemetry.Trace.TelemetrySpan?
+static OpenTelemetry.Trace.TracerProvider.Default.get -> OpenTelemetry.Trace.TracerProvider!
static readonly OpenTelemetry.Trace.Status.Error -> OpenTelemetry.Trace.Status
static readonly OpenTelemetry.Trace.Status.Ok -> OpenTelemetry.Trace.Status
static readonly OpenTelemetry.Trace.Status.Unset -> OpenTelemetry.Trace.Status
diff --git a/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt
index b3db39f4c47..e69de29bb2d 100644
--- a/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt
@@ -1 +0,0 @@
-override OpenTelemetry.Trace.TracerProvider.Dispose(bool disposing) -> void
diff --git a/src/OpenTelemetry.Api/CHANGELOG.md b/src/OpenTelemetry.Api/CHANGELOG.md
index 9ec4e76c4a5..033331f895e 100644
--- a/src/OpenTelemetry.Api/CHANGELOG.md
+++ b/src/OpenTelemetry.Api/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md
index 953a736999c..043a395cc58 100644
--- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md b/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md
index db39656ec81..42ad0c3b524 100644
--- a/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Shipped.txt b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Shipped.txt
index cd9c686fd14..4b7af046438 100644
--- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Shipped.txt
+++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Shipped.txt
@@ -1,15 +1,19 @@
#nullable enable
-OpenTelemetry.Exporter.OtlpExporterOptions
~OpenTelemetry.Exporter.OtlpExporterOptions.BatchExportProcessorOptions.get -> OpenTelemetry.BatchExportProcessorOptions
~OpenTelemetry.Exporter.OtlpExporterOptions.BatchExportProcessorOptions.set -> void
~OpenTelemetry.Exporter.OtlpExporterOptions.Endpoint.get -> System.Uri
~OpenTelemetry.Exporter.OtlpExporterOptions.Endpoint.set -> void
-OpenTelemetry.Exporter.OtlpExporterOptions.ExportProcessorType.get -> OpenTelemetry.ExportProcessorType
-OpenTelemetry.Exporter.OtlpExporterOptions.ExportProcessorType.set -> void
~OpenTelemetry.Exporter.OtlpExporterOptions.Headers.get -> string
~OpenTelemetry.Exporter.OtlpExporterOptions.Headers.set -> void
~OpenTelemetry.Exporter.OtlpExporterOptions.HttpClientFactory.get -> System.Func
~OpenTelemetry.Exporter.OtlpExporterOptions.HttpClientFactory.set -> void
+~OpenTelemetry.Exporter.OtlpMetricExporter.OtlpMetricExporter(OpenTelemetry.Exporter.OtlpExporterOptions options) -> void
+~OpenTelemetry.Exporter.OtlpTraceExporter.OtlpTraceExporter(OpenTelemetry.Exporter.OtlpExporterOptions options) -> void
+~override OpenTelemetry.Exporter.OtlpMetricExporter.Export(in OpenTelemetry.Batch metrics) -> OpenTelemetry.ExportResult
+~override OpenTelemetry.Exporter.OtlpTraceExporter.Export(in OpenTelemetry.Batch activityBatch) -> OpenTelemetry.ExportResult
+OpenTelemetry.Exporter.OtlpExporterOptions
+OpenTelemetry.Exporter.OtlpExporterOptions.ExportProcessorType.get -> OpenTelemetry.ExportProcessorType
+OpenTelemetry.Exporter.OtlpExporterOptions.ExportProcessorType.set -> void
OpenTelemetry.Exporter.OtlpExporterOptions.OtlpExporterOptions() -> void
OpenTelemetry.Exporter.OtlpExporterOptions.Protocol.get -> OpenTelemetry.Exporter.OtlpExportProtocol
OpenTelemetry.Exporter.OtlpExporterOptions.Protocol.set -> void
@@ -18,18 +22,19 @@ OpenTelemetry.Exporter.OtlpExporterOptions.TimeoutMilliseconds.set -> void
OpenTelemetry.Exporter.OtlpExportProtocol
OpenTelemetry.Exporter.OtlpExportProtocol.Grpc = 0 -> OpenTelemetry.Exporter.OtlpExportProtocol
OpenTelemetry.Exporter.OtlpExportProtocol.HttpProtobuf = 1 -> OpenTelemetry.Exporter.OtlpExportProtocol
+OpenTelemetry.Exporter.OtlpLogExporter
+OpenTelemetry.Exporter.OtlpLogExporter.OtlpLogExporter(OpenTelemetry.Exporter.OtlpExporterOptions! options) -> void
OpenTelemetry.Exporter.OtlpMetricExporter
-~OpenTelemetry.Exporter.OtlpMetricExporter.OtlpMetricExporter(OpenTelemetry.Exporter.OtlpExporterOptions options) -> void
OpenTelemetry.Exporter.OtlpTraceExporter
-~OpenTelemetry.Exporter.OtlpTraceExporter.OtlpTraceExporter(OpenTelemetry.Exporter.OtlpExporterOptions options) -> void
OpenTelemetry.Logs.OtlpLogExporterHelperExtensions
OpenTelemetry.Metrics.OtlpMetricExporterExtensions
OpenTelemetry.Trace.OtlpTraceExporterHelperExtensions
-~override OpenTelemetry.Exporter.OtlpMetricExporter.Export(in OpenTelemetry.Batch metrics) -> OpenTelemetry.ExportResult
+override OpenTelemetry.Exporter.OtlpLogExporter.Export(in OpenTelemetry.Batch logRecordBatch) -> OpenTelemetry.ExportResult
override OpenTelemetry.Exporter.OtlpMetricExporter.OnShutdown(int timeoutMilliseconds) -> bool
-~override OpenTelemetry.Exporter.OtlpTraceExporter.Export(in OpenTelemetry.Batch activityBatch) -> OpenTelemetry.ExportResult
override OpenTelemetry.Exporter.OtlpTraceExporter.OnShutdown(int timeoutMilliseconds) -> bool
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
+static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions, string? name, System.Action? configureExporterAndProcessor) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
+static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions, string? name, System.Action? configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions, System.Action! configureExporterAndProcessor) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions, System.Action! configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
static OpenTelemetry.Metrics.OtlpMetricExporterExtensions.AddOtlpExporter(this OpenTelemetry.Metrics.MeterProviderBuilder! builder) -> OpenTelemetry.Metrics.MeterProviderBuilder!
diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Unshipped.txt
index f90e2e4dfbd..e69de29bb2d 100644
--- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Unshipped.txt
@@ -1,6 +0,0 @@
-#nullable enable
-OpenTelemetry.Exporter.OtlpLogExporter
-OpenTelemetry.Exporter.OtlpLogExporter.OtlpLogExporter(OpenTelemetry.Exporter.OtlpExporterOptions! options) -> void
-override OpenTelemetry.Exporter.OtlpLogExporter.Export(in OpenTelemetry.Batch logRecordBatch) -> OpenTelemetry.ExportResult
-static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions, string? name, System.Action? configureExporterAndProcessor) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
-static OpenTelemetry.Logs.OtlpLogExporterHelperExtensions.AddOtlpExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions! loggerOptions, string? name, System.Action? configure) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions!
diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md
index 5b4498446c9..284ce9c8e64 100644
--- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md b/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md
index 0e26e87ca65..babc9483100 100644
--- a/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Extensions.Hosting/.publicApi/Stable/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Extensions.Hosting/.publicApi/Stable/PublicAPI.Unshipped.txt
index 8b137891791..e69de29bb2d 100644
--- a/src/OpenTelemetry.Extensions.Hosting/.publicApi/Stable/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Extensions.Hosting/.publicApi/Stable/PublicAPI.Unshipped.txt
@@ -1 +0,0 @@
-
diff --git a/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md b/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md
index 9170bc36103..ef7152a1205 100644
--- a/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md
+++ b/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Extensions.Propagators/CHANGELOG.md b/src/OpenTelemetry.Extensions.Propagators/CHANGELOG.md
index 0e62ed845b1..bf85dec5460 100644
--- a/src/OpenTelemetry.Extensions.Propagators/CHANGELOG.md
+++ b/src/OpenTelemetry.Extensions.Propagators/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
diff --git a/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md b/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md
index f540df67e01..577ddc62a97 100644
--- a/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md
+++ b/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0-beta.1
+
+Released 2023-Dec-08
+
* Remove obsolete `TracerShim(Tracer, TextMapPropagator)` constructor.
Use `TracerShim(TracerProvider)`
or `TracerShim(TracerProvider, TextMapPropagator)` constructors.
diff --git a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt
index 77ed02bc8c8..ae4fe170436 100644
--- a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt
+++ b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Shipped.txt
@@ -1,28 +1,5 @@
#nullable enable
~OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator
-OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter! exporter) -> void
-OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[]?
-OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void
-OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func?
-OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void
-OpenTelemetry.Metrics.Metric.Description.get -> string!
-OpenTelemetry.Metrics.Metric.MeterName.get -> string!
-OpenTelemetry.Metrics.Metric.MeterVersion.get -> string!
-OpenTelemetry.Metrics.Metric.Name.get -> string!
-OpenTelemetry.Metrics.Metric.Unit.get -> string!
-OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string?
-OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void
-OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string?
-OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void
-OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string![]?
-OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void
-OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter! exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void
-override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder!
-override OpenTelemetry.Trace.TracerProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
-readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter!
-static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool
-static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool
-static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration!
abstract OpenTelemetry.BaseExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult
abstract OpenTelemetry.BaseExportProcessor.OnExport(T! data) -> void
abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult
@@ -150,8 +127,11 @@ OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxScale.set
OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.get -> int
OpenTelemetry.Metrics.Base2ExponentialBucketHistogramConfiguration.MaxSize.set -> void
OpenTelemetry.Metrics.BaseExportingMetricReader
+OpenTelemetry.Metrics.BaseExportingMetricReader.BaseExportingMetricReader(OpenTelemetry.BaseExporter! exporter) -> void
OpenTelemetry.Metrics.BaseExportingMetricReader.SupportedExportModes.get -> OpenTelemetry.Metrics.ExportModes
OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration
+OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.get -> double[]?
+OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.Boundaries.set -> void
OpenTelemetry.Metrics.ExplicitBucketHistogramConfiguration.ExplicitBucketHistogramConfiguration() -> void
OpenTelemetry.Metrics.ExponentialHistogramBuckets
OpenTelemetry.Metrics.ExponentialHistogramBuckets.Enumerator
@@ -185,15 +165,23 @@ OpenTelemetry.Metrics.HistogramConfiguration.HistogramConfiguration() -> void
OpenTelemetry.Metrics.HistogramConfiguration.RecordMinMax.get -> bool
OpenTelemetry.Metrics.HistogramConfiguration.RecordMinMax.set -> void
OpenTelemetry.Metrics.IPullMetricExporter
+OpenTelemetry.Metrics.IPullMetricExporter.Collect.get -> System.Func?
+OpenTelemetry.Metrics.IPullMetricExporter.Collect.set -> void
OpenTelemetry.Metrics.MeterProviderBuilderBase
OpenTelemetry.Metrics.MeterProviderBuilderBase.Build() -> OpenTelemetry.Metrics.MeterProvider!
OpenTelemetry.Metrics.MeterProviderBuilderBase.MeterProviderBuilderBase() -> void
OpenTelemetry.Metrics.MeterProviderBuilderExtensions
OpenTelemetry.Metrics.MeterProviderExtensions
OpenTelemetry.Metrics.Metric
+OpenTelemetry.Metrics.Metric.Description.get -> string!
OpenTelemetry.Metrics.Metric.GetMetricPoints() -> OpenTelemetry.Metrics.MetricPointsAccessor
+OpenTelemetry.Metrics.Metric.MeterName.get -> string!
+OpenTelemetry.Metrics.Metric.MeterTags.get -> System.Collections.Generic.IEnumerable>?
+OpenTelemetry.Metrics.Metric.MeterVersion.get -> string!
OpenTelemetry.Metrics.Metric.MetricType.get -> OpenTelemetry.Metrics.MetricType
+OpenTelemetry.Metrics.Metric.Name.get -> string!
OpenTelemetry.Metrics.Metric.Temporality.get -> OpenTelemetry.Metrics.AggregationTemporality
+OpenTelemetry.Metrics.Metric.Unit.get -> string!
OpenTelemetry.Metrics.MetricPoint
OpenTelemetry.Metrics.MetricPoint.EndTime.get -> System.DateTimeOffset
OpenTelemetry.Metrics.MetricPoint.GetExponentialHistogramData() -> OpenTelemetry.Metrics.ExponentialHistogramData!
@@ -232,7 +220,13 @@ OpenTelemetry.Metrics.MetricReaderTemporalityPreference
OpenTelemetry.Metrics.MetricReaderTemporalityPreference.Cumulative = 1 -> OpenTelemetry.Metrics.MetricReaderTemporalityPreference
OpenTelemetry.Metrics.MetricReaderTemporalityPreference.Delta = 2 -> OpenTelemetry.Metrics.MetricReaderTemporalityPreference
OpenTelemetry.Metrics.MetricStreamConfiguration
+OpenTelemetry.Metrics.MetricStreamConfiguration.Description.get -> string?
+OpenTelemetry.Metrics.MetricStreamConfiguration.Description.set -> void
OpenTelemetry.Metrics.MetricStreamConfiguration.MetricStreamConfiguration() -> void
+OpenTelemetry.Metrics.MetricStreamConfiguration.Name.get -> string?
+OpenTelemetry.Metrics.MetricStreamConfiguration.Name.set -> void
+OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.get -> string![]?
+OpenTelemetry.Metrics.MetricStreamConfiguration.TagKeys.set -> void
OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricType.DoubleGauge = 45 -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricType.DoubleSum = 29 -> OpenTelemetry.Metrics.MetricType
@@ -244,6 +238,7 @@ OpenTelemetry.Metrics.MetricType.LongSum = 26 -> OpenTelemetry.Metrics.MetricTyp
OpenTelemetry.Metrics.MetricType.LongSumNonMonotonic = 138 -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricTypeExtensions
OpenTelemetry.Metrics.PeriodicExportingMetricReader
+OpenTelemetry.Metrics.PeriodicExportingMetricReader.PeriodicExportingMetricReader(OpenTelemetry.BaseExporter! exporter, int exportIntervalMilliseconds = 60000, int exportTimeoutMilliseconds = 30000) -> void
OpenTelemetry.Metrics.PeriodicExportingMetricReaderOptions
OpenTelemetry.Metrics.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds.get -> int?
OpenTelemetry.Metrics.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds.set -> void
@@ -346,6 +341,7 @@ override OpenTelemetry.Logs.OpenTelemetryLoggerProvider.Dispose(bool disposing)
override OpenTelemetry.Metrics.BaseExportingMetricReader.Dispose(bool disposing) -> void
override OpenTelemetry.Metrics.BaseExportingMetricReader.OnCollect(int timeoutMilliseconds) -> bool
override OpenTelemetry.Metrics.BaseExportingMetricReader.OnShutdown(int timeoutMilliseconds) -> bool
+override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Metrics.MeterProviderBuilder!
override OpenTelemetry.Metrics.MeterProviderBuilderBase.AddMeter(params string![]! names) -> OpenTelemetry.Metrics.MeterProviderBuilder!
override OpenTelemetry.Metrics.PeriodicExportingMetricReader.Dispose(bool disposing) -> void
override OpenTelemetry.Metrics.PeriodicExportingMetricReader.OnShutdown(int timeoutMilliseconds) -> bool
@@ -357,10 +353,12 @@ override OpenTelemetry.Trace.ParentBasedSampler.ShouldSample(in OpenTelemetry.Tr
override OpenTelemetry.Trace.SamplingResult.Equals(object? obj) -> bool
override OpenTelemetry.Trace.SamplingResult.GetHashCode() -> int
override OpenTelemetry.Trace.TraceIdRatioBasedSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult
+override OpenTelemetry.Trace.TracerProviderBuilderBase.AddInstrumentation(System.Func! instrumentationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
override OpenTelemetry.Trace.TracerProviderBuilderBase.AddLegacySource(string! operationName) -> OpenTelemetry.Trace.TracerProviderBuilder!
override OpenTelemetry.Trace.TracerProviderBuilderBase.AddSource(params string![]! names) -> OpenTelemetry.Trace.TracerProviderBuilder!
override sealed OpenTelemetry.BaseExportProcessor.OnStart(T! data) -> void
readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter!
+readonly OpenTelemetry.Metrics.BaseExportingMetricReader.exporter -> OpenTelemetry.BaseExporter!
static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.AddOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder! builder) -> Microsoft.Extensions.Logging.ILoggingBuilder!
static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.AddOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder! builder, System.Action? configure) -> Microsoft.Extensions.Logging.ILoggingBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddReader(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Metrics.MetricReader! reader) -> OpenTelemetry.Metrics.MeterProviderBuilder!
@@ -374,6 +372,9 @@ static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(th
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetMaxMetricPointsPerMetricStream(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, int maxMetricPointsPerMetricStream) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetMaxMetricStreams(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, int maxMetricStreams) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.SetResourceBuilder(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, OpenTelemetry.Resources.ResourceBuilder! resourceBuilder) -> OpenTelemetry.Metrics.MeterProviderBuilder!
+static OpenTelemetry.Metrics.MeterProviderExtensions.ForceFlush(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool
+static OpenTelemetry.Metrics.MeterProviderExtensions.Shutdown(this OpenTelemetry.Metrics.MeterProvider! provider, int timeoutMilliseconds = -1) -> bool
+static OpenTelemetry.Metrics.MetricStreamConfiguration.Drop.get -> OpenTelemetry.Metrics.MetricStreamConfiguration!
static OpenTelemetry.Metrics.MetricTypeExtensions.IsDouble(this OpenTelemetry.Metrics.MetricType self) -> bool
static OpenTelemetry.Metrics.MetricTypeExtensions.IsGauge(this OpenTelemetry.Metrics.MetricType self) -> bool
static OpenTelemetry.Metrics.MetricTypeExtensions.IsHistogram(this OpenTelemetry.Metrics.MetricType self) -> bool
diff --git a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt
index 01e38e9263f..e69de29bb2d 100644
--- a/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt
@@ -1 +0,0 @@
-OpenTelemetry.Metrics.Metric.MeterTags.get -> System.Collections.Generic.IEnumerable>?
diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md
index 8c657465f88..faa14974dfe 100644
--- a/src/OpenTelemetry/CHANGELOG.md
+++ b/src/OpenTelemetry/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.7.0
+
+Released 2023-Dec-08
+
## 1.7.0-rc.1
Released 2023-Nov-29
From 2a850d64983b2ab358974fd09d829d0fb1ff5414 Mon Sep 17 00:00:00 2001
From: Cijo Thomas
Date: Fri, 8 Dec 2023 18:06:21 -0800
Subject: [PATCH 09/32] Add main readme for traces with best practices (#5144)
---
docs/trace/README.md | 49 +++++++++++++++++++
.../Controllers/WeatherForecastController.cs | 2 +-
2 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 docs/trace/README.md
diff --git a/docs/trace/README.md b/docs/trace/README.md
new file mode 100644
index 00000000000..e9925cf6565
--- /dev/null
+++ b/docs/trace/README.md
@@ -0,0 +1,49 @@
+# OpenTelemetry .NET Traces
+
+## Best Practices
+
+### ActivitySource singleton
+
+`ActivitySource` SHOULD only be created once and reused throughout the
+application lifetime. This
+[example](./getting-started-console/Program.cs) shows how
+`ActivitySource` is created as a `static` field and then used in the
+application. You could also look at this ASP.NET Core
+[example](../../examples/AspNetCore/Program.cs) which shows a more Dependency
+Injection friendly way of doing this by extracting the `ActivitySource` into a
+dedicated class called
+[Instrumentation](../../examples/AspNetCore/Instrumentation.cs) which is then
+added as a `Singleton` service.
+
+### Manually creating Activities
+
+As shown in the [getting started](getting-started-console/README.md) guide, it
+is very easy to manually create `Activity`. Due to this, it can be tempting to
+create too many activities (eg: for each method call). In addition to being
+expensive, excessive activities can also make trace visualization harder.
+Instead of manually creating `Activity`, check if you can leverage
+instrumentation libraries, such as [ASP.NET
+Core](../../src/OpenTelemetry.Instrumentation.AspNetCore/README.md),
+[HttpClient](../../src/OpenTelemetry.Instrumentation.Http/README.md) which will
+not only create and populate `Activity` with tags(attributes), but also take
+care of propagating/restoring the context across process boundaries. If the
+`Activity` produced by the instrumentation library is missing some information
+you need, it is generally recommended to enrich the existing Activity with that
+information, as opposed to creating a new one.
+
+## Common issues that lead to missing traces
+
+- The `ActivitySource` used to create the `Activity` is not added to the
+ `TracerProvider`. Use `AddSource` method to enable the activity from a given
+ `ActivitySource`.
+- `TracerProvider` is disposed too early. You need to ensure that the
+ `TracerProvider` instance is kept active for traces to be collected. In a
+ typical application, a single TracerProvider is built at application startup,
+ and is disposed of at application shutdown. For an ASP.NET Core application,
+ use `AddOpenTelemetry` and `WithTraces` methods from the
+ `OpenTelemetry.Extensions.Hosting` package to correctly setup
+ `TracerProvider`. Here's a [sample ASP.NET Core
+ app](../../examples/AspNetCore/Program.cs) for reference. For simpler
+ applications such as Console apps, refer to this
+ [example](../../docs/trace/getting-started-console/Program.cs).
+- TODO: Sampling
diff --git a/examples/AspNetCore/Controllers/WeatherForecastController.cs b/examples/AspNetCore/Controllers/WeatherForecastController.cs
index 5cd6f2cfe8d..3d09fe9ed61 100644
--- a/examples/AspNetCore/Controllers/WeatherForecastController.cs
+++ b/examples/AspNetCore/Controllers/WeatherForecastController.cs
@@ -49,7 +49,7 @@ public IEnumerable Get()
// that calculating the forecast is an expensive operation and therefore
// something to be distinguished from the overall request.
// Note: Tags can be added to the current activity without the need for
- // a manual activity using Acitivty.Current?.SetTag()
+ // a manual activity using Activity.Current?.SetTag()
using var activity = this.activitySource.StartActivity("calculate forecast");
var rng = new Random();
From 13791e268e9ca6744f64c74951b718a8c7002bcc Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Fri, 8 Dec 2023 21:45:55 -0800
Subject: [PATCH 10/32] [sdk-logs] ExperimentalAttribute decorations for
experimental log APIs (#5151)
---
docs/diagnostics/experimental-apis/OTEL1000.md | 6 +++---
docs/diagnostics/experimental-apis/OTEL1001.md | 4 ++--
docs/diagnostics/experimental-apis/README.md | 2 +-
.../Logs/LogRecordAttributeList.cs | 2 +-
src/OpenTelemetry.Api/Logs/LogRecordData.cs | 2 +-
src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs | 2 +-
.../Logs/LogRecordSeverityExtensions.cs | 2 +-
src/OpenTelemetry.Api/Logs/Logger.cs | 2 +-
src/OpenTelemetry.Api/Logs/LoggerProvider.cs | 8 ++++----
.../Builder/LoggerProviderBuilderExtensions.cs | 3 +++
.../ILogger/OpenTelemetryLoggingExtensions.cs | 15 ++++++++++++---
src/OpenTelemetry/Logs/LogRecord.cs | 12 ++++++++++++
.../Logs/LoggerProviderExtensions.cs | 6 ++++++
src/OpenTelemetry/Sdk.cs | 8 +++++++-
src/Shared/DiagnosticDefinitions.cs | 2 +-
15 files changed, 56 insertions(+), 20 deletions(-)
diff --git a/docs/diagnostics/experimental-apis/OTEL1000.md b/docs/diagnostics/experimental-apis/OTEL1000.md
index 5febb4f7ab4..1ea4be023a3 100644
--- a/docs/diagnostics/experimental-apis/OTEL1000.md
+++ b/docs/diagnostics/experimental-apis/OTEL1000.md
@@ -34,9 +34,9 @@ exposing the same dependency injection surface we have for traces and metrics.
We are exposing these APIs to solve these issues and gather feedback about their
usefulness.
-## Log Bridge API
+## Logs Bridge API
-The OpenTelemetry Specification defines a Log Bridge API which is rooted off of
+The OpenTelemetry Specification defines a Logs Bridge API which is rooted off of
the `LoggerProvider` (`GetLogger`) and exposes a `Logger` API to submit log
-records. See [OTEL1001](./OTEL1001.md) for details about the Log Bridge API
+records. See [OTEL1001](./OTEL1001.md) for details about the Logs Bridge API
implementation status.
diff --git a/docs/diagnostics/experimental-apis/OTEL1001.md b/docs/diagnostics/experimental-apis/OTEL1001.md
index 66c1f7627ec..5386726e644 100644
--- a/docs/diagnostics/experimental-apis/OTEL1001.md
+++ b/docs/diagnostics/experimental-apis/OTEL1001.md
@@ -17,8 +17,8 @@ Experimental APIs may be changed or removed in the future.
The OpenTelemetry Specification defines a [Logs Bridge
API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md).
-The log bridge API is used by library authors to build log appenders which route
-messages from different log frameworks into OpenTelemetry.
+The Logs Bridge API is used by library authors to build log appenders which
+route messages from different log frameworks into OpenTelemetry.
Today the OpenTelemetry .NET log pipeline is built on top of the
Microsoft.Extensions.Logging `ILogger` \ `ILoggerProvider` \ `ILoggerFactory`
diff --git a/docs/diagnostics/experimental-apis/README.md b/docs/diagnostics/experimental-apis/README.md
index 6333099f527..afd25501928 100644
--- a/docs/diagnostics/experimental-apis/README.md
+++ b/docs/diagnostics/experimental-apis/README.md
@@ -23,7 +23,7 @@ Details: [OTEL1000](./OTEL1000.md)
### OTEL1001
-Description: Log Bridge API
+Description: Logs Bridge API
Details: [OTEL1001](./OTEL1001.md)
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordAttributeList.cs b/src/OpenTelemetry.Api/Logs/LogRecordAttributeList.cs
index 5f1497a34c2..e4367d41c6e 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordAttributeList.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordAttributeList.cs
@@ -20,7 +20,7 @@ namespace OpenTelemetry.Logs;
///
///
#if NET8_0_OR_GREATER
-[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordData.cs b/src/OpenTelemetry.Api/Logs/LogRecordData.cs
index cf7cc550dec..cb3c49292af 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordData.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordData.cs
@@ -17,7 +17,7 @@ namespace OpenTelemetry.Logs;
///
///
#if NET8_0_OR_GREATER
-[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs b/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs
index d3a0442cabb..9f48e71e854 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs
@@ -16,7 +16,7 @@ namespace OpenTelemetry.Logs;
///
///
#if NET8_0_OR_GREATER
-[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
diff --git a/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs b/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs
index cf22c26a23f..f171edbc9ca 100644
--- a/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs
+++ b/src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs
@@ -16,7 +16,7 @@ namespace OpenTelemetry.Logs;
///
///
#if NET8_0_OR_GREATER
-[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
diff --git a/src/OpenTelemetry.Api/Logs/Logger.cs b/src/OpenTelemetry.Api/Logs/Logger.cs
index b112a81cdbb..71baf7d611e 100644
--- a/src/OpenTelemetry.Api/Logs/Logger.cs
+++ b/src/OpenTelemetry.Api/Logs/Logger.cs
@@ -16,7 +16,7 @@ namespace OpenTelemetry.Logs;
///
/// WARNING: This is an experimental API which might change or be removed in the future. Use at your own risk.
#if NET8_0_OR_GREATER
-[Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
diff --git a/src/OpenTelemetry.Api/Logs/LoggerProvider.cs b/src/OpenTelemetry.Api/Logs/LoggerProvider.cs
index f29ec12d38c..c7993dc664a 100644
--- a/src/OpenTelemetry.Api/Logs/LoggerProvider.cs
+++ b/src/OpenTelemetry.Api/Logs/LoggerProvider.cs
@@ -43,7 +43,7 @@ protected LoggerProvider()
///
/// instance.
#if NET8_0_OR_GREATER
- [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public Logger GetLogger()
=> this.GetLogger(name: null, version: null);
@@ -54,7 +54,7 @@ public Logger GetLogger()
/// Optional name identifying the instrumentation library.
/// instance.
#if NET8_0_OR_GREATER
- [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public Logger GetLogger(string? name)
=> this.GetLogger(name, version: null);
@@ -66,7 +66,7 @@ public Logger GetLogger(string? name)
/// Optional version of the instrumentation library.
/// instance.
#if NET8_0_OR_GREATER
- [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public Logger GetLogger(string? name, string? version)
{
@@ -87,7 +87,7 @@ public Logger GetLogger(string? name, string? version)
/// .
/// if the logger was created.
#if NET8_0_OR_GREATER
- [Experimental(DiagnosticDefinitions.LogBridgeApiExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
protected virtual bool TryCreateLogger(
string? name,
diff --git a/src/OpenTelemetry/Logs/Builder/LoggerProviderBuilderExtensions.cs b/src/OpenTelemetry/Logs/Builder/LoggerProviderBuilderExtensions.cs
index 4ea08a0ff93..3fad4d173dc 100644
--- a/src/OpenTelemetry/Logs/Builder/LoggerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry/Logs/Builder/LoggerProviderBuilderExtensions.cs
@@ -15,6 +15,9 @@ namespace OpenTelemetry.Logs;
/// Contains extension methods for the class.
///
#if EXPOSE_EXPERIMENTAL_FEATURES
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
internal
diff --git a/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs b/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs
index a3512678bd4..f81045c00c0 100644
--- a/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs
+++ b/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs
@@ -76,6 +76,9 @@ public static ILoggingBuilder AddOpenTelemetry(
///
/// The to use.
/// The supplied for call chaining.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -90,7 +93,7 @@ public static ILoggingBuilder AddOpenTelemetry(
/// The supplied for call chaining.
internal
#endif
- static ILoggingBuilder UseOpenTelemetry(
+ static ILoggingBuilder UseOpenTelemetry(
this ILoggingBuilder builder)
=> AddOpenTelemetryInternal(builder, configureBuilder: null, configureOptions: null);
@@ -102,6 +105,9 @@ static ILoggingBuilder UseOpenTelemetry(
/// The to use.
/// Optional configuration action.
/// The supplied for call chaining.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -113,7 +119,7 @@ static ILoggingBuilder UseOpenTelemetry(
/// The supplied for call chaining.
internal
#endif
- static ILoggingBuilder UseOpenTelemetry(
+ static ILoggingBuilder UseOpenTelemetry(
this ILoggingBuilder builder,
Action configure)
{
@@ -131,6 +137,9 @@ static ILoggingBuilder UseOpenTelemetry(
/// Optional configuration action.
/// Optional configuration action.
/// The supplied for call chaining.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -143,7 +152,7 @@ static ILoggingBuilder UseOpenTelemetry(
/// The supplied for call chaining.
internal
#endif
- static ILoggingBuilder UseOpenTelemetry(
+ static ILoggingBuilder UseOpenTelemetry(
this ILoggingBuilder builder,
Action? configureBuilder,
Action? configureOptions)
diff --git a/src/OpenTelemetry/Logs/LogRecord.cs b/src/OpenTelemetry/Logs/LogRecord.cs
index 9344b56d09e..a2c06667614 100644
--- a/src/OpenTelemetry/Logs/LogRecord.cs
+++ b/src/OpenTelemetry/Logs/LogRecord.cs
@@ -2,6 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
using System.Diagnostics;
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Logging;
using OpenTelemetry.Internal;
@@ -277,6 +280,9 @@ public Exception? Exception
/// known at the source.
///
///
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -296,6 +302,9 @@ public Exception? Exception
/// Gets or sets the log .
///
///
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -314,6 +323,9 @@ public Exception? Exception
/// Gets the which emitted the .
///
///
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public Logger? Logger { get; internal set; }
#else
///
diff --git a/src/OpenTelemetry/Logs/LoggerProviderExtensions.cs b/src/OpenTelemetry/Logs/LoggerProviderExtensions.cs
index 98dcbbf0d54..66dbac5ad42 100644
--- a/src/OpenTelemetry/Logs/LoggerProviderExtensions.cs
+++ b/src/OpenTelemetry/Logs/LoggerProviderExtensions.cs
@@ -1,6 +1,9 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using OpenTelemetry.Internal;
namespace OpenTelemetry.Logs;
@@ -9,6 +12,9 @@ namespace OpenTelemetry.Logs;
/// Contains extension methods for the class.
///
#if EXPOSE_EXPERIMENTAL_FEATURES
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
internal
diff --git a/src/OpenTelemetry/Sdk.cs b/src/OpenTelemetry/Sdk.cs
index 7e2553e8cc4..15df83f2993 100644
--- a/src/OpenTelemetry/Sdk.cs
+++ b/src/OpenTelemetry/Sdk.cs
@@ -2,6 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
using System.Diagnostics;
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using System.Reflection;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Internal;
@@ -92,6 +95,9 @@ public static TracerProviderBuilder CreateTracerProviderBuilder()
/// WARNING: This is an experimental API which might change or be removed in the future. Use at your own risk.
/// instance, which is used
/// to build a .
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -105,7 +111,7 @@ public static TracerProviderBuilder CreateTracerProviderBuilder()
/// to build a .
internal
#endif
- static LoggerProviderBuilder CreateLoggerProviderBuilder()
+ static LoggerProviderBuilder CreateLoggerProviderBuilder()
{
return new LoggerProviderBuilderBase();
}
diff --git a/src/Shared/DiagnosticDefinitions.cs b/src/Shared/DiagnosticDefinitions.cs
index 7e6fb6af6cf..cc34e86c858 100644
--- a/src/Shared/DiagnosticDefinitions.cs
+++ b/src/Shared/DiagnosticDefinitions.cs
@@ -10,5 +10,5 @@ internal static class DiagnosticDefinitions
public const string ExperimentalApiUrlFormat = "https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/diagnostics/experimental-apis/README.md#{0}";
public const string LoggerProviderExperimentalApi = "OTEL1000";
- public const string LogBridgeApiExperimentalApi = "OTEL1001";
+ public const string LogsBridgeExperimentalApi = "OTEL1001";
}
From cd000be6ba0199f63b8e6e1e42a276154cdcc3fb Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Mon, 11 Dec 2023 10:24:43 -0800
Subject: [PATCH 11/32] Minor perf optimization (#5152)
---
src/OpenTelemetry/Internal/SelfDiagnosticsConfigRefresher.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/OpenTelemetry/Internal/SelfDiagnosticsConfigRefresher.cs b/src/OpenTelemetry/Internal/SelfDiagnosticsConfigRefresher.cs
index ba9544d39c6..3d14dc16e0b 100644
--- a/src/OpenTelemetry/Internal/SelfDiagnosticsConfigRefresher.cs
+++ b/src/OpenTelemetry/Internal/SelfDiagnosticsConfigRefresher.cs
@@ -5,7 +5,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.IO.MemoryMappedFiles;
-using System.Text;
namespace OpenTelemetry.Internal;
@@ -18,7 +17,7 @@ namespace OpenTelemetry.Internal;
///
internal class SelfDiagnosticsConfigRefresher : IDisposable
{
- public static readonly byte[] MessageOnNewFile = Encoding.UTF8.GetBytes("If you are seeing this message, it means that the OpenTelemetry SDK has successfully created the log file used to write self-diagnostic logs. This file will be appended with logs as they appear. If you do not see any logs following this line, it means no logs of the configured LogLevel is occurring. You may change the LogLevel to show lower log levels, so that logs of lower severities will be shown.\n");
+ public static readonly byte[] MessageOnNewFile = "If you are seeing this message, it means that the OpenTelemetry SDK has successfully created the log file used to write self-diagnostic logs. This file will be appended with logs as they appear. If you do not see any logs following this line, it means no logs of the configured LogLevel is occurring. You may change the LogLevel to show lower log levels, so that logs of lower severities will be shown.\n"u8.ToArray();
private const int ConfigurationUpdatePeriodMilliSeconds = 10000;
From 38468744a5fdd9a14c51aa6eb23ebc0b1b51317d Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Mon, 11 Dec 2023 12:17:18 -0800
Subject: [PATCH 12/32] [sdk-metrics] ExperimentalAttribute decorations for
experimental exemplar APIs (#5153)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
---
OpenTelemetry.sln | 1 +
build/Common.props | 2 +-
.../diagnostics/experimental-apis/OTEL1002.md | 30 +++++++++++++++++++
docs/diagnostics/experimental-apis/README.md | 6 ++++
.../Builder/MeterProviderBuilderExtensions.cs | 5 +++-
.../Exemplar/AlwaysOffExemplarFilter.cs | 10 ++++++-
.../Exemplar/AlwaysOnExemplarFilter.cs | 8 +++++
.../Metrics/Exemplar/Exemplar.cs | 8 +++++
.../Metrics/Exemplar/ExemplarFilter.cs | 8 +++++
.../Exemplar/TraceBasedExemplarFilter.cs | 8 +++++
src/Shared/DiagnosticDefinitions.cs | 1 +
11 files changed, 84 insertions(+), 3 deletions(-)
create mode 100644 docs/diagnostics/experimental-apis/OTEL1002.md
diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln
index f4d72580bb3..8a158c98cd6 100644
--- a/OpenTelemetry.sln
+++ b/OpenTelemetry.sln
@@ -332,6 +332,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "experimental-apis", "experi
ProjectSection(SolutionItems) = preProject
docs\diagnostics\experimental-apis\OTEL1000.md = docs\diagnostics\experimental-apis\OTEL1000.md
docs\diagnostics\experimental-apis\OTEL1001.md = docs\diagnostics\experimental-apis\OTEL1001.md
+ docs\diagnostics\experimental-apis\OTEL1002.md = docs\diagnostics\experimental-apis\OTEL1002.md
docs\diagnostics\experimental-apis\README.md = docs\diagnostics\experimental-apis\README.md
EndProjectSection
EndProject
diff --git a/build/Common.props b/build/Common.props
index 758306e5571..763c91d057a 100644
--- a/build/Common.props
+++ b/build/Common.props
@@ -10,7 +10,7 @@
enable
enable
- $(NoWarn);OTEL1000;OTEL1001
+ $(NoWarn);OTEL1000;OTEL1001;OTEL1002
diff --git a/docs/diagnostics/experimental-apis/OTEL1002.md b/docs/diagnostics/experimental-apis/OTEL1002.md
new file mode 100644
index 00000000000..8371f0d3bcd
--- /dev/null
+++ b/docs/diagnostics/experimental-apis/OTEL1002.md
@@ -0,0 +1,30 @@
+# OpenTelemetry .NET Diagnostic: OTEL1002
+
+## Overview
+
+This is an Experimental API diagnostic covering the following APIs:
+
+* `AlwaysOnExemplarFilter`
+* `AlwaysOffExemplarFilter`
+* `Exemplar`
+* `ExemplarFilter`
+* `MeterProviderBuilder.SetExemplarFilter` extension method
+* `TraceBasedExemplarFilter`
+
+Experimental APIs may be changed or removed in the future.
+
+## Details
+
+The OpenTelemetry Specification defines an [Exemplar
+API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar)
+in the Metrics SDK.
+
+From the specification:
+
+> Exemplars are example data points for aggregated data. They provide specific
+> context to otherwise general aggregations. Exemplars allow correlation between
+> aggregated metric data and the original API calls where measurements are
+> recorded.
+
+We are exposing these APIs experimentally until the specification declares them
+stable.
diff --git a/docs/diagnostics/experimental-apis/README.md b/docs/diagnostics/experimental-apis/README.md
index afd25501928..71a2d418fee 100644
--- a/docs/diagnostics/experimental-apis/README.md
+++ b/docs/diagnostics/experimental-apis/README.md
@@ -27,6 +27,12 @@ Description: Logs Bridge API
Details: [OTEL1001](./OTEL1001.md)
+### OTEL1002
+
+Description: Metrics Exemplar Support
+
+Details: [OTEL1002](./OTEL1002.md)
+
## Inactive
Experimental APIs which have been released stable or removed:
diff --git a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs
index 03c3d48eb1e..11844d3e7b4 100644
--- a/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderExtensions.cs
@@ -323,6 +323,9 @@ public static MeterProvider Build(this MeterProviderBuilder meterProviderBuilder
/// .
/// ExemplarFilter to use.
/// The supplied for chaining.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -334,7 +337,7 @@ public static MeterProvider Build(this MeterProviderBuilder meterProviderBuilder
/// The supplied for chaining.
internal
#endif
- static MeterProviderBuilder SetExemplarFilter(this MeterProviderBuilder meterProviderBuilder, ExemplarFilter exemplarFilter)
+ static MeterProviderBuilder SetExemplarFilter(this MeterProviderBuilder meterProviderBuilder, ExemplarFilter exemplarFilter)
{
Guard.ThrowIfNull(exemplarFilter);
diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs
index 8ab9f471fde..b6c7973b9d3 100644
--- a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs
+++ b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOffExemplarFilter.cs
@@ -1,6 +1,11 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Metrics;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -9,6 +14,9 @@ namespace OpenTelemetry.Metrics;
/// Using this ExemplarFilter is as good as disabling Exemplar feature.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -17,7 +25,7 @@ namespace OpenTelemetry.Metrics;
///
internal
#endif
- sealed class AlwaysOffExemplarFilter : ExemplarFilter
+sealed class AlwaysOffExemplarFilter : ExemplarFilter
{
///
public override bool ShouldSample(long value, ReadOnlySpan> tags)
diff --git a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs
index 49f4bfb5908..7be5d04db0f 100644
--- a/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs
+++ b/src/OpenTelemetry/Metrics/Exemplar/AlwaysOnExemplarFilter.cs
@@ -1,6 +1,11 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Metrics;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -8,6 +13,9 @@ namespace OpenTelemetry.Metrics;
/// An ExemplarFilter which makes all measurements eligible for being an Exemplar.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs b/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs
index 5efd77a59e9..d635a1a4ad4 100644
--- a/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs
+++ b/src/OpenTelemetry/Metrics/Exemplar/Exemplar.cs
@@ -1,6 +1,11 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
using System.Diagnostics;
namespace OpenTelemetry.Metrics;
@@ -10,6 +15,9 @@ namespace OpenTelemetry.Metrics;
/// Represents an Exemplar data.
///
/// WARNING: This is an experimental API which might change or be removed in the future. Use at your own risk.
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs
index ca2617d22b5..3af62b66c65 100644
--- a/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs
+++ b/src/OpenTelemetry/Metrics/Exemplar/ExemplarFilter.cs
@@ -1,6 +1,11 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
namespace OpenTelemetry.Metrics;
#if EXPOSE_EXPERIMENTAL_FEATURES
@@ -8,6 +13,9 @@ namespace OpenTelemetry.Metrics;
/// The base class for defining Exemplar Filter.
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs b/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs
index 8fcf364f41a..6d176f8a169 100644
--- a/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs
+++ b/src/OpenTelemetry/Metrics/Exemplar/TraceBasedExemplarFilter.cs
@@ -1,6 +1,11 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using OpenTelemetry.Internal;
+#endif
+
using System.Diagnostics;
namespace OpenTelemetry.Metrics;
@@ -11,6 +16,9 @@ namespace OpenTelemetry.Metrics;
/// which are recorded in the context of a sampled parent activity (span).
///
///
+#if NET8_0_OR_GREATER
+[Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/Shared/DiagnosticDefinitions.cs b/src/Shared/DiagnosticDefinitions.cs
index cc34e86c858..8d2bf49723e 100644
--- a/src/Shared/DiagnosticDefinitions.cs
+++ b/src/Shared/DiagnosticDefinitions.cs
@@ -11,4 +11,5 @@ internal static class DiagnosticDefinitions
public const string LoggerProviderExperimentalApi = "OTEL1000";
public const string LogsBridgeExperimentalApi = "OTEL1001";
+ public const string ExemplarExperimentalApi = "OTEL1002";
}
From 0680ae3f9b2fdfe030da4bc70d0a0be16bcda42c Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Mon, 11 Dec 2023 14:27:05 -0800
Subject: [PATCH 13/32] [hosting-logs] ExperimentalAttribute decorations for
experimental APIs (#5154)
---
.../OpenTelemetry.Extensions.Hosting.csproj | 5 +++--
.../OpenTelemetryBuilder.cs | 12 ++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj
index cc6b1b078a1..5e798a19f67 100644
--- a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj
+++ b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj
@@ -18,9 +18,10 @@
-
+
+
diff --git a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs
index c4820457ae3..3037f1f162c 100644
--- a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs
+++ b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs
@@ -1,6 +1,9 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Logging;
@@ -148,6 +151,9 @@ public OpenTelemetryBuilder WithTracing(Action configure)
///
/// The supplied for chaining
/// calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -180,6 +186,9 @@ OpenTelemetryBuilder WithLogging()
/// configuration callback.
/// The supplied for chaining
/// calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -210,6 +219,9 @@ OpenTelemetryBuilder WithLogging(Action configure)
/// cref="OpenTelemetryLoggerOptions"/> configuration callback.
/// The supplied for chaining
/// calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
From ffc17408fdcf734e878025b0d57982e806308072 Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Mon, 11 Dec 2023 15:17:36 -0800
Subject: [PATCH 14/32] [exporter-logs] Add ExperimentalAttribute decorations
for experimental APIs (#5155)
---
.../ConsoleExporterLoggingExtensions.cs | 12 ++++++++++++
.../OpenTelemetry.Exporter.Console.csproj | 1 +
.../InMemoryExporterLoggingExtensions.cs | 6 ++++++
.../OpenTelemetry.Exporter.InMemory.csproj | 5 +++--
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs
index afd5a15a3a4..6b024498cb7 100644
--- a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs
+++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs
@@ -1,6 +1,9 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using OpenTelemetry.Exporter;
@@ -42,6 +45,9 @@ public static OpenTelemetryLoggerOptions AddConsoleExporter(this OpenTelemetryLo
/// WARNING: This is an experimental API which might change or be removed in the future. Use at your own risk.
/// .
/// The supplied instance of to chain the calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -63,6 +69,9 @@ static LoggerProviderBuilder AddConsoleExporter(
/// .
/// Callback action for configuring .
/// The supplied instance of to chain the calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
@@ -87,6 +96,9 @@ static LoggerProviderBuilder AddConsoleExporter(
/// Name which is used when retrieving options.
/// Callback action for configuring .
/// The supplied instance of to chain the calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj b/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj
index 2cea6f1094d..46fec7d5e99 100644
--- a/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj
+++ b/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj
@@ -32,6 +32,7 @@
+
diff --git a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs
index 855c96f957f..982595f8824 100644
--- a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs
+++ b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs
@@ -1,6 +1,9 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
+#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
using OpenTelemetry.Exporter;
using OpenTelemetry.Internal;
@@ -36,6 +39,9 @@ public static OpenTelemetryLoggerOptions AddInMemoryExporter(
/// .
/// Collection which will be populated with the exported .
/// The supplied instance of to chain the calls.
+#if NET8_0_OR_GREATER
+ [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
+#endif
public
#else
///
diff --git a/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj b/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj
index ca347c71baf..7f7488e8c5a 100644
--- a/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj
+++ b/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj
@@ -21,9 +21,10 @@
-
+
+
From 0278deb7aedd133e3b9c12388960fccbadd7dd55 Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Mon, 11 Dec 2023 20:56:26 -0800
Subject: [PATCH 15/32] Minor perf improvement for AspNetCore instrumentation
(#5157)
---
.../Implementation/HttpInListener.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
index 471b131fc1e..a9aefacc005 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
@@ -39,7 +39,17 @@ internal class HttpInListener : ListenerHandler
private const string DiagnosticSourceName = "Microsoft.AspNetCore";
private const string UnknownHostName = "UNKNOWN-HOST";
- private static readonly Func> HttpRequestHeaderValuesGetter = (request, name) => request.Headers[name];
+ private static readonly Func> HttpRequestHeaderValuesGetter = (request, name) =>
+ {
+ if (request.Headers.TryGetValue(name, out var value))
+ {
+ // This causes allocation as the `StringValues` struct has to be casted to an `IEnumerable` object.
+ return value;
+ }
+
+ return Enumerable.Empty();
+ };
+
private static readonly PropertyFetcher ExceptionPropertyFetcher = new("Exception");
#if !NET6_0_OR_GREATER
From 486ee5809d52e7e349479554c8de8cb863338eb0 Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Tue, 12 Dec 2023 10:58:19 -0800
Subject: [PATCH 16/32] Remove unused code from Http instrumentation (#5159)
---
.../HttpRequestMessageContextPropagation.cs | 10 -----
.../Implementation/HttpTagHelper.cs | 40 -------------------
2 files changed, 50 deletions(-)
diff --git a/src/OpenTelemetry.Instrumentation.Http/HttpRequestMessageContextPropagation.cs b/src/OpenTelemetry.Instrumentation.Http/HttpRequestMessageContextPropagation.cs
index e1a02ef1696..91d2a5c18a7 100644
--- a/src/OpenTelemetry.Instrumentation.Http/HttpRequestMessageContextPropagation.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/HttpRequestMessageContextPropagation.cs
@@ -9,16 +9,6 @@ namespace OpenTelemetry.Instrumentation.Http;
internal static class HttpRequestMessageContextPropagation
{
- internal static Func> HeaderValuesGetter => (request, name) =>
- {
- if (request.Headers.TryGetValues(name, out var values))
- {
- return values;
- }
-
- return null;
- };
-
internal static Action HeaderValueSetter => (request, name, value) =>
{
request.Headers.Remove(name);
diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpTagHelper.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpTagHelper.cs
index 7b3b460c3a8..82d7fd11bf2 100644
--- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpTagHelper.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpTagHelper.cs
@@ -1,11 +1,6 @@
// 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;
///
@@ -13,35 +8,6 @@ namespace OpenTelemetry.Instrumentation.Http.Implementation;
///
internal static class HttpTagHelper
{
- private static readonly ConcurrentDictionary MethodOperationNameCache = new();
- private static readonly ConcurrentDictionary HttpMethodOperationNameCache = new();
- private static readonly ConcurrentDictionary HttpMethodNameCache = new();
-
- private static readonly Func ConvertMethodToOperationNameRef = ConvertMethodToOperationName;
- private static readonly Func ConvertHttpMethodToOperationNameRef = ConvertHttpMethodToOperationName;
- private static readonly Func ConvertHttpMethodToNameRef = ConvertHttpMethodToName;
-
- ///
- /// Gets the OpenTelemetry standard name for an activity based on its Http method.
- ///
- /// Http method.
- /// Activity name.
- public static string GetOperationNameForHttpMethod(string method) => MethodOperationNameCache.GetOrAdd(method, ConvertMethodToOperationNameRef);
-
- ///
- /// Gets the OpenTelemetry standard operation name for a span based on its .
- ///
- /// .
- /// Span operation name.
- public static string GetOperationNameForHttpMethod(HttpMethod method) => HttpMethodOperationNameCache.GetOrAdd(method, ConvertHttpMethodToOperationNameRef);
-
- ///
- /// Gets the OpenTelemetry standard method name for a span based on its .
- ///
- /// .
- /// Span method name.
- public static string GetNameForHttpMethod(HttpMethod method) => HttpMethodNameCache.GetOrAdd(method, ConvertHttpMethodToNameRef);
-
///
/// Gets the OpenTelemetry standard uri tag value for a span based on its request .
///
@@ -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();
}
From 7fec53d777148e8e6c9c1c86f6e33544fd6dfb69 Mon Sep 17 00:00:00 2001
From: Vishwesh Bankwar
Date: Tue, 12 Dec 2023 15:16:33 -0800
Subject: [PATCH 17/32] Rename extension classes for HttpClient and Asp.Net
Core (#5161)
---
.../.publicApi/PublicAPI.Unshipped.txt | 12 ++++++------
...InstrumentationMeterProviderBuilderExtensions.cs} | 2 +-
...nstrumentationTracerProviderBuilderExtensions.cs} | 2 +-
.../.publicApi/PublicAPI.Unshipped.txt | 12 ++++++------
...InstrumentationMeterProviderBuilderExtensions.cs} | 2 +-
...nstrumentationTracerProviderBuilderExtensions.cs} | 2 +-
6 files changed, 16 insertions(+), 16 deletions(-)
rename src/OpenTelemetry.Instrumentation.AspNetCore/{MeterProviderBuilderExtensions.cs => AspNetCoreInstrumentationMeterProviderBuilderExtensions.cs} (95%)
rename src/OpenTelemetry.Instrumentation.AspNetCore/{TracerProviderBuilderExtensions.cs => AspNetCoreInstrumentationTracerProviderBuilderExtensions.cs} (98%)
rename src/OpenTelemetry.Instrumentation.Http/{MeterProviderBuilderExtensions.cs => HttpClientInstrumentationMeterProviderBuilderExtensions.cs} (94%)
rename src/OpenTelemetry.Instrumentation.Http/{TracerProviderBuilderExtensions.cs => HttpClientInstrumentationTracerProviderBuilderExtensions.cs} (98%)
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt
index 859e71b936e..fc47928891a 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt
@@ -10,9 +10,9 @@ OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.F
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.Filter.set -> void
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.RecordException.get -> bool
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.RecordException.set -> void
-OpenTelemetry.Metrics.MeterProviderBuilderExtensions
-OpenTelemetry.Trace.TracerProviderBuilderExtensions
-static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
+OpenTelemetry.Metrics.AspNetCoreInstrumentationMeterProviderBuilderExtensions
+OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions
+static OpenTelemetry.Metrics.AspNetCoreInstrumentationMeterProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
+static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/MeterProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationMeterProviderBuilderExtensions.cs
similarity index 95%
rename from src/OpenTelemetry.Instrumentation.AspNetCore/MeterProviderBuilderExtensions.cs
rename to src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationMeterProviderBuilderExtensions.cs
index 925575ff40f..3da8c1de59d 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/MeterProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationMeterProviderBuilderExtensions.cs
@@ -12,7 +12,7 @@ namespace OpenTelemetry.Metrics;
///
/// Extension methods to simplify registering of ASP.NET Core request instrumentation.
///
-public static class MeterProviderBuilderExtensions
+public static class AspNetCoreInstrumentationMeterProviderBuilderExtensions
{
///
/// Enables the incoming requests automatic data collection for ASP.NET Core.
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationTracerProviderBuilderExtensions.cs
similarity index 98%
rename from src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
rename to src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationTracerProviderBuilderExtensions.cs
index 5bf6a77ded7..d37d77ae3fa 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationTracerProviderBuilderExtensions.cs
@@ -15,7 +15,7 @@ namespace OpenTelemetry.Trace;
///
/// Extension methods to simplify registering of ASP.NET Core request instrumentation.
///
-public static class TracerProviderBuilderExtensions
+public static class AspNetCoreInstrumentationTracerProviderBuilderExtensions
{
///
/// Enables the incoming requests automatic data collection for ASP.NET Core.
diff --git a/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt
index caa4690c8d6..a082f2c5bec 100644
--- a/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt
@@ -16,9 +16,9 @@ OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterH
OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.HttpClientTraceInstrumentationOptions() -> void
OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.RecordException.get -> bool
OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.RecordException.set -> void
-OpenTelemetry.Metrics.MeterProviderBuilderExtensions
-OpenTelemetry.Trace.TracerProviderBuilderExtensions
-static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
+OpenTelemetry.Metrics.HttpClientInstrumentationMeterProviderBuilderExtensions
+OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions
+static OpenTelemetry.Metrics.HttpClientInstrumentationMeterProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
+static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
diff --git a/src/OpenTelemetry.Instrumentation.Http/MeterProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationMeterProviderBuilderExtensions.cs
similarity index 94%
rename from src/OpenTelemetry.Instrumentation.Http/MeterProviderBuilderExtensions.cs
rename to src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationMeterProviderBuilderExtensions.cs
index e523518c3d6..24b9524696f 100644
--- a/src/OpenTelemetry.Instrumentation.Http/MeterProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationMeterProviderBuilderExtensions.cs
@@ -15,7 +15,7 @@ namespace OpenTelemetry.Metrics;
///
/// Extension methods to simplify registering of HttpClient instrumentation.
///
-public static class MeterProviderBuilderExtensions
+public static class HttpClientInstrumentationMeterProviderBuilderExtensions
{
///
/// Enables HttpClient instrumentation.
diff --git a/src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationTracerProviderBuilderExtensions.cs
similarity index 98%
rename from src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs
rename to src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationTracerProviderBuilderExtensions.cs
index 80855ed7f90..6015c183f2c 100644
--- a/src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationTracerProviderBuilderExtensions.cs
@@ -12,7 +12,7 @@ namespace OpenTelemetry.Trace;
///
/// Extension methods to simplify registering of HttpClient instrumentation.
///
-public static class TracerProviderBuilderExtensions
+public static class HttpClientInstrumentationTracerProviderBuilderExtensions
{
///
/// Enables HttpClient instrumentation.
From a73657476406c6ae1bdd6fd30b23e869646ada91 Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Tue, 12 Dec 2023 16:44:33 -0800
Subject: [PATCH 18/32] Minor refactoring for instrumentation libraries (#5162)
---
.../Implementation/HttpInMetricsListener.cs | 48 +++++++++----------
.../HttpHandlerMetricsDiagnosticListener.cs | 32 ++++++-------
2 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs
index 4fe276ae2cc..c2afcd02a81 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs
@@ -42,32 +42,12 @@ internal HttpInMetricsListener(string name)
{
}
- public override void OnEventWritten(string name, object payload)
- {
- switch (name)
- {
- case OnUnhandledDiagnosticsExceptionEvent:
- case OnUnhandledHostingExceptionEvent:
- {
- this.OnExceptionEventWritten(name, payload);
- }
-
- break;
- case OnStopEvent:
- {
- this.OnStopEventWritten(name, payload);
- }
-
- break;
- }
- }
-
- public void OnExceptionEventWritten(string name, object payload)
+ public static void OnExceptionEventWritten(string name, object payload)
{
// We need to use reflection here as the payload type is not a defined public type.
if (!TryFetchException(payload, out Exception exc) || !TryFetchHttpContext(payload, out HttpContext ctx))
{
- AspNetCoreInstrumentationEventSource.Log.NullPayload(nameof(HttpInMetricsListener), nameof(this.OnExceptionEventWritten), HttpServerRequestDurationMetricName);
+ AspNetCoreInstrumentationEventSource.Log.NullPayload(nameof(HttpInMetricsListener), nameof(OnExceptionEventWritten), HttpServerRequestDurationMetricName);
return;
}
@@ -88,12 +68,12 @@ static bool TryFetchHttpContext(object payload, out HttpContext ctx)
=> HttpContextPropertyFetcher.TryFetch(payload, out ctx) && ctx != null;
}
- public void OnStopEventWritten(string name, object payload)
+ public static void OnStopEventWritten(string name, object payload)
{
var context = payload as HttpContext;
if (context == null)
{
- AspNetCoreInstrumentationEventSource.Log.NullPayload(nameof(HttpInMetricsListener), EventName, HttpServerRequestDurationMetricName);
+ AspNetCoreInstrumentationEventSource.Log.NullPayload(nameof(HttpInMetricsListener), nameof(OnStopEventWritten), HttpServerRequestDurationMetricName);
return;
}
@@ -124,4 +104,24 @@ public void OnStopEventWritten(string name, object payload)
// TODO: Follow up with .NET team if we can continue to rely on this behavior.
HttpServerRequestDuration.Record(Activity.Current.Duration.TotalSeconds, tags);
}
+
+ public override void OnEventWritten(string name, object payload)
+ {
+ switch (name)
+ {
+ case OnUnhandledDiagnosticsExceptionEvent:
+ case OnUnhandledHostingExceptionEvent:
+ {
+ OnExceptionEventWritten(name, payload);
+ }
+
+ break;
+ case OnStopEvent:
+ {
+ OnStopEventWritten(name, payload);
+ }
+
+ break;
+ }
+ }
}
diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs
index 496b739f573..eb85c8fe23c 100644
--- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs
@@ -31,7 +31,7 @@ internal sealed class HttpHandlerMetricsDiagnosticListener : ListenerHandler
private static readonly PropertyFetcher StopExceptionFetcher = new("Exception");
private static readonly PropertyFetcher RequestFetcher = new("Request");
#if NET6_0_OR_GREATER
- private static readonly HttpRequestOptionsKey HttpRequestOptionsErrorKey = new HttpRequestOptionsKey(SemanticConventions.AttributeErrorType);
+ private static readonly HttpRequestOptionsKey HttpRequestOptionsErrorKey = new(SemanticConventions.AttributeErrorType);
#endif
public HttpHandlerMetricsDiagnosticListener(string name)
@@ -39,19 +39,7 @@ public HttpHandlerMetricsDiagnosticListener(string name)
{
}
- public override void OnEventWritten(string name, object payload)
- {
- if (name == OnUnhandledExceptionEvent)
- {
- this.OnExceptionEventWritten(Activity.Current, payload);
- }
- else if (name == OnStopEvent)
- {
- this.OnStopEventWritten(Activity.Current, payload);
- }
- }
-
- public void OnStopEventWritten(Activity activity, object payload)
+ public static void OnStopEventWritten(Activity activity, object payload)
{
if (TryFetchRequest(payload, out HttpRequestMessage request))
{
@@ -129,11 +117,11 @@ static bool TryFetchResponse(object payload, out HttpResponseMessage response) =
StopResponseFetcher.TryFetch(payload, out response) && response != null;
}
- public void OnExceptionEventWritten(Activity activity, object payload)
+ public static void OnExceptionEventWritten(Activity activity, object payload)
{
if (!TryFetchException(payload, out Exception exc) || !TryFetchRequest(payload, out HttpRequestMessage request))
{
- HttpInstrumentationEventSource.Log.NullPayload(nameof(HttpHandlerMetricsDiagnosticListener), nameof(this.OnExceptionEventWritten));
+ HttpInstrumentationEventSource.Log.NullPayload(nameof(HttpHandlerMetricsDiagnosticListener), nameof(OnExceptionEventWritten));
return;
}
@@ -173,4 +161,16 @@ static bool TryFetchRequest(object payload, out HttpRequestMessage request)
return true;
}
}
+
+ public override void OnEventWritten(string name, object payload)
+ {
+ if (name == OnStopEvent)
+ {
+ OnStopEventWritten(Activity.Current, payload);
+ }
+ else if (name == OnUnhandledExceptionEvent)
+ {
+ OnExceptionEventWritten(Activity.Current, payload);
+ }
+ }
}
From 5eaed735078258c74d2413789d2ca6b3561c6d0a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 13 Dec 2023 11:37:13 -0800
Subject: [PATCH 19/32] Bump github/codeql-action from 2 to 3 (#5167)
---
.github/workflows/codeql-analysis.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 1c65eae060c..ee706de7d0a 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -36,7 +36,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -47,7 +47,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@v2
+ uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell.
# https://git.io/JvXDl
@@ -61,4 +61,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@v3
From ecaa60173017d3c0aa8be3706a874ed2bac06cb7 Mon Sep 17 00:00:00 2001
From: Vishwesh Bankwar
Date: Wed, 13 Dec 2023 12:00:41 -0800
Subject: [PATCH 20/32] [HttpClient] Minor refactor (#5164)
---
.../HttpHandlerMetricsDiagnosticListener.cs | 12 ++----------
.../HttpWebRequestActivitySource.netfx.cs | 12 ++----------
2 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs
index eb85c8fe23c..c6a710e2dd0 100644
--- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs
@@ -46,16 +46,8 @@ public static void OnStopEventWritten(Activity activity, object payload)
// see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-metrics.md
TagList tags = default;
- if (RequestMethodHelper.KnownMethods.TryGetValue(request.Method.Method, out var httpMethod))
- {
- tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpRequestMethod, httpMethod));
- }
- else
- {
- // Set to default "_OTHER" as per spec.
- // https://github.com/open-telemetry/semantic-conventions/blob/v1.22.0/docs/http/http-spans.md#common-attributes
- tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpRequestMethod, "_OTHER"));
- }
+ var httpMethod = RequestMethodHelper.GetNormalizedHttpMethod(request.Method.Method);
+ tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpRequestMethod, httpMethod));
tags.Add(new KeyValuePair(SemanticConventions.AttributeServerAddress, request.RequestUri.Host));
tags.Add(new KeyValuePair(SemanticConventions.AttributeUrlScheme, request.RequestUri.Scheme));
diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs
index 63d3755672d..ea8e88abb5f 100644
--- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs
@@ -425,16 +425,8 @@ private static void ProcessResult(IAsyncResult asyncResult, AsyncCallback asyncC
TagList tags = default;
- if (RequestMethodHelper.KnownMethods.TryGetValue(request.Method, out var httpMethod))
- {
- tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpRequestMethod, httpMethod));
- }
- else
- {
- // Set to default "_OTHER" as per spec.
- // https://github.com/open-telemetry/semantic-conventions/blob/v1.22.0/docs/http/http-spans.md#common-attributes
- tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpRequestMethod, "_OTHER"));
- }
+ var httpMethod = RequestMethodHelper.GetNormalizedHttpMethod(request.Method);
+ tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpRequestMethod, httpMethod));
tags.Add(SemanticConventions.AttributeServerAddress, request.RequestUri.Host);
tags.Add(SemanticConventions.AttributeUrlScheme, request.RequestUri.Scheme);
From 080ed3d167411df7e19d3bcb960893c2c6db0fbe Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Wed, 13 Dec 2023 15:44:11 -0800
Subject: [PATCH 21/32] Add MinVerTagPrefix for AspNetCore and Http
instrumentation libraries (#5170)
---
build/RELEASING.md | 11 ++++++++++-
.../OpenTelemetry.Instrumentation.AspNetCore.csproj | 1 +
.../OpenTelemetry.Instrumentation.Http.csproj | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/build/RELEASING.md b/build/RELEASING.md
index 77b94aaf42e..9d942f92dc7 100644
--- a/build/RELEASING.md
+++ b/build/RELEASING.md
@@ -84,7 +84,16 @@ Only for Maintainers.
git push origin 1.0.0-rc9.7
```
- If releasing both, push both tags above.
+ If releasing only a particular non-core component which has a dedicated
+ MinverTagPrefix such as AspNetCore instrumentation, only add and push the
+ tag with that particular prefix. For example:
+
+ ```sh
+ git tag -a Instrumentation.AspNetCore-1.6.0 -m "1.6.0 of AspNetCore instrumentation library"
+ git push origin Instrumentation.AspNetCore-1.6.0
+ ```
+
+ If releasing multiple kinds of components, push both tags for each of them.
7. Go to the [list of
tags](https://github.com/open-telemetry/opentelemetry-dotnet/tags)
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
index 83b9e4e25bc..c96ded55241 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
@@ -4,6 +4,7 @@
$(TargetFrameworksForAspNetCoreInstrumentation)
ASP.NET Core instrumentation for OpenTelemetry .NET
$(PackageTags);distributed-tracing;AspNetCore
+ Instrumentation.AspNetCore-
true
diff --git a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj
index 32f80e31c21..55158028cde 100644
--- a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj
+++ b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj
@@ -4,6 +4,7 @@
$(TargetFrameworksForLibraries)
Http instrumentation for OpenTelemetry .NET
$(PackageTags);distributed-tracing
+ Instrumentation.Http-
true
From f77307b54e8fd133a2e785703d8734a9ba1fc16a Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Wed, 13 Dec 2023 16:55:27 -0800
Subject: [PATCH 22/32] Update CHANGELOG for 1.6.0 release of AspNetCore and
Http instrumentation libraries (#5171)
---
.../.publicApi/PublicAPI.Shipped.txt | 18 ++++++++++++++
.../.publicApi/PublicAPI.Unshipped.txt | 18 --------------
.../netstandard2.0/PublicAPI.Unshipped.txt | 2 --
.../CHANGELOG.md | 4 ++++
.../.publicApi/PublicAPI.Shipped.txt | 24 +++++++++++++++++++
.../.publicApi/PublicAPI.Unshipped.txt | 24 -------------------
.../CHANGELOG.md | 4 ++++
7 files changed, 50 insertions(+), 44 deletions(-)
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Shipped.txt b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Shipped.txt
index e69de29bb2d..fc47928891a 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Shipped.txt
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Shipped.txt
@@ -0,0 +1,18 @@
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.AspNetCoreTraceInstrumentationOptions() -> void
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithException.get -> System.Action
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithException.set -> void
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpRequest.get -> System.Action
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpRequest.set -> void
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpResponse.get -> System.Action
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpResponse.set -> void
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.Filter.get -> System.Func
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.Filter.set -> void
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.RecordException.get -> bool
+OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.RecordException.set -> void
+OpenTelemetry.Metrics.AspNetCoreInstrumentationMeterProviderBuilderExtensions
+OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions
+static OpenTelemetry.Metrics.AspNetCoreInstrumentationMeterProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
+static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt
index fc47928891a..e69de29bb2d 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/PublicAPI.Unshipped.txt
@@ -1,18 +0,0 @@
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.AspNetCoreTraceInstrumentationOptions() -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithException.get -> System.Action
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithException.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpRequest.get -> System.Action
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpRequest.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpResponse.get -> System.Action
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnrichWithHttpResponse.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.Filter.get -> System.Func
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.Filter.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.RecordException.get -> bool
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.RecordException.set -> void
-OpenTelemetry.Metrics.AspNetCoreInstrumentationMeterProviderBuilderExtensions
-OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions
-static OpenTelemetry.Metrics.AspNetCoreInstrumentationMeterProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
-static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.AspNetCoreInstrumentationTracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureAspNetCoreTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt
index d72ec2c4d36..e69de29bb2d 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt
@@ -1,2 +0,0 @@
-*REMOVED*OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnableGrpcAspNetCoreSupport.get -> bool
-*REMOVED*OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnableGrpcAspNetCoreSupport.set -> void
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
index 5db9434309a..64b895bd816 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.6.0 - First stable release of this library
+
+Released 2023-Dec-13
+
* Re-introduced support for gRPC instrumentation as an opt-in experimental
feature. From now onwards, gRPC can be enabled by setting
`OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION` flag to
diff --git a/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Shipped.txt b/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Shipped.txt
index e69de29bb2d..a082f2c5bec 100644
--- a/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Shipped.txt
+++ b/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Shipped.txt
@@ -0,0 +1,24 @@
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithException.get -> System.Action
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithException.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpRequestMessage.get -> System.Action
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpRequestMessage.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpResponseMessage.get -> System.Action
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpResponseMessage.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebRequest.get -> System.Action
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebRequest.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebResponse.get -> System.Action
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebResponse.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpRequestMessage.get -> System.Func
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpRequestMessage.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpWebRequest.get -> System.Func
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpWebRequest.set -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.HttpClientTraceInstrumentationOptions() -> void
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.RecordException.get -> bool
+OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.RecordException.set -> void
+OpenTelemetry.Metrics.HttpClientInstrumentationMeterProviderBuilderExtensions
+OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions
+static OpenTelemetry.Metrics.HttpClientInstrumentationMeterProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
+static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
+static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
diff --git a/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt
index a082f2c5bec..e69de29bb2d 100644
--- a/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt
+++ b/src/OpenTelemetry.Instrumentation.Http/.publicApi/PublicAPI.Unshipped.txt
@@ -1,24 +0,0 @@
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithException.get -> System.Action
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithException.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpRequestMessage.get -> System.Action
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpRequestMessage.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpResponseMessage.get -> System.Action
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpResponseMessage.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebRequest.get -> System.Action
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebRequest.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebResponse.get -> System.Action
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.EnrichWithHttpWebResponse.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpRequestMessage.get -> System.Func
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpRequestMessage.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpWebRequest.get -> System.Func
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.FilterHttpWebRequest.set -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.HttpClientTraceInstrumentationOptions() -> void
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.RecordException.get -> bool
-OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions.RecordException.set -> void
-OpenTelemetry.Metrics.HttpClientInstrumentationMeterProviderBuilderExtensions
-OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions
-static OpenTelemetry.Metrics.HttpClientInstrumentationMeterProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
-static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
-static OpenTelemetry.Trace.HttpClientInstrumentationTracerProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureHttpClientTraceInstrumentationOptions) -> OpenTelemetry.Trace.TracerProviderBuilder
diff --git a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
index af38a5eab6f..45e8b702944 100644
--- a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+## 1.6.0 - First stable release of this library
+
+Released 2023-Dec-13
+
## 1.6.0-rc.1
Released 2023-Dec-01
From 3ffbef3d1a4d40a39eb206523ed02ed0f2a75243 Mon Sep 17 00:00:00 2001
From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Date: Wed, 13 Dec 2023 18:07:55 -0800
Subject: [PATCH 23/32] Update OTel latest stable version to 1.7.0 (#5174)
---
Directory.Packages.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Directory.Packages.props b/Directory.Packages.props
index a53d8cf7207..8b4287b8901 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,7 +1,7 @@
true
- 1.6.0
+ 1.7.0