@@ -23,31 +23,29 @@ func (ps *prometheusServer) Query(ctx context.Context, req *connect.Request[v1.Q
23
23
return nil , err
24
24
}
25
25
26
- switch value .(type ) {
26
+ switch v := value .(type ) {
27
27
case * model.String :
28
- s := value .(* model.String )
29
28
return connect .NewResponse (& v1.QueryResponse {
30
29
Warnings : warnings ,
31
30
Options : & v1.QueryResponse_String_ {
32
31
String_ : & v1.String {
33
- Time : s .Timestamp .Unix (),
34
- Value : s .Value ,
32
+ Time : v .Timestamp .Unix (),
33
+ Value : v .Value ,
35
34
},
36
35
},
37
36
}), err
38
37
case * model.Scalar :
39
- s := value .(* model.Scalar )
40
38
return connect .NewResponse (& v1.QueryResponse {
41
39
Warnings : warnings ,
42
40
Options : & v1.QueryResponse_Scalar {
43
41
Scalar : & v1.SamplePair {
44
- Time : s .Timestamp .Unix (),
45
- Value : float64 (s .Value ),
42
+ Time : v .Timestamp .Unix (),
43
+ Value : float64 (v .Value ),
46
44
},
47
45
},
48
46
}), nil
49
47
case model.Vector :
50
- vector := convertVector (value .(model. Vector ) )
48
+ vector := convertVector (v )
51
49
return connect .NewResponse (& v1.QueryResponse {
52
50
Warnings : warnings ,
53
51
Options : & v1.QueryResponse_Vector {
@@ -72,12 +70,12 @@ func (ps *prometheusServer) QueryRange(ctx context.Context, req *connect.Request
72
70
return nil , err
73
71
}
74
72
75
- switch value .(type ) {
73
+ switch v := value .(type ) {
76
74
case model.Matrix :
77
75
return connect .NewResponse (& v1.QueryRangeResponse {
78
76
Warnings : warnings ,
79
77
Options : & v1.QueryRangeResponse_Matrix {
80
- Matrix : convertMatrix (value .(model. Matrix ) ),
78
+ Matrix : convertMatrix (v ),
81
79
},
82
80
}), nil
83
81
}
0 commit comments