log: added debug-log (#113156)
* log: added debug-log * fixed unit test * fixed another unit test
This commit is contained in:
@@ -76,6 +76,8 @@ func (hs *HTTPServer) QueryMetricsV2(c *contextmodel.ReqContext) response.Respon
|
||||
|
||||
var resp *backend.QueryDataResponse
|
||||
var err error
|
||||
|
||||
hs.log.Debug("QueryMetricsV2: request received", "time_in_query", handleTimeInQuery)
|
||||
if handleTimeInQuery {
|
||||
resp, err = hs.queryDataService.QueryDataNew(c.Req.Context(), c.SignedInUser, c.SkipDSCache, reqDTO)
|
||||
} else {
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/apimachinery/errutil"
|
||||
"github.com/grafana/grafana/pkg/infra/db/dbtest"
|
||||
"github.com/grafana/grafana/pkg/infra/localcache"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin"
|
||||
pluginClient "github.com/grafana/grafana/pkg/plugins/manager/client"
|
||||
@@ -86,6 +87,7 @@ func TestAPIEndpoint_Metrics_QueryMetricsV2(t *testing.T) {
|
||||
server := SetupAPITestServer(t, func(hs *HTTPServer) {
|
||||
hs.queryDataService = qds
|
||||
hs.QuotaService = quotatest.New(false, nil)
|
||||
hs.log = log.New("test-logger")
|
||||
})
|
||||
|
||||
t.Run("Status code is 400 when data source response has an error", func(t *testing.T) {
|
||||
@@ -252,6 +254,7 @@ func TestDataSourceQueryError(t *testing.T) {
|
||||
err := r.Add(context.Background(), p)
|
||||
require.NoError(t, err)
|
||||
ds := &fakeDatasources.FakeDataSourceService{}
|
||||
hs.log = log.New("test-logger")
|
||||
hs.queryDataService = query.ProvideService(
|
||||
cfg,
|
||||
&fakeDatasources.FakeCacheService{},
|
||||
|
||||
Reference in New Issue
Block a user