Skip to content

[Prometheus.AspNetCore] Add scrape timeout - #7856

Merged
martincostello merged 3 commits into
open-telemetry:mainfrom
martincostello:add-prometheus-aspnetcore-timeout
Sep 30, 2026
Merged

martincostello merged 3 commits into
open-telemetry:mainfrom
martincostello:add-prometheus-aspnetcore-timeout

Conversation

@martincostello

Copy link
Copy Markdown
Member

Changes

Add a configurable maximum request timeout for scrape request to avoid a request being able to stall all scrape requests indefinitely.

Same as #7757 but for the ASP.NET Core variant.

Previously I thought that Kestrel's built-in request limits would mean this wasn't necessary, but it turns out that isn't the case.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Add a configurable maximum request timeout for scrape request to avoid a request being able to stall all scrape requests indefinitely.

Same as open-telemetry#7757 but for the ASP.NET Core variant.
Avoid long declaration line.
@github-actions github-actions Bot added pkg:OpenTelemetry.Exporter.Prometheus.AspNetCore Issues related to OpenTelemetry.Exporter.Prometheus.AspNetCore NuGet package pkg:OpenTelemetry.Exporter.Prometheus.HttpListener Issues related to OpenTelemetry.Exporter.Prometheus.HttpListener NuGet package labels Sep 30, 2026
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.99%. Comparing base (cdf59ab) to head (f232013).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ometheus.AspNetCore/PrometheusAspNetCoreOptions.cs 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7856      +/-   ##
==========================================
+ Coverage   91.95%   91.99%   +0.03%     
==========================================
  Files         343      344       +1     
  Lines       18864    19005     +141     
==========================================
+ Hits        17347    17483     +136     
- Misses       1517     1522       +5     
Flag Coverage Δ
unittests-Project-Experimental 92.09% <94.11%> (+<0.01%) ⬆️
unittests-Project-Stable 92.09% <94.11%> (+<0.01%) ⬆️
unittests-UnstableCoreLibraries-Experimental 50.57% <94.11%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...metheus.AspNetCore/PrometheusExporterMiddleware.cs 95.48% <100.00%> (+0.03%) ⬆️
...HttpListener/Internal/Shared/PrometheusExporter.cs 100.00% <100.00%> (ø)
...tener/Internal/Shared/PrometheusExporterOptions.cs 100.00% <100.00%> (ø)
...ometheus.AspNetCore/PrometheusAspNetCoreOptions.cs 94.44% <50.00%> (-5.56%) ⬇️

... and 8 files with indirect coverage changes

@martincostello
martincostello marked this pull request as ready for review September 30, 2026 08:50
@martincostello
martincostello requested a review from a team as a code owner September 30, 2026 08:50

@Kielek Kielek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comment

@Kielek
Kielek disabled auto-merge September 30, 2026 11:17
@martincostello
martincostello added this pull request to the merge queue Sep 30, 2026
Merged via the queue into open-telemetry:main with commit 70ffbd8 Sep 30, 2026
81 checks passed
@martincostello
martincostello deleted the add-prometheus-aspnetcore-timeout branch September 30, 2026 11:50
@martincostello martincostello added this to the v1.20.0 milestone Oct 1, 2026
This was referenced Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry.Exporter.Prometheus.AspNetCore Issues related to OpenTelemetry.Exporter.Prometheus.AspNetCore NuGet package pkg:OpenTelemetry.Exporter.Prometheus.HttpListener Issues related to OpenTelemetry.Exporter.Prometheus.HttpListener NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants