Skip to content

Backport of Suppress AlreadyRegisteredError to fix test retries into release/1.15.x#16504

Merged
hc-github-team-consul-core merged 2 commits intorelease/1.15.xfrom
backport/kisunji/fix-prometheus-metrics-registration/fully-rapid-tiger
Mar 2, 2023
Merged

Backport of Suppress AlreadyRegisteredError to fix test retries into release/1.15.x#16504
hc-github-team-consul-core merged 2 commits intorelease/1.15.xfrom
backport/kisunji/fix-prometheus-metrics-registration/fully-rapid-tiger

Conversation

@hc-github-team-consul-core
Copy link
Collaborator

Backport

This PR is auto-generated from #16501 to be assessed for backporting due to the inclusion of the label backport/1.15.

The below text is copied from the body of the original PR.


Description

There is a new set of tests that have high rates of failure (example).

They are labelled "flaky" but in reality are failing deterministically whenever there is a test retry which causes TestAgents to initialize the prometheus collectors more than once in a single runtime.

This PR suppresses prometheus.AlreadyRegisteredError so retries can run properly. This should have no impact on production usage as the metrics initialization happens only once on consul agent startup.

Testing & Reproduction steps

  • Run a test which configures prometheus metrics from metrics_test.go like TestHTTPHandlers_AgentMetrics_WAL_Prometheus with -count 2. Without this patch, the second run should always fail.

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/kisunji/fix-prometheus-metrics-registration/fully-rapid-tiger branch from 41562f6 to 18a8b0e Compare March 2, 2023 17:08
@hc-github-team-consul-core hc-github-team-consul-core enabled auto-merge (squash) March 2, 2023 17:08
@github-actions github-actions bot added the theme/internals Serf, Raft, SWIM, Lifeguard, Anti-Entropy, locking topics label Mar 2, 2023
Copy link
Collaborator

Choose a reason for hiding this comment

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

Auto approved Consul Bot automated PR

@hc-github-team-consul-core hc-github-team-consul-core merged commit 86150c1 into release/1.15.x Mar 2, 2023
@hc-github-team-consul-core hc-github-team-consul-core deleted the backport/kisunji/fix-prometheus-metrics-registration/fully-rapid-tiger branch March 2, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/internals Serf, Raft, SWIM, Lifeguard, Anti-Entropy, locking topics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants