Skip to content
Snippets Groups Projects
Unverified Commit 645eef4a authored by Xabier Larrakoetxea's avatar Xabier Larrakoetxea
Browse files

Add the original SLO group source information to the plugin request


Signed-off-by: default avatarXabier Larrakoetxea <me@slok.dev>
parent a9bd6024
No related branches found
No related tags found
No related merge requests found
......@@ -175,7 +175,7 @@ func (s Service) Generate(ctx context.Context, r Request) (*Response, error) {
slo.Labels = utilsdata.MergeLabels(slo.Labels, r.ExtraLabels)
// Generate SLO result.
result, err := s.generateSLO(ctx, r.Info, slo)
result, err := s.generateSLO(ctx, r.Info, r.SLOGroup, slo)
if err != nil {
return nil, fmt.Errorf("could not generate %q slo: %w", slo.ID, err)
}
......@@ -188,7 +188,7 @@ func (s Service) Generate(ctx context.Context, r Request) (*Response, error) {
}, nil
}
func (s Service) generateSLO(ctx context.Context, info model.Info, slo model.PromSLO) (*model.PromSLORules, error) {
func (s Service) generateSLO(ctx context.Context, info model.Info, sloGroup model.PromSLOGroup, slo model.PromSLO) (*model.PromSLORules, error) {
logger := s.logger.WithCtxValues(ctx).WithValues(log.Kv{"slo": slo.ID})
// Generate the MWMB alerts.
......@@ -242,6 +242,7 @@ func (s Service) generateSLO(ctx context.Context, info model.Info, slo model.Pro
Info: info,
MWMBAlertGroup: *as,
SLO: slo,
SLOGroup: sloGroup,
}
res := &SLOProcessorResult{}
for _, p := range sloProcessors {
......
......@@ -13,6 +13,7 @@ import (
type SLOProcessorRequest struct {
Info model.Info
SLO model.PromSLO
SLOGroup model.PromSLOGroup
MWMBAlertGroup model.MWMBAlertGroup
}
type SLOProcessorResult struct {
......@@ -51,6 +52,7 @@ func NewSLOProcessorFromSLOPluginV1(pluginFactory pluginslov1.PluginFactory, log
Info: req.Info,
SLO: req.SLO,
MWMBAlertGroup: req.MWMBAlertGroup,
OriginalSource: req.SLOGroup.OriginalSource,
}
rs := &pluginslov1.Result{
SLORules: res.SLORules,
......
......@@ -29,6 +29,10 @@ type AppUtils struct {
type Request struct {
// Info about the application and execution, normally used as metadata.
Info model.Info
// OriginalSource is the original specification of the SLO came from, this is informative data that
// can be used to make decision on plugins, it should be used only as RO.
// The information used on the generation is the SLO model itself not this one.
OriginalSource model.PromSLOGroupSource
// The SLO to process and generate the final Prom rules.
SLO model.PromSLO
// The SLO MWMBAlertGroup selected.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment