Ensure synthetic metric query format#2399
Conversation
📝 WalkthroughWalkthroughisACMLabelQuery now recognizes Grafana Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
proxy/pkg/proxy/proxy_test.go (1)
349-364:⚠️ Potential issue | 🟡 MinorDuplicate test case names — two tests walking around with the same badge. 🚨
Lines 350 and 358 both have the name
"should handle GET to label values endpoint with correct metric". When one of these fails, you'll be playing detective to figure out which test actually broke. The subtest framework uses these names for identification, so this is like having two functions namedmain().🔧 Proposed fix: Differentiate the test names
{ - name: "should handle GET to label values endpoint with correct metric", + name: "should handle GET to label values endpoint with metric selector syntax", method: "GET", path: "/api/v1/label/label_name/values?match[]=" + config.RBACProxyLabelMetricName + "{}", body: nil, expectedToHandle: true, expectedBody: `{"status":"success","data":["cloud","cluster_open_cluster_management_io_clusterset","name","vendor"]}`, }, { - name: "should handle GET to label values endpoint with correct metric", + name: "should handle GET to label values endpoint with bare metric name", method: "GET", path: "/api/v1/label/label_name/values?match[]=" + config.RBACProxyLabelMetricName, body: nil, expectedToHandle: true, expectedBody: `{"status":"success","data":["cloud","cluster_open_cluster_management_io_clusterset","name","vendor"]}`, },As per coding guidelines: "Focus on test coverage and test quality" — unique names ensure each test is clearly identifiable.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@proxy/pkg/proxy/proxy_test.go` around lines 349 - 364, Two subtests share the identical name "should handle GET to label values endpoint with correct metric" which makes failures ambiguous; locate the two test table entries that build paths with match[]=" + config.RBACProxyLabelMetricName + "{}" and match[]=" + config.RBACProxyLabelMetricName and give them distinct names (for example append " with braces" and " without braces" or include the path variant) so each subtest (the entries that set path using config.RBACProxyLabelMetricName and config.RBACProxyLabelMetricName + "{}") is uniquely identifiable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@proxy/pkg/proxy/proxy_test.go`:
- Around line 349-364: Two subtests share the identical name "should handle GET
to label values endpoint with correct metric" which makes failures ambiguous;
locate the two test table entries that build paths with match[]=" +
config.RBACProxyLabelMetricName + "{}" and match[]=" +
config.RBACProxyLabelMetricName and give them distinct names (for example append
" with braces" and " without braces" or include the path variant) so each
subtest (the entries that set path using config.RBACProxyLabelMetricName and
config.RBACProxyLabelMetricName + "{}") is uniquely identifiable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a776c319-19be-4455-a628-564d07b15a85
📒 Files selected for processing (2)
proxy/pkg/proxy/proxy.goproxy/pkg/proxy/proxy_test.go
a087990 to
dd09288
Compare
Signed-off-by: Coleen Iona Quadros <coleen.quadros27@gmail.com>
dd09288 to
1f79a94
Compare
|
/retest-required |
|
@coleenquadros: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: coleenquadros, thibaultmg The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When perses is querying for labelname values for the metric acm_label_names, the query is of the format
api/v1/label/label_name/values?match[]=acm_label_names{}when we dont provide any filters and we do not return any result since we are strictly checking ifslices.Contains(matchers, proxyconfig.RBACProxyLabelMetricName)because of which the dashboard variables dont render.Ive requested for a fix upstream but not sure if it will go through -> perses/plugins#611
Summary by CodeRabbit
Bug Fixes
Tests