Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
change log level to debug (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
peroxyacyl authored Dec 17, 2022
1 parent 4e7db9e commit 7c76d47
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/druid.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ type grafanaMetricFindValue struct {
}

func (ds *druidDatasource) QueryVariableData(ctx context.Context, req *backend.CallResourceRequest) ([]grafanaMetricFindValue, error) {
log.DefaultLogger.Info("QUERY VARIABLE", "_________________________REQ___________________________", string(req.Body))
log.DefaultLogger.Debug("QUERY VARIABLE", "_________________________REQ___________________________", string(req.Body))
s, err := ds.settings(req.PluginContext)
if err != nil {
return []grafanaMetricFindValue{}, err
Expand All @@ -162,21 +162,21 @@ func (ds *druidDatasource) QueryVariableData(ctx context.Context, req *backend.C
}

func (ds *druidDatasource) queryVariable(qry []byte, s *druidInstanceSettings) ([]grafanaMetricFindValue, error) {
log.DefaultLogger.Info("DRUID EXECUTE QUERY VARIABLE", "_________________________GRAFANA QUERY___________________________", string(qry))
log.DefaultLogger.Debug("DRUID EXECUTE QUERY VARIABLE", "_________________________GRAFANA QUERY___________________________", string(qry))
// feature: probably implement a short (1s ? 500ms ? configurable in datasource ? beware memory: constrain size ?) life cache (druidInstanceSettings.cache ?) and early return then
response := []grafanaMetricFindValue{}
q, stg, err := ds.prepareQuery(qry, s)
if err != nil {
return response, err
}
log.DefaultLogger.Info("DRUID EXECUTE QUERY VARIABLE", "_________________________DRUID QUERY___________________________", q)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY VARIABLE", "_________________________DRUID QUERY___________________________", q)
r, err := ds.executeQuery("variable", q, s, stg)
if err != nil {
return response, err
}
log.DefaultLogger.Info("DRUID EXECUTE QUERY VARIABLE", "_________________________DRUID RESPONSE___________________________", r)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY VARIABLE", "_________________________DRUID RESPONSE___________________________", r)
response, err = ds.prepareVariableResponse(r, stg)
log.DefaultLogger.Info("DRUID EXECUTE QUERY VARIABLE", "_________________________GRAFANA RESPONSE___________________________", response)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY VARIABLE", "_________________________GRAFANA RESPONSE___________________________", response)
return response, err
}

Expand Down Expand Up @@ -289,27 +289,27 @@ func (ds *druidDatasource) settings(ctx backend.PluginContext) (*druidInstanceSe
}

func (ds *druidDatasource) query(qry backend.DataQuery, s *druidInstanceSettings) backend.DataResponse {
log.DefaultLogger.Info("DRUID EXECUTE QUERY", "_________________________GRAFANA QUERY___________________________", qry)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY", "_________________________GRAFANA QUERY___________________________", qry)
// feature: probably implement a short (1s ? 500ms ? configurable in datasource ? beware memory: constrain size ?) life cache (druidInstanceSettings.cache ?) and early return then
response := backend.DataResponse{}
q, stg, err := ds.prepareQuery(qry.JSON, s)
if err != nil {
response.Error = err
return response
}
log.DefaultLogger.Info("DRUID EXECUTE QUERY", "_________________________DRUID QUERY___________________________", q)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY", "_________________________DRUID QUERY___________________________", q)
r, err := ds.executeQuery(qry.RefID, q, s, stg)
if err != nil {
response.Error = err
return response
}
log.DefaultLogger.Info("DRUID EXECUTE QUERY", "_________________________DRUID RESPONSE___________________________", r)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY", "_________________________DRUID RESPONSE___________________________", r)
response, err = ds.prepareResponse(r, stg)
if err != nil {
// note: error could be set from prepareResponse but this gives a chance to react to error here
response.Error = err
}
log.DefaultLogger.Info("DRUID EXECUTE QUERY", "_________________________GRAFANA RESPONSE___________________________", response)
log.DefaultLogger.Debug("DRUID EXECUTE QUERY", "_________________________GRAFANA RESPONSE___________________________", response)
return response
}

Expand Down

0 comments on commit 7c76d47

Please sign in to comment.