Skip to content

Omit empty for error and error types #5954

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

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* [ENHANCEMENT] Distributor/Ring: Allow disabling detailed ring metrics by ring member. #5931
* [ENHANCEMENT] KV: Etcd Added etcd.ping-without-stream-allowed parameter to disable/enable PermitWithoutStream #5933
* [CHANGE] Upgrade Dockerfile Node version from 14x to 18x. #5906
* [CHANGE] Query Frontend/Ruler: Omit empty data field in API response. #5953
* [CHANGE] Query Frontend/Ruler: Omit empty data field in API response. #5953 #5954
* [BUGFIX] Configsdb: Fix endline issue in db password. #5920
* [BUGFIX] Ingester: Fix `user` and `type` labels for the `cortex_ingester_tsdb_head_samples_appended_total` TSDB metric. #5952

Expand Down
6 changes: 3 additions & 3 deletions pkg/ruler/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func TestRuler_DeleteNamespace(t *testing.T) {

router.ServeHTTP(w, req)
require.Equal(t, http.StatusAccepted, w.Code)
require.Equal(t, "{\"status\":\"success\",\"errorType\":\"\",\"error\":\"\"}", w.Body.String())
require.Equal(t, "{\"status\":\"success\"}", w.Body.String())

// On Partial failures
req = requestFor(t, http.MethodDelete, "https://localhost:8080/api/v1/rules/namespace2", nil, "user1")
Expand Down Expand Up @@ -430,7 +430,7 @@ rules:
- record: up_rule
expr: up{}
`,
output: "{\"status\":\"success\",\"errorType\":\"\",\"error\":\"\"}",
output: "{\"status\":\"success\"}",
},
{
name: "when exceeding the rule group limit after sending the first group",
Expand Down Expand Up @@ -490,7 +490,7 @@ rules:
expr: |2+
up{}
`,
output: "{\"status\":\"success\",\"errorType\":\"\",\"error\":\"\"}",
output: "{\"status\":\"success\"}",
},
{
name: "when pushing group that CANNOT be safely converted from RuleGroupDesc to RuleGroup yaml",
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/api/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const (
type Response struct {
Status string `json:"status"`
Data interface{} `json:"data,omitempty"`
ErrorType v1.ErrorType `json:"errorType"`
Error string `json:"error"`
ErrorType v1.ErrorType `json:"errorType,omitempty"`
Error string `json:"error,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}

Expand Down
Loading