Skip to content

Commit

Permalink
Merge branch 'main' into feature/prometheus-scope-info
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcoltheart committed Nov 30, 2023
2 parents 9526647 + c637263 commit da28e9d
Show file tree
Hide file tree
Showing 23 changed files with 384 additions and 77 deletions.
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

* Updated `Microsoft.Extensions.DependencyInjection.Abstractions` package
version to `8.0.0`.
([#5051](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5051))
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

* Updated `System.Diagnostics.DiagnosticSource` package version to
`8.0.0`.
([#5051](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5051))
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Exporter.Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

* Add support for Instrumentation Scope Attributes (i.e [Meter
Tags](https://learn.microsoft.com/dotnet/api/system.diagnostics.metrics.meter.tags)),
fixing issue
Expand Down
11 changes: 7 additions & 4 deletions src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ public override ExportResult Export(in Batch<Metric> batch)

this.WriteLine(msg.ToString());

foreach (var meterTag in metric.MeterTags)
if (metric.MeterTags != null)
{
this.WriteLine("\tMeter Tags:");
if (ConsoleTagTransformer.Instance.TryTransformTag(meterTag, out var result))
foreach (var meterTag in metric.MeterTags)
{
this.WriteLine($"\t\t{result}");
this.WriteLine("\tMeter Tags:");
if (ConsoleTagTransformer.Instance.TryTransformTag(meterTag, out var result))
{
this.WriteLine($"\t\t{result}");
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

* Made `OpenTelemetry.Exporter.OtlpLogExporter` public.
([#4979](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4979))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## Unreleased

* Added support for exporting otel_scope_info tags to metrics
* Added ability to export otel_scop_info and handle OpenMetrics requests from Prometheus

## 1.7.0-rc.1

Released 2023-Nov-29

## 1.7.0-alpha.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
OpenTelemetry.OpenTelemetryBuilder.WithLogging() -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithLogging(System.Action<OpenTelemetry.Logs.LoggerProviderBuilder!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithLogging(System.Action<OpenTelemetry.Logs.LoggerProviderBuilder!>? configureBuilder, System.Action<OpenTelemetry.Logs.OpenTelemetryLoggerOptions!>? configureOptions) -> OpenTelemetry.OpenTelemetryBuilder!
9 changes: 9 additions & 0 deletions src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

* Updated `Microsoft.Extensions.Hosting.Abstractions` package
version to `8.0.0`.
([#5051](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5051))
Expand All @@ -12,6 +16,11 @@
APIs.
([#4958](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4958))

* The `OpenTelemetryBuilder.WithLogging` experimental API method will now
register an `ILoggerProvider` named 'OpenTelemetry' into the
`IServiceCollection` to enable `ILoggerFactory` integration.
([#5072](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5072))

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
61 changes: 53 additions & 8 deletions src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Logging;
using OpenTelemetry.Internal;
using OpenTelemetry.Logs;
using OpenTelemetry.Metrics;
Expand Down Expand Up @@ -146,10 +147,17 @@ public OpenTelemetryBuilder WithTracing(Action<TracerProviderBuilder> configure)
/// Adds logging services into the builder.
/// </summary>
/// <remarks>
/// <para><b>WARNING</b>: This is an experimental API which might change or be removed in the future. Use at your own risk.</para>
/// Note: This is safe to be called multiple times and by library authors.
/// <para><b>WARNING</b>: This is an experimental API which might change or
/// be removed in the future. Use at your own risk.</para>
/// Notes:
/// <list type="bullet">
/// <item>This is safe to be called multiple times and by library authors.
/// Only a single <see cref="LoggerProvider"/> will be created for a given
/// <see cref="IServiceCollection"/>.
/// <see cref="IServiceCollection"/>.</item>
/// <item>This method automatically registers an <see
/// cref="ILoggerProvider"/> named 'OpenTelemetry' into the <see
/// cref="IServiceCollection"/>.</item>
/// </list>
/// </remarks>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
Expand All @@ -159,16 +167,22 @@ public OpenTelemetryBuilder WithTracing(Action<TracerProviderBuilder> configure)
/// Adds logging services into the builder.
/// </summary>
/// <remarks>
/// Note: This is safe to be called multiple times and by library authors.
/// Notes:
/// <list type="bullet">
/// <item>This is safe to be called multiple times and by library authors.
/// Only a single <see cref="LoggerProvider"/> will be created for a given
/// <see cref="IServiceCollection"/>.
/// <see cref="IServiceCollection"/>.</item>
/// <item>This method automatically registers an <see
/// cref="ILoggerProvider"/> named 'OpenTelemetry' into the <see
/// cref="IServiceCollection"/>.</item>
/// </list>
/// </remarks>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
internal
#endif
OpenTelemetryBuilder WithLogging()
=> this.WithLogging(b => { });
=> this.WithLogging(configureBuilder: null, configureOptions: null);

#if EXPOSE_EXPERIMENTAL_FEATURES
/// <summary>
Expand All @@ -195,9 +209,40 @@ OpenTelemetryBuilder WithLogging(Action<LoggerProviderBuilder> configure)
{
Guard.ThrowIfNull(configure);

var builder = new LoggerProviderBuilderBase(this.Services);
return this.WithLogging(configureBuilder: configure, configureOptions: null);
}

configure(builder);
#if EXPOSE_EXPERIMENTAL_FEATURES
/// <summary>
/// Adds logging services into the builder.
/// </summary>
/// <remarks><inheritdoc cref="WithLogging()" path="/remarks"/></remarks>
/// <param name="configureBuilder">Optional <see
/// cref="LoggerProviderBuilder"/> configuration callback.</param>
/// <param name="configureOptions">Optional <see
/// cref="OpenTelemetryLoggerOptions"/> configuration callback.</param>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
public
#else
/// <summary>
/// Adds logging services into the builder.
/// </summary>
/// <remarks><inheritdoc cref="WithLogging()" path="/remarks"/></remarks>
/// <param name="configureBuilder">Optional <see
/// cref="LoggerProviderBuilder"/> configuration callback.</param>
/// <param name="configureOptions">Optional <see
/// cref="OpenTelemetryLoggerOptions"/> configuration callback.</param>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
internal
#endif
OpenTelemetryBuilder WithLogging(
Action<LoggerProviderBuilder>? configureBuilder,
Action<OpenTelemetryLoggerOptions>? configureOptions)
{
this.Services.AddLogging(
logging => logging.UseOpenTelemetry(configureBuilder, configureOptions));

return this;
}
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Extensions.Propagators/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.AspNetCoreInstrumentationOptions() -> void
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnableGrpcAspNetCoreSupport.get -> bool
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnableGrpcAspNetCoreSupport.set -> void
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnrichWithException.get -> System.Action<System.Diagnostics.Activity, System.Exception>
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnrichWithException.set -> void
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnrichWithHttpRequest.get -> System.Action<System.Diagnostics.Activity, Microsoft.AspNetCore.Http.HttpRequest>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ public class AspNetCoreInstrumentationOptions
/// </remarks>
public bool RecordException { get; set; }

#if NET6_0_OR_GREATER
/// <summary>
/// Gets or sets a value indicating whether RPC attributes are added to an Activity when using Grpc.AspNetCore. Default is true.
/// </summary>
/// <remarks>
/// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md.
/// </remarks>
public bool EnableGrpcAspNetCoreSupport { get; set; } = true;
#endif
/*
* 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
/// <summary>
/// Gets or sets a value indicating whether RPC attributes are added to an Activity when using Grpc.AspNetCore. Default is true.
/// </summary>
/// <remarks>
/// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md.
/// </remarks>
public bool EnableGrpcAspNetCoreSupport { get; set; } = true;
#endif
*/
}
5 changes: 5 additions & 0 deletions src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
* Removed `netstandard2.1` target.
([#5094](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5094))

* Removed support for grpc instrumentation to unblock stable release of http
instrumentation. For details, see issue
[#5098](https://github.com/open-telemetry/opentelemetry-dotnet/issues/5098)
([#5097](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5097))

## 1.6.0-beta.3

Released 2023-Nov-17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,18 @@ public void OnStopActivity(Activity activity, object payload)
#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);
}
else if (activity.Status == ActivityStatusCode.Unset)
{
activity.SetStatus(SpanHelper.ResolveSpanStatusForHttpStatusCode(activity.Kind, response.StatusCode));
}
#else
/*
#if !NETSTANDARD2_0
if (this.options.EnableGrpcAspNetCoreSupport && TryGetGrpcMethod(activity, out var grpcMethod))
{
this.AddGrpcAttributes(activity, grpcMethod, context);
}
*/
if (activity.Status == ActivityStatusCode.Unset)
{
activity.SetStatus(SpanHelper.ResolveSpanStatusForHttpStatusCode(activity.Kind, response.StatusCode));
}
#endif

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(double value,
override OpenTelemetry.Metrics.AlwaysOnExemplarFilter.ShouldSample(long value, System.ReadOnlySpan<System.Collections.Generic.KeyValuePair<string!, object?>> tags) -> bool
override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(double value, System.ReadOnlySpan<System.Collections.Generic.KeyValuePair<string!, object?>> tags) -> bool
override OpenTelemetry.Metrics.TraceBasedExemplarFilter.ShouldSample(long value, System.ReadOnlySpan<System.Collections.Generic.KeyValuePair<string!, object?>> tags) -> bool
static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.UseOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder! builder) -> Microsoft.Extensions.Logging.ILoggingBuilder!
static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.UseOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder! builder, System.Action<OpenTelemetry.Logs.LoggerProviderBuilder!>! configure) -> Microsoft.Extensions.Logging.ILoggingBuilder!
static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.UseOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder! builder, System.Action<OpenTelemetry.Logs.LoggerProviderBuilder!>? configureBuilder, System.Action<OpenTelemetry.Logs.OpenTelemetryLoggerOptions!>? configureOptions) -> Microsoft.Extensions.Logging.ILoggingBuilder!
16 changes: 16 additions & 0 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.7.0-rc.1

Released 2023-Nov-29

* The `AddService` `ResourceBuilder` extension method will now generate the same
`service.instance.id` for the lifetime of a process when
`autoGenerateServiceInstanceId` is `true`.
Expand Down Expand Up @@ -64,6 +68,18 @@
[#4563](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4563).
([#5089](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5089))

* Added the `ILoggingBuilder.UseOpenTelemetry` experimental API extension for
registering OpenTelemetry `ILogger` integration using `LoggerProviderBuilder`
which supports the full DI (`IServiceCollection` \ `IServiceProvider`) API
surface (mirrors tracing & metrics).
([#5072](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5072))

* Changed the `ILoggingBuilder` registration extensions (`AddOpenTelemetry` &
`UseOpenTelemetry`) to fire the optional `OpenTelemetryLoggerOptions`
configuration delegate AFTER the "Logging:OpenTelemetry" `IConfiguration`
section has been applied.
([#5072](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5072))

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
Loading

0 comments on commit da28e9d

Please sign in to comment.