From 93237f1c9549d767f58789c87ef4808a308b504a Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 4 Apr 2024 10:47:46 -0700 Subject: [PATCH 1/4] Metrics doc minor improvement (#5508) --- docs/metrics/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/metrics/README.md b/docs/metrics/README.md index 23df6fbf172..378190318c3 100644 --- a/docs/metrics/README.md +++ b/docs/metrics/README.md @@ -45,6 +45,9 @@ package, regardless of the .NET runtime version being used: * The .NET runtime team is holding a high bar for backward compatibility on `System.Diagnostics.DiagnosticSource` even during major version bumps, so compatibility is not a concern here. +* Refer to the [.NET official + document](https://learn.microsoft.com/dotnet/core/diagnostics/compare-metric-apis#systemdiagnosticsmetrics) + for more information about `System.Diagnostics.Metrics`. ## Metrics API From c6e80a1650516a24a68fa213d538dbd1448d5a50 Mon Sep 17 00:00:00 2001 From: John Bley Date: Thu, 4 Apr 2024 13:58:52 -0400 Subject: [PATCH 2/4] Use set -e in shell scripts (#5507) Co-authored-by: Mikel Blanchard --- .../scripts/semantic-conventions/generate.sh | 1 + .../IntegrationTest/create-cert.sh | 1 + .../IntegrationTest/run-test.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/src/OpenTelemetry.SemanticConventions/scripts/semantic-conventions/generate.sh b/src/OpenTelemetry.SemanticConventions/scripts/semantic-conventions/generate.sh index 76515a80bff..4d7c781d635 100644 --- a/src/OpenTelemetry.SemanticConventions/scripts/semantic-conventions/generate.sh +++ b/src/OpenTelemetry.SemanticConventions/scripts/semantic-conventions/generate.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/create-cert.sh b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/create-cert.sh index 24c6fe319cd..c0821abc468 100755 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/create-cert.sh +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/create-cert.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Generate self-signed certificate for the collector openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \ diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/run-test.sh b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/run-test.sh index 5444a40a454..d88a7f1aa5f 100755 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/run-test.sh +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/run-test.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Trust the self-signed certificated used by the collector cp /cfg/otel-collector.crt /usr/local/share/ca-certificates/ From 2c421a04aea567024c21390a874fdfaa6b2dd62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Thu, 4 Apr 2024 23:11:30 +0200 Subject: [PATCH 3/4] Instrumentation packages - 1.8.0/1.8.0-beta.1 release (#5505) Co-authored-by: Mikel Blanchard --- src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md | 4 ++++ src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md | 4 ++++ src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md | 4 ++++ src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md index 85206c65cd3..baf8bd6a324 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 1.8.0 + +Released 2024-Apr-04 + * Fixed an issue for spans when `server.port` attribute was not set with `server.address` when it has default values (`80` for `HTTP` and `443` for `HTTPS` protocol). diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md index 4eba089688b..8eaa0868d8f 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 1.8.0-beta.1 + +Released 2024-Apr-04 + ## 1.7.0-beta.1 Released 2024-Feb-09 diff --git a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md index b23ce1e0096..c3f7330208d 100644 --- a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 1.8.0 + +Released 2024-Apr-04 + * Fixed an issue for spans when `server.port` attribute was not set with `server.address` when it has default values (`80` for `HTTP` and `443` for `HTTPS` protocol). diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md index a07be3094d7..dd2ed6d52dd 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 1.8.0-beta.1 + +Released 2024-Apr-04 + ## 1.7.0-beta.1 Released 2024-Feb-09 From 3f4c73adb1f9845eb8e9553d7d21c5a2c629413f Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:03:28 -0700 Subject: [PATCH 4/4] [sdk-metrics] Refactor AggregatorStore (#5509) --- src/OpenTelemetry/Metrics/AggregatorStore.cs | 57 ++++++-------------- 1 file changed, 17 insertions(+), 40 deletions(-) diff --git a/src/OpenTelemetry/Metrics/AggregatorStore.cs b/src/OpenTelemetry/Metrics/AggregatorStore.cs index 17e20ad42be..5271a329e40 100644 --- a/src/OpenTelemetry/Metrics/AggregatorStore.cs +++ b/src/OpenTelemetry/Metrics/AggregatorStore.cs @@ -221,14 +221,7 @@ internal void SnapshotDelta(int indexSnapshot) continue; } - if (this.IsExemplarEnabled()) - { - metricPoint.TakeSnapshotWithExemplar(outputDelta: true); - } - else - { - metricPoint.TakeSnapshot(outputDelta: true); - } + this.TakeMetricPointSnapshot(ref metricPoint, outputDelta: true); this.currentMetricPointBatch[this.batchSize] = i; this.batchSize++; @@ -246,14 +239,7 @@ internal void SnapshotDeltaWithMetricPointReclaim() ref var metricPointWithNoTags = ref this.metricPoints[0]; if (metricPointWithNoTags.MetricPointStatus != MetricPointStatus.NoCollectPending) { - if (this.IsExemplarEnabled()) - { - metricPointWithNoTags.TakeSnapshotWithExemplar(outputDelta: true); - } - else - { - metricPointWithNoTags.TakeSnapshot(outputDelta: true); - } + this.TakeMetricPointSnapshot(ref metricPointWithNoTags, outputDelta: true); this.currentMetricPointBatch[this.batchSize] = 0; this.batchSize++; @@ -265,14 +251,7 @@ internal void SnapshotDeltaWithMetricPointReclaim() ref var metricPointForOverflow = ref this.metricPoints[1]; if (metricPointForOverflow.MetricPointStatus != MetricPointStatus.NoCollectPending) { - if (this.IsExemplarEnabled()) - { - metricPointForOverflow.TakeSnapshotWithExemplar(outputDelta: true); - } - else - { - metricPointForOverflow.TakeSnapshot(outputDelta: true); - } + this.TakeMetricPointSnapshot(ref metricPointForOverflow, outputDelta: true); this.currentMetricPointBatch[this.batchSize] = 1; this.batchSize++; @@ -329,14 +308,7 @@ internal void SnapshotDeltaWithMetricPointReclaim() continue; } - if (this.IsExemplarEnabled()) - { - metricPoint.TakeSnapshotWithExemplar(outputDelta: true); - } - else - { - metricPoint.TakeSnapshot(outputDelta: true); - } + this.TakeMetricPointSnapshot(ref metricPoint, outputDelta: true); this.currentMetricPointBatch[this.batchSize] = i; this.batchSize++; @@ -358,14 +330,7 @@ internal void SnapshotCumulative(int indexSnapshot) continue; } - if (this.IsExemplarEnabled()) - { - metricPoint.TakeSnapshotWithExemplar(outputDelta: false); - } - else - { - metricPoint.TakeSnapshot(outputDelta: false); - } + this.TakeMetricPointSnapshot(ref metricPoint, outputDelta: false); this.currentMetricPointBatch[this.batchSize] = i; this.batchSize++; @@ -395,6 +360,18 @@ private static double[] FindDefaultHistogramBounds(in MetricStreamIdentity metri return Metric.DefaultHistogramBounds; } + private void TakeMetricPointSnapshot(ref MetricPoint metricPoint, bool outputDelta) + { + if (this.IsExemplarEnabled()) + { + metricPoint.TakeSnapshotWithExemplar(outputDelta); + } + else + { + metricPoint.TakeSnapshot(outputDelta); + } + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void InitializeZeroTagPointIfNotInitialized() {