Alerting: Contextual log provider for rule key (#57476)

* create contextual log context provider
* use contextual provider in scheduler
* init logger in the package
* use context for log context
* use context in state manager
This commit is contained in:
Yuriy Tseretyan
2022-10-26 19:16:02 -04:00
committed by GitHub
parent 59ffd9571e
commit 0a4121cef8
9 changed files with 33 additions and 15 deletions
+1
View File
@@ -202,6 +202,7 @@ func (s *Service) buildDSNode(dp *simple.DirectedGraph, rn *rawNode, req *Reques
// other nodes they must have already been executed and their results must
// already by in vars.
func (dn *DSNode) Execute(ctx context.Context, now time.Time, _ mathexp.Vars, s *Service) (mathexp.Results, error) {
logger := logger.FromContext(ctx).New("datasourceType", dn.datasource.Type)
dsInstanceSettings, err := adapters.ModelToInstanceSettings(dn.datasource, s.decryptSecureJsonDataFn(ctx))
if err != nil {
return mathexp.Results{}, fmt.Errorf("%v: %w", "failed to convert datasource instance settings", err)