mirror of
https://github.com/AdguardTeam/AdGuardDNS.git
synced 2025-02-20 11:23:36 +08:00
25 lines
590 B
Go
25 lines
590 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/AdguardTeam/golibs/mapsutil"
|
|
"github.com/prometheus/common/model"
|
|
)
|
|
|
|
// Additional prometheus information configuration
|
|
|
|
// additionalInfo is a extra info configuration.
|
|
type additionalInfo map[string]string
|
|
|
|
// validateAdditionalInfo return an error is the section is invalid.
|
|
func (c additionalInfo) validate() (err error) {
|
|
return mapsutil.OrderedRangeError(c, func(k, _ string) (keyErr error) {
|
|
if model.LabelName(k).IsValid() {
|
|
return nil
|
|
}
|
|
|
|
return fmt.Errorf("prometheus labels must match %s, got %q", model.LabelNameRE, k)
|
|
})
|
|
}
|