Skip to content

Commit e866aa5

Browse files
authored
Remove useless err check in LabelValues API (grafana/phlare#669)
1 parent 2ed9361 commit e866aa5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

pkg/querier/http.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,16 @@ type QueryHandlers struct {
3131
upstream querierv1connect.QuerierServiceHandler
3232
}
3333

34-
// LabelValuesHandler only returns the label values for the given label name.
34+
// LabelValues only returns the label values for the given label name.
3535
// This is mostly for fulfilling the pyroscope API and won't be used in the future.
36-
// /label-values?label=__name__
36+
// For example, /label-values?label=__name__ will return all the profile types.
3737
func (q *QueryHandlers) LabelValues(w http.ResponseWriter, req *http.Request) {
3838
label := req.URL.Query().Get("label")
3939
if label == "" {
4040
http.Error(w, "label parameter is required", http.StatusBadRequest)
4141
return
4242
}
43-
var (
44-
res []string
45-
err error
46-
)
43+
var res []string
4744

4845
if label == "__name__" {
4946
response, err := q.upstream.ProfileTypes(req.Context(), connect.NewRequest(&querierv1.ProfileTypesRequest{}))
@@ -63,11 +60,6 @@ func (q *QueryHandlers) LabelValues(w http.ResponseWriter, req *http.Request) {
6360
res = response.Msg.Names
6461
}
6562

66-
if err != nil {
67-
http.Error(w, err.Error(), http.StatusInternalServerError)
68-
return
69-
}
70-
7163
w.Header().Add("Content-Type", "application/json")
7264
if err := json.NewEncoder(w).Encode(res); err != nil {
7365
http.Error(w, err.Error(), http.StatusInternalServerError)

0 commit comments

Comments
 (0)