// generatePrometheus generates the SLOs based on a raw regular Prometheus spec format input and
// outs a Prometheus raw yaml.
generatePrometheus generates the SLOs based on a raw regular Prometheus spec format input and
outs a Prometheus raw yaml.
// generatePrometheus generates the SLOs based on a raw regular Prometheus spec format input and // outs a Prometheus raw yaml .
func generatePrometheus(ctx context.Context, logger log.Logger, disableRecs, disableAlerts bool, extraLabels map[string]string, slos prometheus.SLOGroup, out io.Writer) error {
	logger.Infof("Generating from Prometheus spec")
	info := info.Info{
		Version: info.Version,
		Mode:    info.ModeCLIGenPrometheus,
		Spec:    prometheusv1.Version,
	}
	result, err := generateRules(ctx, logger, info, disableRecs, disableAlerts, extraLabels, slos)
	if err != nil {
		return err
	}
	repo := prometheus.NewIOWriterGroupedRulesYAMLRepo(out, logger)
	storageSLOs := make([]prometheus.StorageSLO, 0, len(result.PrometheusSLOs))
	for _, s := range result.PrometheusSLOs {
		storageSLOs = append(storageSLOs, prometheus.StorageSLO{
			SLO:   s.SLO,
			Rules: s.SLORules,
		})
	}
	err = repo.StoreSLOs(ctx, storageSLOs)
	if err != nil {
		return fmt.Errorf("could not store SLOS: %w", err)
	}
	return nil
}
func generatePrometheus ( ctx context . Context , logger log . Logger , disableRecs , disableAlerts bool , extraLabels map [ string ] string , slos prometheus . SLOGroup , out io . Writer ) error { logger . Infof ( " " ) info := info . Info { Version : info . Version , Mode : info . ModeCLIGenPrometheus , Spec : prometheusv1 . Version , } result , err := generateRules ( ctx , logger , info , disableRecs , disableAlerts , extraLabels , slos ) if err != nil { return err } repo := prometheus . NewIOWriterGroupedRulesYAMLRepo ( out , logger ) storageSLOs := make ( [ ] prometheus . StorageSLO , 0 , len ( result . PrometheusSLOs ) ) for _ , s := range result . PrometheusSLOs { storageSLOs = append ( storageSLOs , prometheus . StorageSLO { SLO : s . SLO , Rules : s . SLORules , } ) } err = repo . StoreSLOs ( ctx , storageSLOs ) if err != nil { return fmt . Errorf ( " " , err ) } return nil }
generatePrometheus generates the SLOs based on a raw regular Prometheus spec format input and
outs a Prometheus raw yaml.
generatePrometheus generates the SLOs based on a raw regular Prometheus spec format input and outs a Prometheus raw yaml .