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

fix: don't panic when calling NewCtrlFuncMetrics() more than once #3473

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Feb 2, 2023

What this PR does / why we need it:

It seems that we never tested calling dataplane.NewKongClient(), specifically more than once.

This PR fixes a panic which occurs when calling NewKongClient() twice. This is due to the fact that we call .MustRegister() on

metrics.Registry.MustRegister(controllerMetrics.ConfigPushCount, controllerMetrics.TranslationCount, controllerMetrics.ConfigPushDuration)
on prometheus RegistererGatherer.

Special notes for your reviewer:

Found when adding tests for #3421

@pmalek pmalek self-assigned this Feb 2, 2023
@pmalek pmalek marked this pull request as ready for review February 2, 2023 14:58
@pmalek pmalek requested a review from a team as a code owner February 2, 2023 14:58
@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Base: 73.5% // Head: 73.4% // Decreases project coverage by -0.1% ⚠️

Coverage data is based on head (0f55f29) compared to base (4187223).
Patch coverage: 100.0% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3473     +/-   ##
=======================================
- Coverage   73.5%   73.4%   -0.1%     
=======================================
  Files        118     118             
  Lines      14065   14066      +1     
=======================================
- Hits       10345   10337      -8     
- Misses      3059    3066      +7     
- Partials     661     663      +2     
Impacted Files Coverage Δ
internal/metrics/prometheus.go 100.0% <100.0%> (ø)
...nternal/controllers/gateway/tcproute_controller.go 70.0% <0.0%> (-2.0%) ⬇️
internal/dataplane/kongstate/service.go 66.0% <0.0%> (-1.3%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pmalek pmalek enabled auto-merge (squash) February 2, 2023 15:33
@pmalek pmalek merged commit edf0962 into main Feb 3, 2023
@pmalek pmalek deleted the dont-panic-when-creating-multiple-kongclients branch February 3, 2023 00:31
@pmalek pmalek added the fix label Mar 1, 2023
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.

2 participants