Alerting: Add debug logs in validateAndGetPrefix (#57002)

This commit is contained in:
George Robinson 2022-10-31 16:40:28 +00:00 committed by GitHub
parent 0dfd78c88c
commit b0a927b138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}