Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
15ba450
[Exporter.Prometheus] Fix scope metadata
martincostello May 1, 2026
db4ca48
[Exporter.Prometheus] Update test cases
martincostello May 1, 2026
50942c7
[Exporter.Prometheus] Update CHANGELOGs
martincostello May 1, 2026
60a53b7
[Exporter.Prometheus] Address feedback
martincostello May 1, 2026
65db37d
Merge branch 'main' into fix-scope-metadata
martincostello May 1, 2026
a51c12a
[Exporter.Prometheus] Extend coverage
martincostello May 1, 2026
48c6919
Merge branch 'main' into fix-scope-metadata
martincostello May 4, 2026
9402121
Merge branch 'main' into fix-scope-metadata
martincostello May 5, 2026
ab0849c
Merge branch 'main' into fix-scope-metadata
martincostello May 5, 2026
926f714
[Exporter.Prometheus] Update CHANGELOGs
martincostello May 5, 2026
25e7374
Merge branch 'main' into fix-scope-metadata
martincostello May 13, 2026
00ab131
Merge branch 'main' into fix-scope-metadata
martincostello May 18, 2026
c5d2abb
Merge branch 'main' into fix-scope-metadata
martincostello May 19, 2026
9dfc038
[Exporter.Prometheus] Address feedback
martincostello May 19, 2026
a5a99b4
[Exporter.Prometheus] Fix CHANGELOGs
martincostello May 19, 2026
a9846cd
Merge branch 'main' into fix-scope-metadata
martincostello May 22, 2026
92924ae
Merge branch 'main' into fix-scope-metadata
martincostello May 30, 2026
691f9ce
[Exporter.Prometheus] Fix-up merge
martincostello May 30, 2026
36bbbe9
[Exporter.Prometheus] Address feedback
martincostello May 30, 2026
98141c1
Merge branch 'main' into fix-scope-metadata
martincostello Jun 1, 2026
44fa775
[Exporter.Prometheus] Fix SA1203
martincostello Jun 1, 2026
34ac7ea
[Exporter.Prometheus] Address feedback
martincostello Jun 1, 2026
0658b03
Merge branch 'main' into fix-scope-metadata
martincostello Jun 2, 2026
191f148
[Exporter.Prometheus] Address feedback
martincostello Jun 2, 2026
06d421f
[Exporter.Prometheus] Use FrozenSet
martincostello Jun 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ Notes](../../RELEASENOTES.md).
* Add Prometheus text fallback `target_info` output as a gauge.
([#7238](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7238))

* Emit OpenMetrics scope metadata as a single `otel_scope` metric family with
`otel_scope_info` samples instead of repeating metadata for every scope.
([#7237](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7237))

* Include instrumentation scope metadata on samples using `otel_scope_*` labels
including scope version, schema URL, and prefixed scope attributes.
([#7237](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7237))

* Drop conflicting scope attributes named `name`, `version`, and `schema_url`.
([#7237](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7237))

## 1.15.3-beta.1

Released 2026-Apr-21
Expand Down
11 changes: 11 additions & 0 deletions src/OpenTelemetry.Exporter.Prometheus.HttpListener/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ Notes](../../RELEASENOTES.md).
* Add Prometheus text fallback `target_info` output as a gauge.
([#7238](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7238))

* Emit OpenMetrics scope metadata as a single `otel_scope` metric family with
`otel_scope_info` samples instead of repeating metadata for every scope.
([#7237](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7237))

* Include instrumentation scope metadata on samples using `otel_scope_*` labels
including scope version, schema URL, and prefixed scope attributes.
([#7237](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7237))

* Drop conflicting scope attributes named `name`, `version`, and `schema_url`.
([#7237](https://github.com/open-telemetry/opentelemetry-dotnet/pull/7237))

## 1.15.3-beta.1

Released 2026-Apr-21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ private ExportResult OnCollect(in Batch<Metric> metrics)
{
var cursor = 0;
ref var buffer = ref (this.exporter.OpenMetricsRequested ? ref this.openMetricsBuffer : ref this.plainTextBuffer);
var scopeInfoMetadataWritten = false;

try
{
Expand All @@ -251,13 +252,19 @@ private ExportResult OnCollect(in Batch<Metric> metrics)
continue;
}

if (this.scopes.Add(metric.MeterName))
if (this.scopes.Add(PrometheusSerializer.CreateScopeIdentity(metric)))
{
while (true)
{
try
{
cursor = PrometheusSerializer.WriteScopeInfo(buffer, cursor, metric.MeterName, openMetricsRequested: true);
if (!scopeInfoMetadataWritten)
{
cursor = PrometheusSerializer.WriteScopeInfoMetadata(buffer, cursor);
scopeInfoMetadataWritten = true;
}

cursor = PrometheusSerializer.WriteScopeInfoMetric(buffer, cursor, metric);

break;
}
Expand All @@ -279,7 +286,7 @@ private ExportResult OnCollect(in Batch<Metric> metrics)
}
}

var metricStates = this.GetMetricStates(metrics, this.exporter.OpenMetricsRequested);
var metricStates = this.GetMetricStates(metrics, this.exporter.OpenMetricsRequested, scopeInfoMetadataWritten);

foreach (var metricState in metricStates)
{
Expand Down Expand Up @@ -401,11 +408,11 @@ private PrometheusMetric GetPrometheusMetric(Metric metric)
return prometheusMetric;
}

private List<MetricState> GetMetricStates(in Batch<Metric> metrics, bool openMetricsRequested)
private List<MetricState> GetMetricStates(in Batch<Metric> metrics, bool openMetricsRequested, bool scopeInfoMetadataWritten)
{
var precomputedMetricStates = new List<PrecomputedMetricState>();
var metadataStates = new Dictionary<string, MetadataState>(StringComparer.Ordinal);
var droppedMetricNames = new HashSet<string>(StringComparer.Ordinal);
HashSet<string>? droppedMetricNames = null;

foreach (var metric in metrics)
{
Expand All @@ -418,6 +425,15 @@ private List<MetricState> GetMetricStates(in Batch<Metric> metrics, bool openMet
var metadataName = openMetricsRequested ? prometheusMetric.OpenMetricsMetadataName : prometheusMetric.Name;
precomputedMetricStates.Add(new PrecomputedMetricState(metric, prometheusMetric, metadataName));

if (openMetricsRequested &&
scopeInfoMetadataWritten &&
(metadataName == "otel_scope" || metadataName == "otel_scope_info"))
{
droppedMetricNames ??= new(StringComparer.Ordinal);
droppedMetricNames.Add(metadataName);
continue;
}

if (!metadataStates.TryGetValue(metadataName, out var metadataState))
{
metadataStates[metadataName] = new MetadataState(
Expand All @@ -429,6 +445,7 @@ private List<MetricState> GetMetricStates(in Batch<Metric> metrics, bool openMet

if (metadataState.Type != prometheusMetric.Type)
{
droppedMetricNames ??= new(StringComparer.Ordinal);
droppedMetricNames.Add(metadataName);
PrometheusExporterEventSource.Log.ConflictingType(metadataName, metadataState.Type, prometheusMetric.Type);
}
Expand Down Expand Up @@ -465,7 +482,7 @@ private List<MetricState> GetMetricStates(in Batch<Metric> metrics, bool openMet

foreach (var metricState in precomputedMetricStates)
{
if (droppedMetricNames.Contains(metricState.MetadataName))
if (droppedMetricNames?.Contains(metricState.MetadataName) is true)
{
continue;
}
Expand Down
Loading
Loading