Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcoltheart committed Dec 7, 2023
1 parent d452ab2 commit 8727a79
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* Export OpenMetrics format from Prometheus exporters ([#5107](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5107))
* Added ability to export otel_scop_info from Prometheus exporters ([#5086](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5086))
*

## 1.7.0-rc.1

Released 2023-Nov-29
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,37 @@ public async Task PrometheusExporterHttpServerIntegration_NoScopeInfo()
await this.RunPrometheusExporterHttpServerIntegrationTest(scopeInfoEnabled: false);
}

private static string GetExpectedContent(bool requestedOpenMetrics, bool scopeInfoEnabled)
{
if (requestedOpenMetrics && scopeInfoEnabled)
{
return "# TYPE otel_scope_info info\n"
+ "# HELP otel_scope_info Scope metadata\n"
+ $"otel_scope_info{{otel_scope_name='{MeterName}'}} 1\n"
+ "# TYPE counter_double_total counter\n"
+ $"counter_double_total{{otel_scope_name='{MeterName}',otel_scope_version='{MeterVersion}',key1='value1',key2='value2'}} 101.17 (\\d+\\.\\d{{3}})\n"
+ "# EOF\n";
}

if (!requestedOpenMetrics && scopeInfoEnabled)
{
return "# TYPE counter_double_total counter\n"
+ $"counter_double_total{{otel_scope_name='{MeterName}',otel_scope_version='{MeterVersion}',key1='value1',key2='value2'}} 101.17 (\\d+)\n"
+ "# EOF\n";
}

if (requestedOpenMetrics && !scopeInfoEnabled)
{
return "# TYPE counter_double_total counter\n"
+ "counter_double_total{key1='value1',key2='value2'} 101.17 (\\d+\\.\\d{3})\n"
+ "# EOF\n";
}

return "# TYPE counter_double_total counter\n"
+ "counter_double_total{key1='value1',key2='value2'} 101.17 (\\d+)\n"
+ "# EOF\n";
}

private async Task RunPrometheusExporterHttpServerIntegrationTest(bool skipMetrics = false, string acceptHeader = "application/openmetrics-text", bool scopeInfoEnabled = true)
{
var requestOpenMetrics = acceptHeader.StartsWith("application/openmetrics-text");
Expand Down Expand Up @@ -205,35 +236,4 @@ private async Task RunPrometheusExporterHttpServerIntegrationTest(bool skipMetri

provider.Dispose();
}

private static string GetExpectedContent(bool requestedOpenMetrics, bool scopeInfoEnabled)
{
if (requestedOpenMetrics && scopeInfoEnabled)
{
return "# TYPE otel_scope_info info\n"
+ "# HELP otel_scope_info Scope metadata\n"
+ $"otel_scope_info{{otel_scope_name='{MeterName}'}} 1\n"
+ "# TYPE counter_double_total counter\n"
+ $"counter_double_total{{otel_scope_name='{MeterName}',otel_scope_version='{MeterVersion}',key1='value1',key2='value2'}} 101.17 (\\d+\\.\\d{{3}})\n"
+ "# EOF\n";
}

if (!requestedOpenMetrics && scopeInfoEnabled)
{
return "# TYPE counter_double_total counter\n"
+ $"counter_double_total{{otel_scope_name='{MeterName}',otel_scope_version='{MeterVersion}',key1='value1',key2='value2'}} 101.17 (\\d+)\n"
+ "# EOF\n";
}

if (requestedOpenMetrics && !scopeInfoEnabled)
{
return "# TYPE counter_double_total counter\n"
+ "counter_double_total{key1='value1',key2='value2'} 101.17 (\\d+\\.\\d{3})\n"
+ "# EOF\n";
}

return "# TYPE counter_double_total counter\n"
+ "counter_double_total{key1='value1',key2='value2'} 101.17 (\\d+)\n"
+ "# EOF\n";
}
}

0 comments on commit 8727a79

Please sign in to comment.