Ensure that datasource apiservers receive and forwards headers (#92304)

* Ensure that datasource apiservers receive and forwards headers for datasources:
- adds log line for prometheus to see when from alert header is received
- add logging to the datasource apiserver
- Updates the Connect func in sub query to forward expected headers to datasources and log unexpected ones.
This commit is contained in:
Sarah Zinger
2024-08-29 11:06:25 -04:00
committed by GitHub
parent 2b3d2e5b40
commit c0b2fafd5e
4 changed files with 125 additions and 2 deletions
+2 -1
View File
@@ -86,6 +86,8 @@ func New(
func (s *QueryData) Execute(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
fromAlert := req.Headers["FromAlert"] == "true"
logger := s.log.FromContext(ctx)
logger.Debug("Begin query execution", "fromAlert", fromAlert)
result := backend.QueryDataResponse{
Responses: backend.Responses{},
}
@@ -104,7 +106,6 @@ func (s *QueryData) Execute(ctx context.Context, req *backend.QueryDataRequest)
concurrentQueryCount, err := req.PluginContext.GrafanaConfig.ConcurrentQueryCount()
if err != nil {
logger := s.log.FromContext(ctx)
logger.Debug(fmt.Sprintf("Concurrent Query Count read/parse error: %v", err), "prometheusRunQueriesInParallel")
concurrentQueryCount = 10
}