Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change StatusCode to 200 when no metrics are collected #3643

Merged
merged 3 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Bug fix for Prometheus Exporter reporting StatusCode 204
instead of 200, when no metrics are collected
([#3643](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3643))

dszmigielski marked this conversation as resolved.
Show resolved Hide resolved
## 1.4.0-alpha.2

Released 2022-Aug-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task InvokeAsync(HttpContext httpContext)
else
{
// It's not expected to have no metrics to collect, but it's not necessarily a failure, either.
response.StatusCode = 204;
response.StatusCode = 200;
PrometheusExporterEventSource.Log.NoMetrics();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Bug fix for Prometheus Exporter reporting StatusCode 204
instead of 200, when no metrics are collected
([#3643](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3643))

dszmigielski marked this conversation as resolved.
Show resolved Hide resolved
## 1.4.0-alpha.2

Released 2022-Aug-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private async Task ProcessRequestAsync(HttpListenerContext context)
else
{
// It's not expected to have no metrics to collect, but it's not necessarily a failure, either.
context.Response.StatusCode = 204;
context.Response.StatusCode = 200;
PrometheusExporterEventSource.Log.NoMetrics();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private static async Task RunPrometheusExporterMiddlewareIntegrationTest(
}
else
{
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}

validateResponse?.Invoke(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private async Task RunPrometheusExporterHttpServerIntegrationTest(bool skipMetri
}
else
{
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}
}
Expand Down