Loki: Improve backend instrumentation of QueryData calls (#73807)

* improve loki `queryData` instrumentation

* fix lint

* use correct logger in "queryData"

* capitalize log messages

* distinguish between requests from alerting
This commit is contained in:
Sven Grossmann
2023-09-01 11:44:18 +02:00
committed by GitHub
parent f4c127a1d8
commit 124f445db0
4 changed files with 56 additions and 26 deletions
+3 -2
View File
@@ -6,6 +6,7 @@ import (
"net/http"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing"
)
type mockRequestCallback func(req *http.Request)
@@ -64,7 +65,7 @@ func makeMockedAPIWithUrl(url string, statusCode int, contentType string, respon
Transport: &mockedRoundTripper{statusCode: statusCode, contentType: contentType, responseBytes: responseBytes, requestCallback: requestCallback},
}
return newLokiAPI(&client, url, log.New("test"))
return newLokiAPI(&client, url, log.New("test"), tracing.NewFakeTracer())
}
func makeCompressedMockedAPIWithUrl(url string, statusCode int, contentType string, responseBytes []byte, requestCallback mockRequestCallback) *LokiAPI {
@@ -72,5 +73,5 @@ func makeCompressedMockedAPIWithUrl(url string, statusCode int, contentType stri
Transport: &mockedCompressedRoundTripper{statusCode: statusCode, contentType: contentType, responseBytes: responseBytes, requestCallback: requestCallback},
}
return newLokiAPI(&client, url, log.New("test"))
return newLokiAPI(&client, url, log.New("test"), tracing.NewFakeTracer())
}