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(prometheus): disable features when plugin is turned off #11047

Closed
wants to merge 10 commits into from
Closed

fix(prometheus): disable features when plugin is turned off #11047

wants to merge 10 commits into from

Conversation

motongxue
Copy link
Contributor

@motongxue motongxue commented Mar 15, 2024

Description

The Prometheus plugin is a crucial component for observability within Apache APISIX. However, I've encountered an issue where, even after the Prometheus plugin is disabled, all features related to Prometheus are not entirely shut down. This behavior could lead to unexpected performance impacts and data leakage.

When the Prometheus plugin is disabled, all functionalities and metrics associated with Prometheus should be completely deactivated to ensure no unnecessary overhead or data exposure.

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)


{% else %}

init_by_lua_block {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. this block is for stream only, please take care of the http
  2. init_by_lua_block should be kept

Copy link
Contributor Author

@motongxue motongxue Mar 15, 2024

Choose a reason for hiding this comment

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

  1. this block is for stream only, please take care of the http
  2. init_by_lua_block should be kept

Hi. I have made a corresponding modification based on your two modification opinions

@Revolyssup
Copy link
Contributor

@motongxue Please fix the lint checks.

@monkeyDluffy6017
Copy link
Contributor

Could you add test cases to cover this?

t/xrpc/prometheus2.t Outdated Show resolved Hide resolved
location /t {
content_by_lua_block {
local plugin = require("apisix.plugins.prometheus")
local ok, err = plugin.check_schema({})
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you add this test case?

- limit-count
--- request
GET /apisix/prometheus/metrics
--- error_code: 404
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you only need to add this test case into the existing test cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will do it according to your suggestions, although existing test case (t/xprc/prometheus.t) I can't test it in my local development environment.

@Revolyssup
Copy link
Contributor

@motongxue Can you address the failing CI?

@motongxue
Copy link
Contributor Author

@motongxue Can you address the failing CI?
@Revolyssup Regrettably, through log investigation, I found that the CI issue occurred not because of my actions but due to problems in other test files. Additionally, as a newcomer, I am still struggling with test cases and therefore do not know how to resolve these issues.

@motongxue motongxue closed this Mar 28, 2024
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.

3 participants