-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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): conflict between global rule and route configure #6579
Merged
spacewander
merged 7 commits into
apache:master
from
shuaijinchao:bugfix/prometheus/between
Mar 15, 2022
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
123d4c3
fix(prometheus): conflict between global rule and route configure
shuaijinchao 3670b1a
fix(prometheus): update test case
shuaijinchao 1fec699
fix(prometheus): update verify case
shuaijinchao 88b1bb3
fix(prometheus): update test case
shuaijinchao 8af7fd5
fix(prometheus): update test case check value
shuaijinchao 854f777
fix(prometheus): remove test case debug tag
shuaijinchao b95a927
test(prometheus): remove redundant verify
shuaijinchao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,3 +203,65 @@ plugins: | |
} | ||
--- response_body_like eval | ||
qr/apisix_batch_process_entries\{name="http logger",route_id="1",server_addr="127.0.0.1"\} \d+/ | ||
|
||
|
||
|
||
=== TEST 5: set prometheus plugin at both global rule and route | ||
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local t = require("lib.test_admin").test | ||
local code, body = t('/apisix/admin/routes/1', | ||
ngx.HTTP_PUT, | ||
[[{ | ||
"plugins": { | ||
"prometheus": {} | ||
}, | ||
"upstream": { | ||
"nodes": { | ||
"127.0.0.1:1980": 1 | ||
}, | ||
"type": "roundrobin" | ||
}, | ||
"uri": "/opentracing" | ||
}]] | ||
) | ||
if code >= 300 then | ||
ngx.status = code | ||
return | ||
end | ||
local t = require("lib.test_admin").test | ||
local code, body = t('/apisix/admin/global_rules/1', | ||
ngx.HTTP_PUT, | ||
[[{ | ||
"plugins": { | ||
"prometheus": {} | ||
} | ||
}]] | ||
) | ||
if code >= 300 then | ||
ngx.status = code | ||
return | ||
end | ||
ngx.say(body) | ||
} | ||
} | ||
--- response_body | ||
passed | ||
|
||
|
||
|
||
=== TEST 6: test prometheus plugin at both global rule and route | ||
--- request | ||
GET /opentracing | ||
--- response_body | ||
opentracing | ||
--- error_code: 200 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error_code check here is redundant? |
||
|
||
|
||
|
||
=== TEST 7: fetch prometheus plugin at both global rule and route data | ||
--- request | ||
GET /apisix/prometheus/metrics | ||
--- response_body eval | ||
qr/apisix_http_status\{code="200",route="1",matched_uri="\/opentracing",matched_host="",service="",consumer="",node="127.0.0.1\"} 1/ |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the
nginx-lua-prometheus
need update ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, APISIX from 2.7 to master,
nginx-lua-prometheus
has only one version upgrade, and this upgrade ofnginx-lua-prometheus
is not related to the current issue.https://github.com/knyar/nginx-lua-prometheus/blob/master/CHANGELOG.md#020220127