File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,16 @@ type QueryHandlers struct {
31
31
upstream querierv1connect.QuerierServiceHandler
32
32
}
33
33
34
- // LabelValuesHandler only returns the label values for the given label name.
34
+ // LabelValues only returns the label values for the given label name.
35
35
// 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.
37
37
func (q * QueryHandlers ) LabelValues (w http.ResponseWriter , req * http.Request ) {
38
38
label := req .URL .Query ().Get ("label" )
39
39
if label == "" {
40
40
http .Error (w , "label parameter is required" , http .StatusBadRequest )
41
41
return
42
42
}
43
- var (
44
- res []string
45
- err error
46
- )
43
+ var res []string
47
44
48
45
if label == "__name__" {
49
46
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) {
63
60
res = response .Msg .Names
64
61
}
65
62
66
- if err != nil {
67
- http .Error (w , err .Error (), http .StatusInternalServerError )
68
- return
69
- }
70
-
71
63
w .Header ().Add ("Content-Type" , "application/json" )
72
64
if err := json .NewEncoder (w ).Encode (res ); err != nil {
73
65
http .Error (w , err .Error (), http .StatusInternalServerError )
You can’t perform that action at this time.
0 commit comments