Skip to content

Commit

Permalink
Merge branch 'main' into aspnet-prom-exemplars
Browse files Browse the repository at this point in the history
  • Loading branch information
saul authored Nov 12, 2024
2 parents 606b69e + d113ecf commit 24b2c6a
Show file tree
Hide file tree
Showing 46 changed files with 1,976 additions and 724 deletions.
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
these packages even during major version bumps, so compatibility is not a concern here.
-->
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(LatestRuntimeOutOfBandVer)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="$(LatestRuntimeOutOfBandVer)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ you're more than welcome to participate!

* [Cijo Thomas](https://github.com/cijothomas), Microsoft
* [Piotr Kie&#x142;kowicz](https://github.com/Kielek), Splunk
* [Reiley Yang](https://github.com/reyang), Microsoft
* [Rajkumar Rangaraj](https://github.com/rajkumar-rangaraj), Microsoft
* [Utkarsh Umesan Pillai](https://github.com/utpilla), Microsoft

[Triagers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager)
Expand All @@ -228,6 +228,7 @@ Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/ma
* [Liudmila Molkova](https://github.com/lmolkova)
* [Mike Goldsmith](https://github.com/MikeGoldsmith)
* [Paulo Janotti](https://github.com/pjanotti)
* [Reiley Yang](https://github.com/reyang)
* [Robert Paj&#x105;k](https://github.com/pellared)
* [Sergey Kanzhelev](https://github.com/SergeyKanzhelev)
* [Victor Lu](https://github.com/victlu)
Expand Down
44 changes: 44 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ This file contains highlights and announcements covering all components.
For more details see `CHANGELOG.md` files maintained in the root source
directory of each individual package.

## 1.10.0

* Bumped the package versions of `System.Diagnostic.DiagnosticSource` and other
Microsoft.Extensions.* packages to `9.0.0`.

* Added support for new APIs introduced in `System.Diagnostics.DiagnosticSource`
`9.0.0`:

* [InstrumentAdvice&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.diagnostics.metrics.instrumentadvice-1)

For details see: [Explicit bucket histogram
aggregation](./docs/metrics/customizing-the-sdk/README.md#explicit-bucket-histogram-aggregation).

* [Gauge&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.diagnostics.metrics.gauge-1)

* [ActivitySource.Tags](https://learn.microsoft.com/dotnet/api/system.diagnostics.activitysource.tags)
(supported in OtlpExporter & ConsoleExporter)

* Experimental features promoted to stable:

* `CardinalityLimit` can now be managed for individual metrics via the View
API. For details see: [Changing cardinality limit for a
Metric](./docs/metrics/customizing-the-sdk/README.md#changing-the-cardinality-limit-for-a-metric).

* The [overflow
attribute](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#overflow-attribute)
(`otel.metric.overflow`) behavior is now enabled by default. The
`OTEL_DOTNET_EXPERIMENTAL_METRICS_EMIT_OVERFLOW_ATTRIBUTE` environment
variable is no longer required. For details see: [Cardinality
Limits](./docs/metrics/README.md#cardinality-limits).

* The MetricPoint reclaim behavior is now enabled by default when Delta
aggregation temporality is used. The
`OTEL_DOTNET_EXPERIMENTAL_METRICS_RECLAIM_UNUSED_METRIC_POINTS` environment
variable is no longer required. For details see: [Cardinality
Limits](./docs/metrics/README.md#cardinality-limits).

* Added `OpenTelemetrySdk.Create` API for configuring OpenTelemetry .NET signals
(logging, tracing, and metrics) via a single builder. This new API simplifies
bootstrap and teardown, and supports cross-cutting extensions targeting
`IOpenTelemetryBuilder`.

* Removed out of support `net6.0` target and added `net9.0` target.

## 1.9.0

* `Exemplars` are now part of the stable API! For details see: [customizing
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/add-labels.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function AddLabelsOnPullRequestsBasedOnFilesChanged {
# it automatically in order to also allow manual inclusion after reviewing files
$managedLabels = 'infra', 'documentation', 'dependencies'
$rootInfraFiles = 'global.json', 'NuGet.config', 'codeowners'
$documentationFiles = 'readme.md', 'contributing.md', 'releasing.md', 'versioning.md'
$documentationFiles = 'readme.md', 'contributing.md', 'releasing.md', 'versioning.md', 'releasenotes.md'

foreach ($fileChanged in $filesChangedOnPullRequest)
{
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ To obtain an `ILogger` instance for emitting logs when using the
the returned `OpenTelemetrySdk` instance:

```csharp
var logger = sdk.GetLoggerFactory().CreateLogger<Program>()
var logger = sdk.GetLoggerFactory().CreateLogger<Program>();
logger.LogInformation("Application started");
```

Expand Down
35 changes: 16 additions & 19 deletions docs/metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,28 +388,25 @@ and the `MetricStreamConfiguration.CardinalityLimit` setting. Refer to this
[doc](../../docs/metrics/customizing-the-sdk/README.md#changing-the-cardinality-limit-for-a-metric)
for more information.

Given a metric, once the cardinality limit is reached, any new measurement
that could not be independently aggregated will be aggregated using the
[overflow attribute](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#overflow-attribute).
In versions prior to 1.10.0, the default behavior when cardinality limit was
reached was to drop the measurement. Users had the ability to opt-in to use
overflow attribute instead, but this behavior is the default and the only
allowed behavior starting with version 1.10.0.

When [Delta Aggregation
As of `1.10.0` once a metric has reached the cardinality limit, any new
measurement that could not be independently aggregated will be automatically
aggregated using the [overflow
attribute](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#overflow-attribute).

> [!NOTE]
> In SDK versions `1.6.0` - `1.9.0` the overflow attribute was an experimental
feature that could be enabled by setting the environment variable
`OTEL_DOTNET_EXPERIMENTAL_METRICS_EMIT_OVERFLOW_ATTRIBUTE=true`.

As of `1.10.0` when [Delta Aggregation
Temporality](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#temporality)
is used, it is possible to choose a smaller cardinality limit by allowing the
SDK to reclaim unused metric points.
is used, it is possible to choose a smaller cardinality limit because the SDK
will reclaim unused metric points.

> [!NOTE]
> Reclaim unused metric points feature was introduced in OpenTelemetry .NET
[1.7.0-alpha.1](../../src/OpenTelemetry/CHANGELOG.md#170-alpha1). It is
currently an experimental feature which can be turned on by setting the
environment variable
`OTEL_DOTNET_EXPERIMENTAL_METRICS_RECLAIM_UNUSED_METRIC_POINTS=true`. Once the
[OpenTelemetry
Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#overflow-attribute)
become stable, this feature will be turned on by default.
> In SDK versions `1.7.0` - `1.9.0`, metric point reclaim was an experimental
feature that could be enabled by setting the environment variable
`OTEL_DOTNET_EXPERIMENTAL_METRICS_RECLAIM_UNUSED_METRIC_POINTS=true`.

### Memory Preallocation

Expand Down
69 changes: 48 additions & 21 deletions docs/metrics/customizing-the-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,29 +200,56 @@ used.

##### Explicit bucket histogram aggregation

By default, the boundaries used for a Histogram are [`{ 0, 5, 10, 25, 50, 75,
100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}`](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.14.0/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation).
Views can be used to provide custom boundaries for a Histogram. The measurements
are then aggregated using the custom boundaries provided instead of the
default boundaries. This requires the use of
`ExplicitBucketHistogramConfiguration`.
By default, the [OpenTelemetry
Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.14.0/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation)
defines explicit buckets (aka boundaries) for Histograms as: `[ 0, 5, 10, 25,
50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000 ]`.

```csharp
// Change Histogram boundaries to count measurements under the following buckets:
// (-inf, 10]
// (10, 20]
// (20, +inf)
.AddView(
instrumentName: "MyHistogram",
new ExplicitBucketHistogramConfiguration { Boundaries = new double[] { 10, 20 } })
###### Customizing explicit buckets when using histogram aggregation

// If you provide an empty `double` array as `Boundaries` to the `ExplicitBucketHistogramConfiguration`,
// the SDK will only export the sum, count, min and max for the measurements.
// There are no buckets exported in this case.
.AddView(
instrumentName: "MyHistogram",
new ExplicitBucketHistogramConfiguration { Boundaries = Array.Empty<double>() })
```
There are two mechanisms available to configure explicit buckets when using
histogram aggregation:

* View API - Part of the OpenTelemetry .NET SDK.
* Advice API - Part of the `System.Diagnostics.DiagnosticSource` package
starting with version `9.0.0`.

> [!IMPORTANT]
> When both the View API and Advice API are used, the View API takes precedence.
If explicit buckets are not provided by either the View API or the Advice API
then the SDK defaults apply.

* View API

Views can be used to provide custom explicit buckets for a Histogram. This
requires the use of `ExplicitBucketHistogramConfiguration`.

```csharp
// Change Histogram boundaries to count measurements under the following buckets:
// (-inf, 10]
// (10, 20]
// (20, +inf)
.AddView(
instrumentName: "MyHistogram",
new ExplicitBucketHistogramConfiguration { Boundaries = new double[] { 10, 20 } })

// If you provide an empty `double` array as `Boundaries` to the `ExplicitBucketHistogramConfiguration`,
// the SDK will only export the sum, count, min and max for the measurements.
// There are no buckets exported in this case.
.AddView(
instrumentName: "MyHistogram",
new ExplicitBucketHistogramConfiguration { Boundaries = Array.Empty<double>() })
```

* Advice API

Starting with the `1.10.0` SDK, explicit buckets for a Histogram may be provided
by instrumentation authors when the instrument is created. This is generally
recommended to be used by library authors when the SDK defaults don't match the
required granularity for the histogram being emitted.

See:
[InstrumentAdvice&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.diagnostics.metrics.instrumentadvice-1).

##### Base2 exponential bucket histogram aggregation

Expand Down
8 changes: 6 additions & 2 deletions src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Notes](../../RELEASENOTES.md).

## Unreleased

## 1.10.0-rc.1

Released 2024-Nov-01

## 1.10.0-beta.1

Released 2024-Sep-30
Expand All @@ -25,8 +29,8 @@ Released 2024-Jun-07

* The experimental APIs previously covered by `OTEL1000`
(`LoggerProviderBuilder` `AddInstrumentation` & `ConfigureServices` extensions
and `IServiceCollection.ConfigureOpenTelemetryLoggerProvider` extension) will
now be part of the public API and supported in stable builds.
and `IServiceCollection.ConfigureOpenTelemetryLoggerProvider` extension) are
now part of the public API and supported in stable builds.
([#5648](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5648))

## 1.9.0-alpha.1
Expand Down
8 changes: 6 additions & 2 deletions src/OpenTelemetry.Api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Notes](../../RELEASENOTES.md).

## Unreleased

## 1.10.0-rc.1

Released 2024-Nov-01

## 1.10.0-beta.1

Released 2024-Sep-30
Expand Down Expand Up @@ -52,8 +56,8 @@ Released 2024-Jun-14
Released 2024-Jun-07

* The experimental APIs previously covered by `OTEL1000` (`LoggerProvider`,
`LoggerProviderBuilder`, & `IDeferredLoggerProviderBuilder`) will now be part
of the public API and supported in stable builds.
`LoggerProviderBuilder`, & `IDeferredLoggerProviderBuilder`) are now part of
the public API and supported in stable builds.
([#5648](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5648))

## 1.9.0-alpha.1
Expand Down
17 changes: 13 additions & 4 deletions src/OpenTelemetry.Exporter.Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ Notes](../../RELEASENOTES.md).

## Unreleased

## 1.10.0-rc.1

Released 2024-Nov-01

* Added direct reference to `System.Text.Json` for the `net8.0` target with
minimum version of `8.0.5` in response to
[CVE-2024-30105](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w) &
[CVE-2024-43485](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43485).
([#5874](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5874),
[#5891](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5891))

* Added support for Instrumentation Scope Attributes (i.e
[ActivitySource.Tags](https://learn.microsoft.com/dotnet/api/system.diagnostics.activitysource.tags))
when writing traces to the console.
([#5935](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5935))

## 1.10.0-beta.1

Released 2024-Sep-30
Expand All @@ -26,7 +35,7 @@ Released 2024-Jun-14
Released 2024-Jun-07

* The experimental APIs previously covered by `OTEL1000`
(`LoggerProviderBuilder.AddConsoleExporter` extension) will now be part of the
(`LoggerProviderBuilder.AddConsoleExporter` extension) are now part of the
public API and supported in stable builds.
([#5648](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5648))

Expand Down Expand Up @@ -61,9 +70,9 @@ Released 2023-Dec-08

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
* Added support for Instrumentation Scope Attributes (i.e
[Meter.Tags](https://learn.microsoft.com/dotnet/api/system.diagnostics.metrics.meter.tags)),
when writing metrics to the console, fixing issue
[#4563](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4563).
([#5089](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5089))

Expand Down
25 changes: 19 additions & 6 deletions src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ public override ExportResult Export(in Batch<Activity> batch)
this.WriteLine($"Activity.ParentSpanId: {activity.ParentSpanId}");
}

this.WriteLine($"Activity.ActivitySourceName: {activity.Source.Name}");
if (!string.IsNullOrEmpty(activity.Source.Version))
{
this.WriteLine($"Activity.ActivitySourceVersion: {activity.Source.Version}");
}

this.WriteLine($"Activity.DisplayName: {activity.DisplayName}");
this.WriteLine($"Activity.Kind: {activity.Kind}");
this.WriteLine($"Activity.StartTime: {activity.StartTimeUtc:yyyy-MM-ddTHH:mm:ss.fffffffZ}");
Expand Down Expand Up @@ -117,6 +111,25 @@ public override ExportResult Export(in Batch<Activity> batch)
}
}

this.WriteLine("Instrumentation scope (ActivitySource):");
this.WriteLine($" Name: {activity.Source.Name}");
if (!string.IsNullOrEmpty(activity.Source.Version))
{
this.WriteLine($" Version: {activity.Source.Version}");
}

if (activity.Source.Tags?.Any() == true)
{
this.WriteLine(" Tags:");
foreach (var activitySourceTag in activity.Source.Tags)
{
if (this.TagWriter.TryTransformTag(activitySourceTag, out var result))
{
this.WriteLine($" {result.Key}: {result.Value}");
}
}
}

var resource = this.ParentProvider.GetResource();
if (resource != Resource.Empty)
{
Expand Down
Loading

0 comments on commit 24b2c6a

Please sign in to comment.