SSE: (Chore) Update log line with context (trace) (#89172)

Improves log line to help with debugging in Server Side Expressions. In particular, the traceId, datasourceType, and datasourceUid will now be included.
This commit is contained in:
Kyle Brandt 2024-06-13 10:58:39 -04:00 committed by GitHub
parent b7180c17b8
commit 82aa000e9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana/pkg/expr/mathexp"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/featuremgmt"
@ -119,7 +120,7 @@ func (c *ResultConverter) Convert(ctx context.Context,
}, nil
}
func getResponseFrame(resp *backend.QueryDataResponse, refID string) (data.Frames, error) {
func getResponseFrame(logger *log.ConcreteLogger, resp *backend.QueryDataResponse, refID string) (data.Frames, error) {
response, ok := resp.Responses[refID]
if !ok {
// This indicates that the RefID of the request was not included to the response, i.e. some problem in the data source plugin

View File

@ -124,7 +124,7 @@ func (m *MLNode) Execute(ctx context.Context, now time.Time, _ mathexp.Vars, s *
data = &backend.QueryDataResponse{Responses: map[string]backend.DataResponse{}}
}
dataFrames, err := getResponseFrame(data, m.refID)
dataFrames, err := getResponseFrame(logger, data, m.refID)
if err != nil {
return mathexp.Results{}, MakeQueryError(m.refID, "ml", err)
}

View File

@ -325,7 +325,7 @@ func executeDSNodesGrouped(ctx context.Context, now time.Time, vars mathexp.Vars
}
for _, dn := range nodeGroup {
dataFrames, err := getResponseFrame(resp, dn.refID)
dataFrames, err := getResponseFrame(logger, resp, dn.refID)
if err != nil {
vars[dn.refID] = mathexp.Results{Error: MakeQueryError(dn.refID, dn.datasource.UID, err)}
instrument(err, "")
@ -395,7 +395,7 @@ func (dn *DSNode) Execute(ctx context.Context, now time.Time, _ mathexp.Vars, s
return mathexp.Results{}, MakeQueryError(dn.refID, dn.datasource.UID, err)
}
dataFrames, err := getResponseFrame(resp, dn.refID)
dataFrames, err := getResponseFrame(logger, resp, dn.refID)
if err != nil {
return mathexp.Results{}, MakeQueryError(dn.refID, dn.datasource.UID, err)
}