Skip to content

Use the analysis template's timeout for metrics queries - #7527

Open
harshrajdebug wants to merge 1 commit into
pipe-cd:masterfrom
harshrajdebug:fix/analysis-template-metrics-timeout
Open

harshrajdebug wants to merge 1 commit into
pipe-cd:masterfrom
harshrajdebug:fix/analysis-template-metrics-timeout

Conversation

@harshrajdebug

Copy link
Copy Markdown
Contributor

What this PR does:

Builds the metrics provider of an ANALYSIS stage from the resolved metrics config, so the timeout of a referenced AnalysisTemplate is used.

  • In executestage/analysis.go the newMetricsProvider function now takes the *config.AnalysisMetrics value returned by getMetricsConfig and reads the provider name from it.
  • In analysisprovider/metrics/factory the NewProvider function takes *config.AnalysisMetrics instead of the *config.TemplatableAnalysisMetrics type.

Why we need it:

The provider was built from the stage's own metrics entry. When that entry only references a template, its timeout is the 30s default, so Prometheus and Datadog queries ignored the timeout set in the template. Details and the reproduction are in the issue.

TestExecutor_newMetricsProvider_timeout sets a 100ms timeout once inline and once in a template, against a Prometheus server that answers after 1s, and expects context deadline exceeded in both cases. When I pass the stage entry's timeout to the provider instead, as master does, the template case waits for the 1s response and fails.

Which issue(s) this PR fixes:

Fixes #7526

Does this PR introduce a user-facing change?:

  • How are users affected by this change: Metrics analyses that reference an AnalysisTemplate now use the timeout set in the template. A timeout written next to template in the stage is no longer used, like the other fields there.
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Screenshots/Videos (for documentation or website changes):

N/A

Signed-off-by: Harsh Raj <harshrajdebug@gmail.com>
@harshrajdebug
harshrajdebug requested review from a team as code owners October 23, 2026 12:03
@harshrajdebug
harshrajdebug requested review from Warashi, ffjlabo and mohammedfirdouss and a balanced review from Copilot and removed request for Copilot October 23, 2026 12:03
@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for pipecd-site canceled.

Name Link
🔨 Latest commit 84bdde4
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6adb4d0d88ce24bd272ed63a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analysis plugin: metrics that reference an AnalysisTemplate ignore the template's timeout

1 participant