@@ -6,15 +6,13 @@ import (
66 "errors"
77 "fmt"
88 "maps"
9- "reflect"
109 "slices"
1110 "sort"
1211 "time"
1312
1413 harper "github.com/HarperDB/sdk-go"
1514 "github.com/grafana/grafana-plugin-sdk-go/backend"
1615 "github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
17- "github.com/grafana/grafana-plugin-sdk-go/backend/log"
1816 "github.com/grafana/grafana-plugin-sdk-go/data"
1917)
2018
@@ -76,8 +74,6 @@ func (d *Datasource) Dispose() {}
7674// The QueryDataResponse contains a map of RefID to the response for each query, and each response
7775// contains Frames ([]*Frame).
7876func (d * Datasource ) QueryData (ctx context.Context , req * backend.QueryDataRequest ) (* backend.QueryDataResponse , error ) {
79- log .DefaultLogger .Info ("QueryData" , "request" , req )
80-
8177 // create response struct
8278 response := backend .NewQueryDataResponse ()
8379
@@ -161,8 +157,6 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
161157 return backend.DataResponse {}, fmt .Errorf ("could not unmarshal Grafana query JSON: '%s': '%w'" , query .JSON , err )
162158 }
163159
164- log .DefaultLogger .Debug ("Query" , "operation" , qo )
165-
166160 switch qo .Operation {
167161 case "get_analytics" :
168162 var qm queryModel [GetAnalyticsQuery ]
@@ -171,7 +165,6 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
171165 return backend.DataResponse {}, fmt .Errorf ("could not unmarshal get_analytics query JSON: '%s': '%w'" , query .JSON , err )
172166 }
173167 request := qm .QueryAttrs
174- log .DefaultLogger .Debug ("Query" , "request" , request )
175168
176169 conditions := make (harper.SearchConditions , 0 )
177170 for _ , c := range request .Conditions {
@@ -197,8 +190,6 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
197190 return backend.DataResponse {}, fmt .Errorf ("could not query Harper analytics: '%s': '%w'" , query .JSON , err )
198191 }
199192
200- log .DefaultLogger .Debug ("Get analytics query results" , "results" , results )
201-
202193 // Collect the superset of all fields in the results.
203194 // Grafana gets very cranky if any rows have a different set of fields (columns), so we have to make sure they
204195 // all have all of them.
@@ -226,12 +217,8 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
226217 for i , header := range grafanaAnalytics .Headers {
227218 val , ok := result [header ]
228219 if ! ok {
229- log .DefaultLogger .Debug ("Header not found in result; assigning nil" , "header" , header )
230220 row [i ] = nil
231221 } else {
232- if val != nil {
233- log .DefaultLogger .Debug ("Row" , "header" , header , "val" , val , "type" , reflect .TypeOf (val ).String ())
234- }
235222 switch v := val .(type ) {
236223 case string :
237224 if grafanaAnalytics .FieldTypes [i ] == data .FieldTypeUnknown {
@@ -259,7 +246,6 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
259246 }
260247 row [i ] = & v
261248 case nil :
262- log .DefaultLogger .Debug ("Assigning nil" , "header" , header )
263249 if grafanaAnalytics .FieldTypes [i ] == data .FieldTypeUnknown {
264250 grafanaAnalytics .FieldTypes [i ] = data .FieldTypeNullableString
265251 }
0 commit comments