mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
1c3ce0735f
* Alerting: Tiny refactor on the eval and schedule packages two very small things: - We had a constructor on something called a `Context` which is not a `context.Context` so let's just name that constructor `NewContext` - The user that we use to run query evaluations is the same (with some variation) abstract it to a function so that it can be re-used when necessary. * Update pkg/services/ngalert/schedule/schedule.go Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com> * Update pkg/services/ngalert/schedule/schedule.go Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com> --------- Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
21 lines
388 B
Go
21 lines
388 B
Go
package eval
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
)
|
|
|
|
// EvaluationContext represents the context in which a condition is evaluated.
|
|
type EvaluationContext struct {
|
|
Ctx context.Context
|
|
User *user.SignedInUser
|
|
}
|
|
|
|
func NewContext(ctx context.Context, user *user.SignedInUser) EvaluationContext {
|
|
return EvaluationContext{
|
|
Ctx: ctx,
|
|
User: user,
|
|
}
|
|
}
|