From b0a927b1385654a6776cbe8deb36f6dfadc914fd Mon Sep 17 00:00:00 2001 From: George Robinson Date: Mon, 31 Oct 2022 16:40:28 +0000 Subject: [PATCH] Alerting: Add debug logs in validateAndGetPrefix (#57002) --- pkg/services/ngalert/api/lotex_ruler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/services/ngalert/api/lotex_ruler.go b/pkg/services/ngalert/api/lotex_ruler.go index ac9366ed43f..d3e44dad65e 100644 --- a/pkg/services/ngalert/api/lotex_ruler.go +++ b/pkg/services/ngalert/api/lotex_ruler.go @@ -183,6 +183,7 @@ func (r *LotexRuler) validateAndGetPrefix(ctx *models.ReqContext) (string, error if err != nil { return "", err } + // Validate URL if ds.Url == "" { return "", fmt.Errorf("URL for this data source is empty") @@ -203,10 +204,14 @@ func (r *LotexRuler) validateAndGetPrefix(ctx *models.ReqContext) (string, error subtype := ctx.Query(subtypeQuery) subTypePrefix, ok := subtypeToPrefix[subtype] if !ok { - r.log.Debug("unable to determine prometheus datasource subtype, using default prefix", "subtype", subtype) + r.log.Debug( + "unable to determine prometheus datasource subtype, using default prefix", + "datasource", ds.Uid, "datasource_type", ds.Type, "subtype", subtype, "prefix", prefix) return prefix, nil } + r.log.Debug("determined prometheus datasource subtype", + "datasource", ds.Uid, "datasource_type", ds.Type, "subtype", subtype) return subTypePrefix, nil }