fix(prometheus): disable features when prometheus plugin is turned off#11117
Merged
moonming merged 11 commits intoApr 10, 2024
Merged
Conversation
shreemaan-abhishek
force-pushed
the
fix/prometheus-disable-perf-problem
branch
from
April 6, 2024 16:51
86d0e0e to
eab64d3
Compare
… enabled by default/design lol
shreemaan-abhishek
marked this pull request as ready for review
April 7, 2024 17:14
starsz
reviewed
Apr 8, 2024
| end | ||
|
|
||
| local enabled = core.table.array_find(http_plugin_names, "prometheus") ~= nil | ||
| local active = exporter.get_prometheus() ~= nil |
Contributor
There was a problem hiding this comment.
I think we don't need to get the active status.
Since the exporter.destroy is harmless.
Contributor
Author
There was a problem hiding this comment.
you are right
Contributor
Author
There was a problem hiding this comment.
no I think the second if check needs the active status. Consider this case:
- apisix is running with prometheus active and enabled
- hit plugin reload
In this case enabled == true and active == true. But we need not call http_init() in prometheus because it is already running during this operation.
starsz
approved these changes
Apr 10, 2024
moonming
approved these changes
Apr 10, 2024
5 tasks
nic-6443
reviewed
Jan 13, 2026
|
|
||
| function _M.destroy() | ||
| if prometheus ~= nil then | ||
| prometheus_bkp = core.table.deepcopy(prometheus) |
Member
There was a problem hiding this comment.
Why use deepcopy? Using the original object directly should be fine.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR allows disabling the export server when prometheus is removed from plugins list in config.yaml and then the plugin reload api is called.
Fixes #11046
Checklist