mirror of
https://github.com/prymitive/karma
synced 2026-08-23 11:56:20 +00:00
chore(backend): use zerolog instead of logrus
This commit is contained in:
committed by
Łukasz Mierzwa
parent
dbe8ffdfd9
commit
170dba8a37
+4
-6
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type binaryFileSystem struct {
|
||||
@@ -49,10 +48,10 @@ func newBinaryFileSystem(root string) *binaryFileSystem {
|
||||
}
|
||||
|
||||
// load a template from binary asset resource
|
||||
func loadTemplate(t *template.Template, path string) *template.Template {
|
||||
func loadTemplate(t *template.Template, path string) (*template.Template, error) {
|
||||
templateContent, err := Asset(path)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tmpl *template.Template
|
||||
@@ -71,11 +70,10 @@ func loadTemplate(t *template.Template, path string) *template.Template {
|
||||
|
||||
_, err = tmpl.Parse(string(templateContent))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return t
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func serveFileOr404(path string, contentType string, c *gin.Context) {
|
||||
|
||||
+15
-22
@@ -6,10 +6,9 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-contrib/static"
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/gin-contrib/static"
|
||||
)
|
||||
|
||||
type customizationAssetsTest struct {
|
||||
@@ -100,15 +99,21 @@ func TestStaticExpires404(t *testing.T) {
|
||||
|
||||
func TestLoadTemplateChained(t *testing.T) {
|
||||
var tmpl *template.Template
|
||||
tmpl = loadTemplate(tmpl, "ui/build/index.html")
|
||||
tmpl, err := loadTemplate(tmpl, "ui/build/index.html")
|
||||
if tmpl == nil {
|
||||
t.Errorf("loadTemplate returned nil")
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("loadTemplate returned error: %s", err)
|
||||
}
|
||||
|
||||
tmpl = loadTemplate(tmpl, "ui/build/manifest.json")
|
||||
tmpl, err = loadTemplate(tmpl, "ui/build/manifest.json")
|
||||
if tmpl == nil {
|
||||
t.Errorf("loadTemplate returned nil")
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("loadTemplate returned error: %s", err)
|
||||
}
|
||||
|
||||
if tmpl.Name() != "ui/build/index.html" {
|
||||
t.Errorf("tmpl.Name() returned %q", tmpl.Name())
|
||||
@@ -116,28 +121,16 @@ func TestLoadTemplateChained(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTemplateMissing(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
defer func() { log.StandardLogger().ExitFunc = nil }()
|
||||
var wasFatal bool
|
||||
log.StandardLogger().ExitFunc = func(int) { wasFatal = true }
|
||||
|
||||
loadTemplate(nil, "/this/file/does/not/exist")
|
||||
|
||||
if !wasFatal {
|
||||
t.Error("loadTemplate() with invalid path didn't cause log.Fatal()")
|
||||
_, err := loadTemplate(nil, "/this/file/does/not/exist")
|
||||
if err == nil {
|
||||
t.Error("loadTemplate() with invalid path didn't return any error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadTemplateUnparsable(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
defer func() { log.StandardLogger().ExitFunc = nil }()
|
||||
var wasFatal bool
|
||||
log.StandardLogger().ExitFunc = func(int) { wasFatal = true }
|
||||
|
||||
loadTemplate(nil, "cmd/karma/tests/bindata/go-test-invalid.html")
|
||||
|
||||
if !wasFatal {
|
||||
t.Error("loadTemplate() with unparsable file didn't cause log.Fatal()")
|
||||
_, err := loadTemplate(nil, "cmd/karma/tests/bindata/go-test-invalid.html")
|
||||
if err == nil {
|
||||
t.Error("loadTemplate() with unparsable file didn't return any error")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,21 +9,17 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/prymitive/karma/internal/alertmanager"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// knownLabelNames allows querying known label names
|
||||
func knownLabelNames(c *gin.Context) {
|
||||
noCache(c)
|
||||
start := time.Now()
|
||||
|
||||
cacheKey := c.Request.RequestURI
|
||||
|
||||
data, found := apiCache.Get(cacheKey)
|
||||
if found {
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "HIT", time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -50,26 +46,22 @@ func knownLabelNames(c *gin.Context) {
|
||||
apiCache.Set(cacheKey, data, time.Second*15)
|
||||
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "MIS", time.Since(start))
|
||||
}
|
||||
|
||||
func knownLabelValues(c *gin.Context) {
|
||||
noCache(c)
|
||||
start := time.Now()
|
||||
|
||||
cacheKey := c.Request.RequestURI
|
||||
|
||||
data, found := apiCache.Get(cacheKey)
|
||||
if found {
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "HIT", time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
name, found := c.GetQuery("name")
|
||||
if !found || name == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "missing name=<token> parameter"})
|
||||
log.Infof("[%s] <%d> %s %s took %s", c.ClientIP(), http.StatusBadRequest, c.Request.Method, c.Request.RequestURI, time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,5 +73,4 @@ func knownLabelValues(c *gin.Context) {
|
||||
apiCache.Set(cacheKey, data, time.Second*15)
|
||||
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "MIS", time.Since(start))
|
||||
}
|
||||
|
||||
+85
-52
@@ -31,11 +31,12 @@ import (
|
||||
"github.com/gin-gonic/contrib/sentry"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
raven "github.com/getsentry/raven-go"
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -181,7 +182,7 @@ func setupUpstreams() error {
|
||||
for _, s := range config.Config.Alertmanager.Servers {
|
||||
|
||||
if s.Proxy && s.ReadOnly {
|
||||
return fmt.Errorf("Failed to create Alertmanager '%s' with URI '%s': cannot use proxy and readonly mode at the same time", s.Name, uri.SanitizeURI(s.URI))
|
||||
return fmt.Errorf("failed to create Alertmanager '%s' with URI '%s': cannot use proxy and readonly mode at the same time", s.Name, uri.SanitizeURI(s.URI))
|
||||
}
|
||||
|
||||
var httpTransport http.RoundTripper
|
||||
@@ -190,7 +191,7 @@ func setupUpstreams() error {
|
||||
if s.TLS.CA != "" || s.TLS.Cert != "" || s.TLS.InsecureSkipVerify {
|
||||
httpTransport, err = alertmanager.NewHTTPTransport(s.TLS.CA, s.TLS.Cert, s.TLS.Key, s.TLS.InsecureSkipVerify)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to create HTTP transport for Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
return fmt.Errorf("failed to create HTTP transport for Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,46 +208,73 @@ func setupUpstreams() error {
|
||||
alertmanager.WithCORSCredentials(s.CORS.Credentials),
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to create Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
return fmt.Errorf("failed to create Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
}
|
||||
err = alertmanager.RegisterAlertmanager(am)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to register Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
return fmt.Errorf("failed to register Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func msgFormatter(msg interface{}) string {
|
||||
return fmt.Sprintf("msg=%q", msg)
|
||||
}
|
||||
func lvlFormatter(level interface{}) string {
|
||||
return fmt.Sprintf("level=%s", level)
|
||||
}
|
||||
|
||||
func initLogger() {
|
||||
log.Logger = log.Logger.Output(zerolog.ConsoleWriter{
|
||||
Out: os.Stderr,
|
||||
NoColor: true,
|
||||
FormatLevel: lvlFormatter,
|
||||
FormatMessage: msgFormatter,
|
||||
FormatTimestamp: func(interface{}) string {
|
||||
return ""
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func setupLogger() error {
|
||||
switch config.Config.Log.Level {
|
||||
case "debug":
|
||||
log.SetLevel(log.DebugLevel)
|
||||
case "info":
|
||||
log.SetLevel(log.InfoLevel)
|
||||
case "warning":
|
||||
log.SetLevel(log.WarnLevel)
|
||||
case "error":
|
||||
log.SetLevel(log.ErrorLevel)
|
||||
case "fatal":
|
||||
log.SetLevel(log.FatalLevel)
|
||||
case "panic":
|
||||
log.SetLevel(log.PanicLevel)
|
||||
default:
|
||||
return fmt.Errorf("Unknown log level '%s'", config.Config.Log.Level)
|
||||
}
|
||||
zerolog.DurationFieldUnit = time.Second
|
||||
|
||||
switch config.Config.Log.Format {
|
||||
case "text":
|
||||
log.SetFormatter(&log.TextFormatter{
|
||||
DisableTimestamp: !config.Config.Log.Timestamp,
|
||||
})
|
||||
if config.Config.Log.Timestamp {
|
||||
log.Logger = log.Logger.Output(zerolog.ConsoleWriter{
|
||||
Out: os.Stderr,
|
||||
NoColor: true,
|
||||
FormatLevel: lvlFormatter,
|
||||
FormatMessage: msgFormatter,
|
||||
TimeFormat: "15:04:05",
|
||||
})
|
||||
}
|
||||
case "json":
|
||||
log.SetFormatter(&log.JSONFormatter{
|
||||
DisableTimestamp: !config.Config.Log.Timestamp,
|
||||
})
|
||||
if !config.Config.Log.Timestamp {
|
||||
log.Logger = zerolog.New(os.Stderr).With().Logger()
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("Unknown log format '%s'", config.Config.Log.Format)
|
||||
return fmt.Errorf("unknown log format '%s'", config.Config.Log.Format)
|
||||
}
|
||||
|
||||
switch config.Config.Log.Level {
|
||||
case "debug":
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
case "info":
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
case "warning":
|
||||
zerolog.SetGlobalLevel(zerolog.WarnLevel)
|
||||
case "error":
|
||||
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||
case "fatal":
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
case "panic":
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
default:
|
||||
return fmt.Errorf("unknown log level '%s'", config.Config.Log.Level)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -271,6 +299,7 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
|
||||
configFile, err := config.Config.Read(f)
|
||||
if err != nil {
|
||||
_ = setupLogger()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -280,15 +309,15 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
}
|
||||
|
||||
if configFile != "" {
|
||||
log.Infof("Reading configuration file %s", configFile)
|
||||
log.Info().Str("path", configFile).Msg("Reading configuration file")
|
||||
}
|
||||
|
||||
// timer duration cannot be zero second or a negative one
|
||||
if config.Config.Alertmanager.Interval <= time.Second*0 {
|
||||
return nil, fmt.Errorf("Invalid alertmanager.interval value '%v'", config.Config.Alertmanager.Interval)
|
||||
return nil, fmt.Errorf("invalid alertmanager.interval value '%v'", config.Config.Alertmanager.Interval)
|
||||
}
|
||||
|
||||
log.Infof("Version: %s", version)
|
||||
log.Info().Msgf("Version: %s", version)
|
||||
if config.Config.Log.Config {
|
||||
config.Config.LogValues()
|
||||
}
|
||||
@@ -296,11 +325,11 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
linkDetectRules := []models.LinkDetectRule{}
|
||||
for _, rule := range config.Config.Silences.Comments.LinkDetect.Rules {
|
||||
if rule.Regex == "" || rule.URITemplate == "" {
|
||||
return nil, fmt.Errorf("Invalid link detect rule, regex '%s' uriTemplate '%s'", rule.Regex, rule.URITemplate)
|
||||
return nil, fmt.Errorf("invalid link detect rule, regex '%s' uriTemplate '%s'", rule.Regex, rule.URITemplate)
|
||||
}
|
||||
re, err := regexp.Compile(rule.Regex)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid link detect rule '%s': %s", rule.Regex, err)
|
||||
return nil, fmt.Errorf("invalid link detect rule '%s': %s", rule.Regex, err)
|
||||
}
|
||||
linkDetectRules = append(linkDetectRules, models.LinkDetectRule{Regex: re, URITemplate: rule.URITemplate})
|
||||
}
|
||||
@@ -314,11 +343,11 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
}
|
||||
|
||||
if len(alertmanager.GetAlertmanagers()) == 0 {
|
||||
return nil, fmt.Errorf("No valid Alertmanager URIs defined")
|
||||
return nil, fmt.Errorf("no valid Alertmanager URIs defined")
|
||||
}
|
||||
|
||||
if config.Config.Authorization.ACL.Silences != "" {
|
||||
log.Infof("Reading silence ACL config file %s", config.Config.Authorization.ACL.Silences)
|
||||
log.Info().Str("path", config.Config.Authorization.ACL.Silences).Msg("Reading silence ACL config file")
|
||||
aclConfig, err := config.ReadSilenceACLConfig(config.Config.Authorization.ACL.Silences)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -327,11 +356,11 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
for i, cfg := range aclConfig.Rules {
|
||||
acl, err := newSilenceACLFromConfig(cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid silence ACL rule at position %d: %s", i, err)
|
||||
return nil, fmt.Errorf("invalid silence ACL rule at position %d: %s", i, err)
|
||||
}
|
||||
silenceACLs = append(silenceACLs, acl)
|
||||
}
|
||||
log.Infof("Parsed %d ACL rule(s)", len(silenceACLs))
|
||||
log.Info().Int("rules", len(silenceACLs)).Msg("Parsed ACL rules")
|
||||
}
|
||||
|
||||
switch config.Config.Debug {
|
||||
@@ -344,7 +373,10 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
router := gin.New()
|
||||
|
||||
var t *template.Template
|
||||
t = loadTemplate(t, "ui/build/index.html")
|
||||
t, err = loadTemplate(t, "ui/build/index.html")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load template: %s", err)
|
||||
}
|
||||
router.SetHTMLTemplate(t)
|
||||
|
||||
setupMetrics(router)
|
||||
@@ -361,16 +393,16 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
setupRouter(router)
|
||||
for _, am := range alertmanager.GetAlertmanagers() {
|
||||
if am.ProxyRequests {
|
||||
log.Infof("[%s] Setting up proxy endpoints", am.Name)
|
||||
log.Info().Str("alertmanager", am.Name).Msg("Setting up proxy endpoints")
|
||||
err := setupRouterProxyHandlers(router, am)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to setup proxy handlers for Alertmanager '%s': %s", am.Name, err)
|
||||
return nil, fmt.Errorf("failed to setup proxy handlers for Alertmanager '%s': %s", am.Name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if *validateConfig {
|
||||
log.Info("Configuration is valid")
|
||||
log.Info().Msg("Configuration is valid")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -379,11 +411,11 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*gin.Engine, error) {
|
||||
|
||||
func writePidFile() error {
|
||||
if pidFile != "" {
|
||||
log.Infof("Writing PID file to %q", pidFile)
|
||||
log.Info().Str("path", pidFile).Msg("Writing PID file")
|
||||
pid := os.Getpid()
|
||||
err := ioutil.WriteFile(pidFile, []byte(strconv.Itoa(pid)), 0644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to write a PID file: %s", err)
|
||||
return fmt.Errorf("failed to write a PID file: %s", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -391,10 +423,10 @@ func writePidFile() error {
|
||||
|
||||
func removePidFile() error {
|
||||
if pidFile != "" {
|
||||
log.Infof("Removing PID file %q", pidFile)
|
||||
log.Info().Str("path", pidFile).Msg("Removing PID file")
|
||||
err := os.Remove(pidFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to remove PID file: %s", err)
|
||||
return fmt.Errorf("failed to remove PID file: %s", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -415,9 +447,9 @@ func serve(errorHandling pflag.ErrorHandling) error {
|
||||
}
|
||||
|
||||
// before we start try to fetch data from Alertmanager
|
||||
log.Info("Initial Alertmanager query")
|
||||
log.Info().Msg("Initial Alertmanager collection")
|
||||
pullFromAlertmanager()
|
||||
log.Info("Done, starting HTTP server")
|
||||
log.Info().Msg("Done, starting HTTP server")
|
||||
|
||||
// background loop that will fetch updates from Alertmanager
|
||||
ticker = time.NewTicker(config.Config.Alertmanager.Interval)
|
||||
@@ -428,7 +460,7 @@ func serve(errorHandling pflag.ErrorHandling) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("Listening on %s", listener.Addr())
|
||||
log.Info().Str("address", listener.Addr().String()).Msg("Starting HTTP server")
|
||||
|
||||
httpServer := &http.Server{
|
||||
Addr: listen,
|
||||
@@ -441,21 +473,22 @@ func serve(errorHandling pflag.ErrorHandling) error {
|
||||
quit := make(chan os.Signal, 1)
|
||||
signal.Notify(quit, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-quit
|
||||
log.Infof("Shutting down HTTP server")
|
||||
log.Info().Msg("Shutting down HTTP server")
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
if err := httpServer.Shutdown(ctx); err != nil {
|
||||
return fmt.Errorf("Shutdown failed: %s", err)
|
||||
return fmt.Errorf("shutdown error: %s", err)
|
||||
}
|
||||
log.Info("HTTP server shut down")
|
||||
log.Info().Msg("HTTP server shut down")
|
||||
|
||||
return removePidFile()
|
||||
}
|
||||
|
||||
func main() {
|
||||
initLogger()
|
||||
err := serve(pflag.ExitOnError)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal().Err(err).Msg("Execution failed")
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -9,17 +9,17 @@ import (
|
||||
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
func TestLogConfig(t *testing.T) {
|
||||
logLevels := map[string]log.Level{
|
||||
"debug": log.DebugLevel,
|
||||
"info": log.InfoLevel,
|
||||
"warning": log.WarnLevel,
|
||||
"error": log.ErrorLevel,
|
||||
"fatal": log.FatalLevel,
|
||||
"panic": log.PanicLevel,
|
||||
logLevels := map[string]zerolog.Level{
|
||||
"debug": zerolog.DebugLevel,
|
||||
"info": zerolog.InfoLevel,
|
||||
"warning": zerolog.WarnLevel,
|
||||
"error": zerolog.ErrorLevel,
|
||||
"fatal": zerolog.FatalLevel,
|
||||
"panic": zerolog.PanicLevel,
|
||||
}
|
||||
|
||||
for val, level := range logLevels {
|
||||
@@ -28,8 +28,8 @@ func TestLogConfig(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if log.GetLevel() != level {
|
||||
t.Errorf("Config.Log.Level=%s resulted in invalid log level %s", val, log.GetLevel())
|
||||
if zerolog.GlobalLevel() != level {
|
||||
t.Errorf("Config.Log.Level=%s resulted in invalid log level %s", val, zerolog.GlobalLevel())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
"github.com/prymitive/karma/internal/mapper"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func proxyPathPrefix(name string) string {
|
||||
@@ -63,7 +63,7 @@ func NewAlertmanagerProxy(alertmanager *alertmanager.Alertmanager) (*httputil.Re
|
||||
req.URL.Path = strings.TrimSuffix(upstreamURL.Path, "/") + req.URL.Path
|
||||
}
|
||||
|
||||
log.Debugf("[%s] Forwarding request for %s to %s", alertmanager.Name, req.RequestURI, req.URL.String())
|
||||
log.Debug().Str("alertmanager", alertmanager.Name).Str("uri", req.RequestURI).Str("forwardedURI", req.URL.String()).Msg("Forwarding request")
|
||||
},
|
||||
Transport: alertmanager.HTTPTransport,
|
||||
ModifyResponse: func(resp *http.Response) error {
|
||||
@@ -78,12 +78,12 @@ func NewAlertmanagerProxy(alertmanager *alertmanager.Alertmanager) (*httputil.Re
|
||||
|
||||
func handlePostRequest(alertmanager *alertmanager.Alertmanager, h http.Handler) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
log.Debugf("[%s] Proxy request %s", alertmanager.Name, c.Request.RequestURI)
|
||||
log.Debug().Str("alertmanager", alertmanager.Name).Str("uri", c.Request.RequestURI).Msg("Proxy request")
|
||||
|
||||
body, err := ioutil.ReadAll(c.Request.Body)
|
||||
c.Request.Body.Close()
|
||||
if err != nil {
|
||||
log.Errorf("[%s] proxy request '%s %s' body close failed: %s", alertmanager.Name, c.Request.Method, c.Request.RequestURI, err)
|
||||
log.Error().Err(err).Str("alertmanager", alertmanager.Name).Str("method", c.Request.Method).Str("uri", c.Request.RequestURI).Msg("Failed to close proxied request")
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@@ -95,14 +95,14 @@ func handlePostRequest(alertmanager *alertmanager.Alertmanager, h http.Handler)
|
||||
|
||||
m, err := mapper.GetSilenceMapper(ver)
|
||||
if err != nil {
|
||||
log.Errorf("[%s] proxy request '%s %s' error: %s", alertmanager.Name, c.Request.Method, c.Request.RequestURI, err)
|
||||
log.Error().Err(err).Str("alertmanager", alertmanager.Name).Str("method", c.Request.Method).Str("uri", c.Request.RequestURI).Msg("Failed to proxy a request")
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
silence, err := m.Unmarshal(body)
|
||||
if err != nil {
|
||||
log.Errorf("[%s] proxy request '%s %s' failed to unmarshal silence body: %s", alertmanager.Name, c.Request.Method, c.Request.RequestURI, err)
|
||||
log.Error().Err(err).Str("alertmanager", alertmanager.Name).Str("method", c.Request.Method).Str("uri", c.Request.RequestURI).Msg("Failed to unmarshal silence body")
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@@ -110,9 +110,9 @@ func handlePostRequest(alertmanager *alertmanager.Alertmanager, h http.Handler)
|
||||
for i, acl := range silenceACLs {
|
||||
username := c.GetString(gin.AuthUserKey)
|
||||
isAllowed, err := acl.isAllowed(alertmanager.Name, silence, username)
|
||||
log.Debugf("ACL %d: isAllowed=%v err=%v", i, isAllowed, err)
|
||||
log.Debug().Int("index", i).Bool("allowed", isAllowed).Err(err).Msg("ACL rule check")
|
||||
if err != nil {
|
||||
log.Warningf("[%s] proxy request '%s %s' was blocked by ACL rule: %s", alertmanager.Name, c.Request.Method, c.Request.RequestURI, err)
|
||||
log.Warn().Err(err).Str("alertmanager", alertmanager.Name).Str("method", c.Request.Method).Str("uri", c.Request.RequestURI).Msg("Proxy request was blocked by ACL rule")
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
@@ -125,7 +125,7 @@ func handlePostRequest(alertmanager *alertmanager.Alertmanager, h http.Handler)
|
||||
username := c.MustGet(gin.AuthUserKey).(string)
|
||||
newBody, err := m.RewriteUsername(body, username)
|
||||
if err != nil {
|
||||
log.Errorf("[%s] proxy request '%s %s' silence body rewrite error: %s", alertmanager.Name, c.Request.Method, c.Request.RequestURI, err)
|
||||
log.Error().Err(err).Str("alertmanager", alertmanager.Name).Str("method", c.Request.Method).Str("uri", c.Request.RequestURI).Msg("Failed to rewrite silence body")
|
||||
c.String(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/prymitive/karma/internal/alertmanager"
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
"github.com/prymitive/karma/internal/mock"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
"github.com/jarcoal/httpmock"
|
||||
"github.com/pmezard/go-difflib/difflib"
|
||||
@@ -515,7 +515,7 @@ func TestProxyUserRewrite(t *testing.T) {
|
||||
httpmock.Activate()
|
||||
defer httpmock.DeactivateAndReset()
|
||||
|
||||
log.SetLevel(log.FatalLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
for _, version := range mock.ListAllMocks() {
|
||||
t.Logf("Testing alerts using mock files from Alertmanager %s", version)
|
||||
@@ -1147,7 +1147,7 @@ func TestProxySilenceACL(t *testing.T) {
|
||||
httpmock.Activate()
|
||||
defer httpmock.DeactivateAndReset()
|
||||
|
||||
log.SetLevel(log.FatalLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
for _, version := range mock.ListAllMocks() {
|
||||
t.Logf("Testing alerts using mock files from Alertmanager %s", version)
|
||||
|
||||
+10
-16
@@ -5,32 +5,26 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/rogpeppe/go-internal/testscript"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func mainShoulFail() int {
|
||||
initLogger()
|
||||
err := serve(pflag.ContinueOnError)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Error().Err(err).Msg("Execution failed")
|
||||
return 0
|
||||
}
|
||||
log.Error("No error logged")
|
||||
log.Error().Msg("No error logged")
|
||||
return 100
|
||||
}
|
||||
|
||||
func mainShoulFailNoTimestamp() int {
|
||||
log.SetFormatter(&log.TextFormatter{
|
||||
DisableTimestamp: true,
|
||||
})
|
||||
return mainShoulFail()
|
||||
}
|
||||
|
||||
func mainShouldWork() int {
|
||||
initLogger()
|
||||
err := serve(pflag.ContinueOnError)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Error().Err(err).Msg("Execution failed")
|
||||
return 100
|
||||
}
|
||||
return 0
|
||||
@@ -38,14 +32,14 @@ func mainShouldWork() int {
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
os.Exit(testscript.RunMain(m, map[string]func() int{
|
||||
"karma.bin-should-fail": mainShoulFail,
|
||||
"karma.bin-should-fail-no-timestamp": mainShoulFailNoTimestamp,
|
||||
"karma.bin-should-work": mainShouldWork,
|
||||
"karma.bin-should-fail": mainShoulFail,
|
||||
"karma.bin-should-work": mainShouldWork,
|
||||
}))
|
||||
}
|
||||
|
||||
func TestScripts(t *testing.T) {
|
||||
testscript.Run(t, testscript.Params{
|
||||
Dir: "tests/testscript",
|
||||
Dir: "tests/testscript",
|
||||
UpdateScripts: os.Getenv("UPDATE_SNAPSHOTS") == "1",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
# Config is valid with example silence ACL rules
|
||||
karma.bin-should-work --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-work --check-config
|
||||
! stdout .
|
||||
stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=info msg="Parsed ACL rules" rules=4
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +29,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
|
||||
-- acl.yaml --
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if --authorization.acl points to a file that cannot be parsed
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Failed to parse silence ACL configuration file \\"acl.yaml\\": yaml: unmarshal errors:.*"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="failed to parse silence ACL configuration file \"acl.yaml\": yaml: unmarshal errors:\n line 1: cannot unmarshal !!str `This Is...` into config.silencesACLSchema"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
This Is Not yaml
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if --authorization.acl points to a missing file
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Failed to load silence ACL configuration file \\"acl.yaml\\": open acl.yaml: no such file or directory"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="failed to load silence ACL configuration file \"acl.yaml\": open acl.yaml: no such file or directory"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,4 +28,4 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses invalid 'action' value
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule requires ''action'' to be one of \[allow block requireMatcher\], got \\"foo\\""'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule requires 'action' to be one of [allow block requireMatcher], got \"foo\""
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses invalid 'alertmanagers' value
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: invalid ACL rule, no alertmanager with name \\"unknown\\" found"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: invalid ACL rule, no alertmanager with name \"unknown\" found"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses filter with invalid name_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: invalid ACL rule, failed to parse name_re \\"cluster\*\*\*\\": error parsing regexp: invalid nested repetition operator: `\*\*`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: invalid ACL rule, failed to parse name_re \"cluster***\": error parsing regexp: invalid nested repetition operator: `**`"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses filter with invalid value_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: invalid ACL rule, failed to parse value_re \\"prod\*\*\*\\": error parsing regexp: invalid nested repetition operator: `\*\*`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: invalid ACL rule, failed to parse value_re \"prod***\": error parsing regexp: invalid nested repetition operator: `**`"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses invalid 'groups' value
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: invalid silence ACL rule, no group with name \\"unknown\\" found in authorization.groups configuration"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: invalid silence ACL rule, no group with name \"unknown\" found in authorization.groups configuration"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher with invalid name_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: invalid ACL rule, failed to parse name_re \\"cluster.\+\+\+\+\\": error parsing regexp: invalid nested repetition operator: `\+\+`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: invalid ACL rule, failed to parse name_re \"cluster.++++\": error parsing regexp: invalid nested repetition operator: `++`"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher with invalid value_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: invalid ACL rule, failed to parse value_re \\".\+\+\+\\": error parsing regexp: invalid nested repetition operator: `\+\+`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: invalid ACL rule, failed to parse value_re \".+++\": error parsing regexp: invalid nested repetition operator: `++`"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher with both name and name_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule matcher can only have ''name'' or ''name_re'' set, not both"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule matcher can only have 'name' or 'name_re' set, not both"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher with both value and value_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule matcher can only have ''value'' or ''value_re'' set, not both"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule matcher can only have 'value' or 'value_re' set, not both"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses filter with missing name or name_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule filter requires ''name'' or ''name_re'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule filter requires 'name' or 'name_re' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses filter with missing value or value_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule filter requires ''value'' or ''value_re'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule filter requires 'value' or 'value_re' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher without name
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule matcher requires ''name'' or ''name_re'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule matcher requires 'name' or 'name_re' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher without name
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule matcher requires ''name'' or ''name_re'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule matcher requires 'name' or 'name_re' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher without value
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule matcher requires ''value'' or ''value_re'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule matcher requires 'value' or 'value_re' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses matcher without value
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule matcher requires ''value'' or ''value_re'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule matcher requires 'value' or 'value_re' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule is missing 'reason'
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule requires ''reason'' to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule requires 'reason' to be set"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses filter with both name and name_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule filter can only have ''name'' or ''name_re'' set, not both"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule filter can only have 'name' or 'name_re' set, not both"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if silence ACL rule uses filter with both value and value_re
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Invalid silence ACL rule at position 0: silence ACL rule filter can only have ''value'' or ''value_re'' set, not both"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="invalid silence ACL rule at position 0: silence ACL rule filter can only have 'value' or 'value_re' set, not both"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if basic auth credentials are missing
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="authentication.basicAuth.users require both username and password to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="authentication.basicAuth.users require both username and password to be set"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
basicAuth:
|
||||
users:
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if basic auth password is missing
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="authentication.basicAuth.users require both username and password to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="authentication.basicAuth.users require both username and password to be set"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
basicAuth:
|
||||
users:
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if basic auth username is missing
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="authentication.basicAuth.users require both username and password to be set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="authentication.basicAuth.users require both username and password to be set"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
basicAuth:
|
||||
users:
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# Raises an error if authorization group is missing name
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
stderr 'msg="''members'' is required for every authorization group"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="'members' is required for every authorization group"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -14,4 +16,4 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# Raises an error if authorization group is missing name
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
stderr 'msg="''name'' is required for every authorization group"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="'name' is required for every authorization group"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -19,4 +21,4 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if both header & basic auth authentication is enabled
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Both authentication.basicAuth.users and authentication.header.name is set, only one can be enabled"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="both authentication.basicAuth.users and authentication.header.name is set, only one can be enabled"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
header:
|
||||
name: "foo"
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if header authentication config is missing name
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="authentication.header.name is required when authentication.header.value_re is set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="authentication.header.name is required when authentication.header.value_re is set"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
header:
|
||||
value_re: ".+"
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if header authentication config is missing regex rule
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="authentication.header.value_re is required when authentication.header.name is set"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="authentication.header.value_re is required when authentication.header.name is set"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
header:
|
||||
name: "foo"
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if header authentication config contains invalid regex rule
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Invalid regex for authentication.header.value_re: error parsing regexp: invalid nested repetition operator: `\+\+`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="invalid regex for authentication.header.value_re: error parsing regexp: invalid nested repetition operator: `++`"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
authentication:
|
||||
header:
|
||||
name: "foo"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Validates config when --check-config is passed
|
||||
karma.bin-should-work --log.format=text --log.config=false --check-config --alertmanager.uri=http://localhost
|
||||
karma.bin-should-work --check-config --alertmanager.uri=http://127.0.0.1
|
||||
! stdout .
|
||||
stderr 'msg="Configuration is valid"'
|
||||
! stderr 'level=error'
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
env CONFIG_FILE=env.yaml
|
||||
karma.bin-should-work --check-config --config.file=flag.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Reading configuration file flag.yaml"'
|
||||
stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="\[flag\] Configured Alertmanager source at http://localhost:8080 \(proxied: false\, readonly: false\)"'
|
||||
! stderr 'level=error'
|
||||
! stderr 'msg="Reading configuration file karma.yaml"'
|
||||
! stderr 'msg="Reading configuration file env.yaml"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=flag.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=flag proxy=false readonly=false uri=http://127.0.0.1:8080
|
||||
level=info msg="Configuration is valid"
|
||||
-- flag.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: flag
|
||||
uri: "http://localhost:8080"
|
||||
uri: "http://127.0.0.1:8080"
|
||||
|
||||
-- env.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: env
|
||||
uri: "http://localhost:8080"
|
||||
uri: "http://127.0.0.1:8080"
|
||||
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: karma
|
||||
uri: "http://localhost:8080"
|
||||
uri: "http://127.0.0.1:8080"
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
env CONFIG_FILE=foo.yaml
|
||||
karma.bin-should-work --check-config
|
||||
! stdout .
|
||||
stderr 'msg="Reading configuration file foo.yaml"'
|
||||
stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="\[cwd\] Configured Alertmanager source at http://localhost:8080 \(proxied: true\, readonly: false\)"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=foo.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=cwd proxy=true readonly=false uri=http://127.0.0.1:8080
|
||||
level=info msg="Setting up proxy endpoints" alertmanager=cwd
|
||||
level=info msg="Configuration is valid"
|
||||
-- foo.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: cwd
|
||||
uri: "http://localhost:8080"
|
||||
uri: "http://127.0.0.1:8080"
|
||||
proxy: true
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
env CONFIG_FILE=foo.yaml
|
||||
karma.bin-should-work --check-config --config.file foo.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Reading configuration file foo.yaml"'
|
||||
stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="\[cwd\] Configured Alertmanager source at http://localhost:8080 \(proxied: true\, readonly: false\)"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=foo.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=cwd proxy=true readonly=false uri=http://127.0.0.1:8080
|
||||
level=info msg="Setting up proxy endpoints" alertmanager=cwd
|
||||
level=info msg="Configuration is valid"
|
||||
-- foo.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: cwd
|
||||
uri: "http://localhost:8080"
|
||||
uri: "http://127.0.0.1:8080"
|
||||
proxy: true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Passing --debug enables Gin debug mode
|
||||
|
||||
exec sh -ex ./test.sh &
|
||||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=false --debug --alertmanager.uri=http://localhost --listen.address=127.0.0.1 --listen.port=8035
|
||||
karma.bin-should-work --pid-file=karma.pid --debug --alertmanager.uri=http://127.0.0.1 --listen.address=127.0.0.1 --listen.port=8035
|
||||
stdout '\[GIN-debug\] \[WARNING\] Running in "debug" mode. Switch to "release" mode in production.'
|
||||
|
||||
-- test.sh --
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
# Load 'karma.yaml' from cwd by default
|
||||
karma.bin-should-work --check-config
|
||||
! stdout .
|
||||
stderr 'msg="Reading configuration file karma.yaml"'
|
||||
stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="\[cwd\] Configured Alertmanager source at http://localhost:8080 \(proxied: true\, readonly: false\)"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=cwd proxy=true readonly=false uri=http://127.0.0.1:8080
|
||||
level=info msg="Setting up proxy endpoints" alertmanager=cwd
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: cwd
|
||||
uri: "http://localhost:8080"
|
||||
uri: "http://127.0.0.1:8080"
|
||||
proxy: true
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
# Raises an error if we have 2 instances with the same name (one using default name)
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Failed to register Alertmanager ''default'' with URI ''https://localhost:9094'': alertmanager upstream ''default'' already exist"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=error msg="Execution failed" error="failed to register Alertmanager 'default' with URI 'https://127.0.0.1:9094': alertmanager upstream 'default' already exist"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
- uri: https://localhost:9094
|
||||
uri: https://127.0.0.1:9093
|
||||
- uri: https://127.0.0.1:9094
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
# Raises an error if we have 2 instances with the same name
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Failed to register Alertmanager ''am1'' with URI ''https://localhost:9094'': alertmanager upstream ''am1'' already exist"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=am1 proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=error msg="Execution failed" error="failed to register Alertmanager 'am1' with URI 'https://127.0.0.1:9094': alertmanager upstream 'am1' already exist"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: am1
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
- name: am1
|
||||
uri: https://localhost:9094
|
||||
uri: https://127.0.0.1:9094
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
# Raises an error if we have 2 instances with the same URI
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file karma.yaml
|
||||
karma.bin-should-fail --config.file karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Failed to register Alertmanager ''am2'' with URI ''https://localhost:9093'': alertmanager upstream ''am1'' already collects from ''https://localhost:9093''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=am1 proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=error msg="Execution failed" error="failed to register Alertmanager 'am2' with URI 'https://127.0.0.1:9093': alertmanager upstream 'am1' already collects from 'https://127.0.0.1:9093'"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: am1
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
- name: am2
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Uses 'default' as the default alertmanager name
|
||||
karma.bin-should-work --log.format=text --log.config=false --config.file=karma.yaml --check-config
|
||||
karma.bin-should-work --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'msg="\[default\] Configured Alertmanager source at http://localhost:9093 \(proxied: false\, readonly: false\)"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://127.0.0.1:9093
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- uri: http://localhost:9093
|
||||
- uri: http://127.0.0.1:9093
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# Raises an error if we cors.credentials value is incorrect
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file karma.yaml
|
||||
karma.bin-should-fail --config.file karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Invalid cors.credentials value ''foo'' for alertmanager ''am1'', allowed options: omit, inclue, same-origin'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="invalid cors.credentials value 'foo' for alertmanager 'am1', allowed options: omit, inclue, same-origin"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: am1
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
cors:
|
||||
credentials: foo
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# Raises an error if we pass alertmanager.interval value that doesn't parse
|
||||
karma.bin-should-fail-no-timestamp --log.format=text --log.config=false --log.level=error --config.file karma.yaml
|
||||
karma.bin-should-fail --config.file karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg=".* invalid duration \\"abc123\\""'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="failed to unmarshal configuration: 1 error(s) decoding:\n\n* error decoding 'Alertmanager.Interval': time: invalid duration \"abc123\""
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
interval: abc123
|
||||
servers:
|
||||
- name: am
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
env CONFIG_FILE=foo.yaml
|
||||
karma.bin-should-fail --check-config --invalid.flag
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'level=error msg="unknown flag: --invalid.flag"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="unknown flag: --invalid.flag"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# Raises an error if we pass alertmanager.timeout value that doesn't parse
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --alertmanager.timeout=abc123 --alertmanager.uri=http://localhost
|
||||
karma.bin-should-fail --alertmanager.timeout=abc123 --alertmanager.uri=http://127.0.0.1
|
||||
! stdout .
|
||||
stderr 'level=error msg="invalid argument \\"abc123\\" for \\"--alertmanager.timeout\\" flag: time: invalid duration \\"abc123\\""'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="invalid argument \"abc123\" for \"--alertmanager.timeout\" flag: time: invalid duration \"abc123\""
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# Raises an error if listen.prefix is invalid
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --alertmanager.uri http://localhost --listen.prefix karma
|
||||
karma.bin-should-fail --alertmanager.uri http://127.0.0.1 --listen.prefix karma
|
||||
! stdout .
|
||||
stderr 'msg="listen.prefix must start with ''\/'', got \\"karma\\"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="listen.prefix must start with '/', got \"karma\""
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# Raises an error if invalid log format is passed
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.format=xml
|
||||
karma.bin-should-fail --log.format=xml
|
||||
! stdout .
|
||||
stderr 'msg="Unknown log format ''xml''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="unknown log format 'xml'"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# Raises an error if invalid log level is passed
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=foobar
|
||||
karma.bin-should-fail --log.timestamp=false --log.level=foobar
|
||||
! stdout .
|
||||
stderr 'msg="Unknown log level ''foobar''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="unknown log level 'foobar'"
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
# Raises an error if proxy config is invalid
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create Alertmanager ''proxied'' with URI ''httpz://localhost'': unsupported URI scheme ''httpz'' in ''httpz://localhost''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create Alertmanager 'proxied' with URI 'httpz://127.0.0.1': unsupported URI scheme 'httpz' in 'httpz://127.0.0.1'"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: proxied
|
||||
uri: httpz://localhost
|
||||
uri: httpz://127.0.0.1
|
||||
proxy: true
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# Raises an error if negative refresh interval is passed
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --alertmanager.interval=-4s
|
||||
karma.bin-should-fail --alertmanager.interval=-4s
|
||||
! stdout .
|
||||
stderr 'msg="Invalid alertmanager.interval value ''-4s''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="invalid alertmanager.interval value '-4s'"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Raises an error if alertmanager URI is invalid
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --alertmanager.uri httpz://username:secret@localhost
|
||||
karma.bin-should-fail --alertmanager.uri httpz://username:secret@127.0.0.1
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create Alertmanager ''default'' with URI ''httpz://username:xxx@localhost'': unsupported URI scheme ''httpz'' in ''httpz://username:xxx@localhost''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create Alertmanager 'default' with URI 'httpz://username:xxx@127.0.0.1': unsupported URI scheme 'httpz' in 'httpz://username:xxx@127.0.0.1'"
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if label custom color config is using invalid regex rule
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Failed to parse custom color regex rule ''\.\+\+\+\+'' for ''region'' label: error parsing regexp: invalid nested repetition operator: `\+\+`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="failed to parse custom color regex rule '.++++' for 'region' label: error parsing regexp: invalid nested repetition operator: `++`"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
labels:
|
||||
color:
|
||||
custom:
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Raises an error if label custom color config is missing a value
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Custom label color for ''region'' is missing ''value'' or ''value_re''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="custom label color for 'region' is missing 'value' or 'value_re'"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
labels:
|
||||
color:
|
||||
custom:
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
# Raises an error if linkDetect config is missing regex rule
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Invalid link detect rule ''foo\+\+\+\+\+\+'': error parsing regexp: invalid nested repetition operator: `\+\+`"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="invalid link detect rule 'foo++++++': error parsing regexp: invalid nested repetition operator: `++`"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
silences:
|
||||
comments:
|
||||
linkDetect:
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
# Raises an error if linkDetect config is missing regex rule
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Invalid link detect rule, regex '''' uriTemplate ''https://jira.example.com/''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="invalid link detect rule, regex '' uriTemplate 'https://jira.example.com/'"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
silences:
|
||||
comments:
|
||||
linkDetect:
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
# Raises an error if linkDetect config is missing uriTemplate
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
|
||||
karma.bin-should-fail --config.file=karma.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Invalid link detect rule, regex ''DEVOPS-\[0-9\]\+'' uriTemplate ''''"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="invalid link detect rule, regex 'DEVOPS-[0-9]+' uriTemplate ''"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
silences:
|
||||
comments:
|
||||
linkDetect:
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Config is valid with correct linkDetect rules
|
||||
karma.bin-should-work --log.format=text --log.config=false --config.file=karma.yaml --check-config
|
||||
karma.bin-should-work --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'msg="Configuration is valid"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
silences:
|
||||
comments:
|
||||
linkDetect:
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Logs messages as JSON when log.format=json is passed
|
||||
karma.bin-should-fail --log.format=json --log.level=error
|
||||
karma.bin-should-fail --log.format=json --log.timestamp=false
|
||||
! stdout .
|
||||
stderr '^{"level":"error","msg":"No valid Alertmanager URIs defined"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
{"level":"info","message":"Version: dev"}
|
||||
{"level":"error","error":"no valid Alertmanager URIs defined","message":"Execution failed"}
|
||||
|
||||
@@ -4,8 +4,8 @@ env AUTHENTICATION_HEADER_VALUE_RE='^(.+)$'
|
||||
|
||||
env ALERTMANAGER_INTERVAL=10s
|
||||
env ALERTMANAGER_NAME=ro
|
||||
env ALERTMANAGER_URI=http://localhost:9093
|
||||
env ALERTMANAGER_EXTERNAL_URI=http://localhost:9093
|
||||
env ALERTMANAGER_URI=http://127.0.0.1:9093
|
||||
env ALERTMANAGER_EXTERNAL_URI=http://127.0.0.1:9093
|
||||
env ALERTMANAGER_READONLY=true
|
||||
env ALERTMANAGER_TIMEOUT=10s
|
||||
|
||||
@@ -39,7 +39,7 @@ env LABELS_COLOR_UNIQUE='@receiver instance cluster'
|
||||
env LABELS_KEEP='keep1 keep2'
|
||||
env LABELS_STRIP='strip1 strip2'
|
||||
|
||||
env LISTEN_ADDRESS=localhost
|
||||
env LISTEN_ADDRESS=127.0.0.1
|
||||
env LISTEN_PORT=1234
|
||||
env LISTEN_PREFIX='/prefix/'
|
||||
|
||||
@@ -69,9 +69,9 @@ env UI_MULTIGRIDSORTREVERSE=true
|
||||
|
||||
karma.bin-should-work --check-config
|
||||
! stdout .
|
||||
cmp stderr expected.stderr
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- expected.stderr --
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
@@ -89,8 +89,8 @@ level=info msg=" interval: 10s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: ro"
|
||||
level=info msg=" uri: http://localhost:9093"
|
||||
level=info msg=" external_uri: http://localhost:9093"
|
||||
level=info msg=" uri: http://127.0.0.1:9093"
|
||||
level=info msg=" external_uri: http://127.0.0.1:9093"
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: true"
|
||||
@@ -157,7 +157,7 @@ level=info msg=" - '@receiver'"
|
||||
level=info msg=" - instance"
|
||||
level=info msg=" - cluster"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: localhost"
|
||||
level=info msg=" address: 127.0.0.1"
|
||||
level=info msg=" port: 1234"
|
||||
level=info msg=" prefix: /prefix/"
|
||||
level=info msg="log:"
|
||||
@@ -196,5 +196,5 @@ level=info msg=" alertsPerGroup: 2"
|
||||
level=info msg=" collapseGroups: expanded"
|
||||
level=info msg=" multiGridLabel: cluster"
|
||||
level=info msg=" multiGridSortReverse: true"
|
||||
level=info msg="[ro] Configured Alertmanager source at http://localhost:9093 (proxied: false, readonly: true)"
|
||||
level=info msg="Configured Alertmanager source" name=ro proxy=false readonly=true uri=http://127.0.0.1:9093
|
||||
level=info msg="Configuration is valid"
|
||||
|
||||
@@ -1,8 +1,214 @@
|
||||
# Print out and compare logged config set via config file
|
||||
karma.bin-should-work --config.file=custom.yaml --check-config
|
||||
! stdout .
|
||||
cmp stderr expected.stderr
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=custom.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users:"
|
||||
level=info msg=" - username: number"
|
||||
level=info msg=" password: '***'"
|
||||
level=info msg=" - username: string"
|
||||
level=info msg=" password: '***'"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups:"
|
||||
level=info msg=" - name: admins"
|
||||
level=info msg=" members:"
|
||||
level=info msg=" - alice"
|
||||
level=info msg=" - bob"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 10s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: HA"
|
||||
level=info msg=" name: ha1"
|
||||
level=info msg=" uri: http://127.0.0.1:9093"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: true"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg=" - cluster: HA"
|
||||
level=info msg=" name: ha2"
|
||||
level=info msg=" uri: http://127.0.0.1:9094"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: true"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: omit"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: local"
|
||||
level=info msg=" uri: http://foo:xxx@127.0.0.1:9095"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: true"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers:"
|
||||
level=info msg=" X-Auth-Test: some-token-or-other-string"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: same-origin"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: client-auth"
|
||||
level=info msg=" uri: https://127.0.0.1:9096"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: ca.pem"
|
||||
level=info msg=" cert: cert.pem"
|
||||
level=info msg=" key: key.pem"
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: true"
|
||||
level=info msg=" duration: 7m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: true"
|
||||
level=info msg=" hidden:"
|
||||
level=info msg=" - help"
|
||||
level=info msg=" - summary"
|
||||
level=info msg=" visible:"
|
||||
level=info msg=" - visible"
|
||||
level=info msg=" keep:"
|
||||
level=info msg=" - keep"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" - strip1"
|
||||
level=info msg=" - strip2"
|
||||
level=info msg=" - strip3"
|
||||
level=info msg=" order:"
|
||||
level=info msg=" - summary"
|
||||
level=info msg=" - help"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: /custom.css"
|
||||
level=info msg=" js: /custom.js"
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" - '@receiver=by-cluster-service'"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: label"
|
||||
level=info msg=" reverse: false"
|
||||
level=info msg=" label: severity"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels:"
|
||||
level=info msg=" cluster:"
|
||||
level=info msg=" DEV: \"3\""
|
||||
level=info msg=" Prod: \"1\""
|
||||
level=info msg=" staging: \"2\""
|
||||
level=info msg=" severity:"
|
||||
level=info msg=" critical: \"1\""
|
||||
level=info msg=" info: \"3\""
|
||||
level=info msg=" warning: \"2\""
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma-demo"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep:"
|
||||
level=info msg=" - keep1"
|
||||
level=info msg=" - keep2"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" - strip1"
|
||||
level=info msg=" - strip2"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom:"
|
||||
level=info msg=" region:"
|
||||
level=info msg=" - value_re: .*"
|
||||
level=info msg=" color: '#736598'"
|
||||
level=info msg=" severity:"
|
||||
level=info msg=" - value: info"
|
||||
level=info msg=" color: '#87c4e0'"
|
||||
level=info msg=" - value: warning"
|
||||
level=info msg=" color: '#ffae42'"
|
||||
level=info msg=" - value: critical"
|
||||
level=info msg=" color: '#ff220c'"
|
||||
level=info msg=" static:"
|
||||
level=info msg=" - job"
|
||||
level=info msg=" unique:"
|
||||
level=info msg=" - cluster"
|
||||
level=info msg=" - instance"
|
||||
level=info msg=" - '@receiver'"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: \"\""
|
||||
level=info msg=" port: 8080"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep:"
|
||||
level=info msg=" - keep1"
|
||||
level=info msg=" - keep2"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" - strip1"
|
||||
level=info msg=" - strip2"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: abcdef1234567890"
|
||||
level=info msg=" public: 1234567890abcdef"
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules:"
|
||||
level=info msg=" - regex: (DEVOPS-[0-9]+)"
|
||||
level=info msg=" uriTemplate: https://jira.example.com/browse/$1"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels:"
|
||||
level=info msg=" - job"
|
||||
level=info msg=" - severity"
|
||||
level=info msg=" - region"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 10s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: false"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: severity"
|
||||
level=info msg=" multiGridSortReverse: true"
|
||||
level=info msg="Configured Alertmanager source" name=ha1 proxy=true readonly=false uri=http://127.0.0.1:9093
|
||||
level=info msg="Configured Alertmanager source" name=ha2 proxy=false readonly=true uri=http://127.0.0.1:9094
|
||||
level=info msg="Configured Alertmanager source" name=local proxy=true readonly=false uri=http://foo:xxx@127.0.0.1:9095
|
||||
level=info msg="Configured Alertmanager source" name=client-auth proxy=false readonly=false uri=https://127.0.0.1:9096
|
||||
level=info msg="Setting up proxy endpoints" alertmanager=ha1
|
||||
level=info msg="Setting up proxy endpoints" alertmanager=local
|
||||
level=info msg="Configuration is valid"
|
||||
-- custom.yaml --
|
||||
authentication:
|
||||
basicAuth:
|
||||
@@ -22,18 +228,18 @@ alertmanager:
|
||||
servers:
|
||||
- cluster: HA
|
||||
name: ha1
|
||||
uri: "http://localhost:9093"
|
||||
uri: "http://127.0.0.1:9093"
|
||||
timeout: 10s
|
||||
proxy: true
|
||||
- cluster: HA
|
||||
name: ha2
|
||||
uri: "http://localhost:9094"
|
||||
uri: "http://127.0.0.1:9094"
|
||||
timeout: 10s
|
||||
readonly: true
|
||||
cors:
|
||||
credentials: omit
|
||||
- name: local
|
||||
uri: http://foo:bar@localhost:9095
|
||||
uri: http://foo:bar@127.0.0.1:9095
|
||||
proxy: true
|
||||
readonly: false
|
||||
headers:
|
||||
@@ -41,7 +247,7 @@ alertmanager:
|
||||
cors:
|
||||
credentials: same-origin
|
||||
- name: client-auth
|
||||
uri: https://localhost:9096
|
||||
uri: https://127.0.0.1:9096
|
||||
timeout: 10s
|
||||
tls:
|
||||
ca: ca.pem
|
||||
@@ -243,210 +449,3 @@ N9O29QKBgAcCMRtAXokOSbtqdddbAXWfkbqfH5fy6vwu5UM4QbECjPuF7A9cfj7j
|
||||
A/n4tG7NU941X0nZ0+AkGdtevfp52L1ZKRTrlNPELlT4GHDRjyAEKoEQ1Nvjp4xF
|
||||
FLR1flnW2lx5o5csDzTpi+jgC6nu1zE0DWo1c5ZdpVO289POIpqh
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
-- expected.stderr --
|
||||
level=info msg="Reading configuration file custom.yaml"
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users:"
|
||||
level=info msg=" - username: number"
|
||||
level=info msg=" password: '***'"
|
||||
level=info msg=" - username: string"
|
||||
level=info msg=" password: '***'"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups:"
|
||||
level=info msg=" - name: admins"
|
||||
level=info msg=" members:"
|
||||
level=info msg=" - alice"
|
||||
level=info msg=" - bob"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 10s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: HA"
|
||||
level=info msg=" name: ha1"
|
||||
level=info msg=" uri: http://localhost:9093"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: true"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg=" - cluster: HA"
|
||||
level=info msg=" name: ha2"
|
||||
level=info msg=" uri: http://localhost:9094"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: true"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: omit"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: local"
|
||||
level=info msg=" uri: http://foo:xxx@localhost:9095"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: true"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers:"
|
||||
level=info msg=" X-Auth-Test: some-token-or-other-string"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: same-origin"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: client-auth"
|
||||
level=info msg=" uri: https://localhost:9096"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 10s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: ca.pem"
|
||||
level=info msg=" cert: cert.pem"
|
||||
level=info msg=" key: key.pem"
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: true"
|
||||
level=info msg=" duration: 7m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: true"
|
||||
level=info msg=" hidden:"
|
||||
level=info msg=" - help"
|
||||
level=info msg=" - summary"
|
||||
level=info msg=" visible:"
|
||||
level=info msg=" - visible"
|
||||
level=info msg=" keep:"
|
||||
level=info msg=" - keep"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" - strip1"
|
||||
level=info msg=" - strip2"
|
||||
level=info msg=" - strip3"
|
||||
level=info msg=" order:"
|
||||
level=info msg=" - summary"
|
||||
level=info msg=" - help"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: /custom.css"
|
||||
level=info msg=" js: /custom.js"
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" - '@receiver=by-cluster-service'"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: label"
|
||||
level=info msg=" reverse: false"
|
||||
level=info msg=" label: severity"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels:"
|
||||
level=info msg=" cluster:"
|
||||
level=info msg=" DEV: \"3\""
|
||||
level=info msg=" Prod: \"1\""
|
||||
level=info msg=" staging: \"2\""
|
||||
level=info msg=" severity:"
|
||||
level=info msg=" critical: \"1\""
|
||||
level=info msg=" info: \"3\""
|
||||
level=info msg=" warning: \"2\""
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma-demo"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep:"
|
||||
level=info msg=" - keep1"
|
||||
level=info msg=" - keep2"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" - strip1"
|
||||
level=info msg=" - strip2"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom:"
|
||||
level=info msg=" region:"
|
||||
level=info msg=" - value_re: .*"
|
||||
level=info msg=" color: '#736598'"
|
||||
level=info msg=" severity:"
|
||||
level=info msg=" - value: info"
|
||||
level=info msg=" color: '#87c4e0'"
|
||||
level=info msg=" - value: warning"
|
||||
level=info msg=" color: '#ffae42'"
|
||||
level=info msg=" - value: critical"
|
||||
level=info msg=" color: '#ff220c'"
|
||||
level=info msg=" static:"
|
||||
level=info msg=" - job"
|
||||
level=info msg=" unique:"
|
||||
level=info msg=" - cluster"
|
||||
level=info msg=" - instance"
|
||||
level=info msg=" - '@receiver'"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: \"\""
|
||||
level=info msg=" port: 8080"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep:"
|
||||
level=info msg=" - keep1"
|
||||
level=info msg=" - keep2"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" - strip1"
|
||||
level=info msg=" - strip2"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: abcdef1234567890"
|
||||
level=info msg=" public: 1234567890abcdef"
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules:"
|
||||
level=info msg=" - regex: (DEVOPS-[0-9]+)"
|
||||
level=info msg=" uriTemplate: https://jira.example.com/browse/$1"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels:"
|
||||
level=info msg=" - job"
|
||||
level=info msg=" - severity"
|
||||
level=info msg=" - region"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 10s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: false"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: severity"
|
||||
level=info msg=" multiGridSortReverse: true"
|
||||
level=info msg="[ha1] Configured Alertmanager source at http://localhost:9093 (proxied: true, readonly: false)"
|
||||
level=info msg="[ha2] Configured Alertmanager source at http://localhost:9094 (proxied: false, readonly: true)"
|
||||
level=info msg="[local] Configured Alertmanager source at http://foo:xxx@localhost:9095 (proxied: true, readonly: false)"
|
||||
level=info msg="[client-auth] Configured Alertmanager source at https://localhost:9096 (proxied: false, readonly: false)"
|
||||
level=info msg="[ha1] Setting up proxy endpoints"
|
||||
level=info msg="[local] Setting up proxy endpoints"
|
||||
level=info msg="Configuration is valid"
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
# Print out and compare logged config set via config file that includes invalid values
|
||||
karma.bin-should-fail-no-timestamp --config.file=karma.yaml --check-config
|
||||
karma.bin-should-fail --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'Failed to unmarshal configuration: 13 error\(s\) decoding:'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="failed to unmarshal configuration: 13 error(s) decoding:\n\n* 'Alertmanager.Servers[2].Headers[0]' expected a map, got 'string'\n* cannot parse 'Alertmanager.Servers[0].Proxy' as bool: strconv.ParseBool: parsing \"YEs\": invalid syntax\n* cannot parse 'Annotations.Default.Hidden' as bool: strconv.ParseBool: parsing \"z\": invalid syntax\n* cannot parse 'UI.alertsPerGroup' as int: strconv.ParseInt: parsing \"5a\": invalid syntax\n* cannot parse 'UI.animations' as bool: strconv.ParseBool: parsing \"1a\": invalid syntax\n* cannot parse 'UI.colorTitlebar' as bool: strconv.ParseBool: parsing \"yum\": invalid syntax\n* cannot parse 'UI.hideFiltersWhenIdle' as bool: strconv.ParseBool: parsing \"z\": invalid syntax\n* cannot parse 'UI.minimalGroupWidth' as int: strconv.ParseInt: parsing \"abc4\": invalid syntax\n* cannot parse 'alertAcknowledgement.Enabled' as bool: strconv.ParseBool: parsing \"zzz\": invalid syntax\n* error decoding 'Alertmanager.Interval': time: invalid duration \"jjs88\"\n* error decoding 'Alertmanager.Servers[0].Timeout': time: invalid duration \"bbb\"\n* error decoding 'Alertmanager.Servers[2].Timeout': time: invalid duration \"z\"\n* error decoding 'UI.Refresh': time: unknown unit \"sm\" in duration \"10sm\""
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
interval: jjs88
|
||||
servers:
|
||||
- name: ha1
|
||||
uri: "http://localhost:9093"
|
||||
uri: "http://127.0.0.1:9093"
|
||||
timeout: bbb
|
||||
proxy: YEs
|
||||
cors:
|
||||
credentials: foo
|
||||
- name: ha2
|
||||
uri: "http://localhost:9094"
|
||||
uri: "http://127.0.0.1:9094"
|
||||
timeout: 11
|
||||
readonly: 1
|
||||
- name: local
|
||||
uri: http://localhost:9095
|
||||
uri: http://127.0.0.1:9095
|
||||
timeout: z
|
||||
proxy: true
|
||||
readonly: 0
|
||||
headers:
|
||||
- X-Auth-Test=some-token-or-other-string
|
||||
- name: client-auth
|
||||
uri: https://localhost:9096
|
||||
uri: https://127.0.0.1:9096
|
||||
timeout: 10s
|
||||
tls:
|
||||
ca: ca.pem
|
||||
@@ -48,7 +50,6 @@ karma:
|
||||
name: karma-demo
|
||||
log:
|
||||
level: 123
|
||||
format: foo
|
||||
ui:
|
||||
refresh: 10sm
|
||||
hideFiltersWhenIdle: z
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Doesn't log any timestamp when log.timestamp is set to false
|
||||
karma.bin-should-fail --log.format=text --log.level=error --log.timestamp=false
|
||||
# Logs timestamps when log.timestamp is set to true
|
||||
karma.bin-should-fail --log.timestamp=true
|
||||
! stdout .
|
||||
stderr '^level=error msg="No valid Alertmanager URIs defined"'
|
||||
stderr '[0-9][0-9]:[0-9][0-9]:[0-9][0-9] level=info msg="Version: dev"'
|
||||
stderr '[0-9][0-9]:[0-9][0-9]:[0-9][0-9] level=error msg="Execution failed" error="no valid Alertmanager URIs defined"'
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# Errors when config.file points to missing file
|
||||
karma.bin-should-fail --config.file=404.yaml
|
||||
! stdout .
|
||||
stderr 'msg="Failed to load configuration file \\"404.yaml\\": open 404.yaml: no such file or directory'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="failed to load configuration file \"404.yaml\": open 404.yaml: no such file or directory"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Raises an error if no alertmanager uri is set
|
||||
karma.bin-should-fail --log.format=text --log.config=false --log.level=error
|
||||
karma.bin-should-fail
|
||||
! stdout .
|
||||
stderr 'msg="No valid Alertmanager URIs defined"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="no valid Alertmanager URIs defined"
|
||||
|
||||
@@ -1,12 +1,113 @@
|
||||
# Check if proxy mode is set correctly
|
||||
karma.bin-should-fail --log.format=text --log.config=true --config.file=karma.yaml --check-config
|
||||
karma.bin-should-fail --log.config=true --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create Alertmanager ''failed'' with URI ''http://localhost'': cannot use proxy and readonly mode at the same time"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users: []"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups: []"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 1m0s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: failed"
|
||||
level=info msg=" uri: http://127.0.0.1"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: true"
|
||||
level=info msg=" readonly: true"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: false"
|
||||
level=info msg=" duration: 15m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: false"
|
||||
level=info msg=" hidden: []"
|
||||
level=info msg=" visible: []"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" order: []"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: \"\""
|
||||
level=info msg=" js: \"\""
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default: []"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: startsAt"
|
||||
level=info msg=" reverse: true"
|
||||
level=info msg=" label: alertname"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels: {}"
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom: {}"
|
||||
level=info msg=" static: []"
|
||||
level=info msg=" unique: []"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: \"\""
|
||||
level=info msg=" port: 8080"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: \"\""
|
||||
level=info msg=" public: \"\""
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules: []"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels: []"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 30s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: true"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: \"\""
|
||||
level=info msg=" multiGridSortReverse: false"
|
||||
level=error msg="Execution failed" error="failed to create Alertmanager 'failed' with URI 'http://127.0.0.1': cannot use proxy and readonly mode at the same time"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: failed
|
||||
uri: http://localhost
|
||||
uri: http://127.0.0.1
|
||||
proxy: true
|
||||
readonly: true
|
||||
|
||||
@@ -1,14 +1,114 @@
|
||||
# Check if proxy mode is set correctly
|
||||
karma.bin-should-work --log.format=text --log.config=true --config.file=karma.yaml --check-config
|
||||
karma.bin-should-work --log.config=true --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'msg=" proxy: true"'
|
||||
stderr 'msg="\[proxied\] Configured Alertmanager source at http://localhost \(proxied: true\, readonly: false\)"'
|
||||
stderr 'msg="\[proxied\] Setting up proxy endpoints"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users: []"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups: []"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 1m0s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: proxied"
|
||||
level=info msg=" uri: http://127.0.0.1"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: true"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: false"
|
||||
level=info msg=" duration: 15m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: false"
|
||||
level=info msg=" hidden: []"
|
||||
level=info msg=" visible: []"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" order: []"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: \"\""
|
||||
level=info msg=" js: \"\""
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default: []"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: startsAt"
|
||||
level=info msg=" reverse: true"
|
||||
level=info msg=" label: alertname"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels: {}"
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom: {}"
|
||||
level=info msg=" static: []"
|
||||
level=info msg=" unique: []"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: \"\""
|
||||
level=info msg=" port: 8080"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: \"\""
|
||||
level=info msg=" public: \"\""
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules: []"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels: []"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 30s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: true"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: \"\""
|
||||
level=info msg=" multiGridSortReverse: false"
|
||||
level=info msg="Configured Alertmanager source" name=proxied proxy=true readonly=false uri=http://127.0.0.1
|
||||
level=info msg="Setting up proxy endpoints" alertmanager=proxied
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: proxied
|
||||
uri: http://localhost
|
||||
uri: http://127.0.0.1
|
||||
proxy: true
|
||||
|
||||
@@ -1,11 +1,113 @@
|
||||
# Check if readonly mode is set correctly
|
||||
karma.bin-should-work --log.format=text --log.config=true --config.file=karma.yaml --check-config
|
||||
karma.bin-should-work --log.config=true --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'msg="\[readonly\] Configured Alertmanager source at http://localhost \(proxied: false\, readonly: true\)"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users: []"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups: []"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 1m0s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: readonly"
|
||||
level=info msg=" uri: http://127.0.0.1"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: true"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: false"
|
||||
level=info msg=" duration: 15m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: false"
|
||||
level=info msg=" hidden: []"
|
||||
level=info msg=" visible: []"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" order: []"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: \"\""
|
||||
level=info msg=" js: \"\""
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default: []"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: startsAt"
|
||||
level=info msg=" reverse: true"
|
||||
level=info msg=" label: alertname"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels: {}"
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom: {}"
|
||||
level=info msg=" static: []"
|
||||
level=info msg=" unique: []"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: \"\""
|
||||
level=info msg=" port: 8080"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: \"\""
|
||||
level=info msg=" public: \"\""
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules: []"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels: []"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 30s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: true"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: \"\""
|
||||
level=info msg=" multiGridSortReverse: false"
|
||||
level=info msg="Configured Alertmanager source" name=readonly proxy=false readonly=true uri=http://127.0.0.1
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: readonly
|
||||
uri: http://localhost
|
||||
uri: http://127.0.0.1
|
||||
readonly: true
|
||||
|
||||
@@ -1,16 +1,129 @@
|
||||
# Configures sentry when enabled
|
||||
|
||||
exec sh -ex ./test.sh &
|
||||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=true --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8068
|
||||
karma.bin-should-work --pid-file=karma.pid --log.config=true --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8068
|
||||
! stdout .
|
||||
stderr 'msg=" private: secret"'
|
||||
stderr 'msg=" public: \\"123456789\\""'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users: []"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups: []"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 1m0s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: default"
|
||||
level=info msg=" uri: http://127.0.0.1:9093"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: false"
|
||||
level=info msg=" duration: 15m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: false"
|
||||
level=info msg=" hidden: []"
|
||||
level=info msg=" visible: []"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" order: []"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: \"\""
|
||||
level=info msg=" js: \"\""
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default: []"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: startsAt"
|
||||
level=info msg=" reverse: true"
|
||||
level=info msg=" label: alertname"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels: {}"
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom: {}"
|
||||
level=info msg=" static: []"
|
||||
level=info msg=" unique: []"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: 127.0.0.1"
|
||||
level=info msg=" port: 8068"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: secret"
|
||||
level=info msg=" public: \"123456789\""
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules: []"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels: []"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 30s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: true"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: \"\""
|
||||
level=info msg=" multiGridSortReverse: false"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://127.0.0.1:9093
|
||||
level=info msg="Writing PID file" path=karma.pid
|
||||
level=info msg="Initial Alertmanager collection"
|
||||
level=info msg="Pulling latest alerts and silences from Alertmanager"
|
||||
level=info msg="Collecting alerts and silences" alertmanager=default
|
||||
level=info msg="GET request" timeout=40 uri=http://127.0.0.1:9093/metrics
|
||||
level=error msg="Request failed" error="Get \"http://127.0.0.1:9093/metrics\": dial tcp 127.0.0.1:9093: connect: connection refused" alertmanager=default uri=http://127.0.0.1:9093
|
||||
level=error msg="Collection failed" error="Get \"http://127.0.0.1:9093/api/v2/status\": dial tcp 127.0.0.1:9093: connect: connection refused" alertmanager=default
|
||||
level=info msg="Collection completed"
|
||||
level=info msg="Done, starting HTTP server"
|
||||
level=info msg="Starting HTTP server" address=127.0.0.1:8068
|
||||
level=info msg="Shutting down HTTP server"
|
||||
level=info msg="HTTP server shut down"
|
||||
level=info msg="Removing PID file" path=karma.pid
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: http://localhost:9093
|
||||
uri: http://127.0.0.1:9093
|
||||
sentry:
|
||||
private: secret
|
||||
public: 123456789
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
# Works in simple mode when single --alertmanager.uri flag is passed
|
||||
|
||||
exec sh -ex ./test.sh &
|
||||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=false --alertmanager.uri=http://localhost --listen.address=127.0.0.1 --listen.port=8069
|
||||
karma.bin-should-work --pid-file=karma.pid --alertmanager.uri=http://127.0.0.1 --listen.address=127.0.0.1 --listen.port=8069
|
||||
! stdout .
|
||||
stderr 'msg="\[default\] Configured Alertmanager source at http://localhost \(proxied: false\, readonly: false\)"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://127.0.0.1
|
||||
level=info msg="Writing PID file" path=karma.pid
|
||||
level=info msg="Initial Alertmanager collection"
|
||||
level=info msg="Pulling latest alerts and silences from Alertmanager"
|
||||
level=info msg="Collecting alerts and silences" alertmanager=default
|
||||
level=info msg="GET request" timeout=40 uri=http://127.0.0.1/metrics
|
||||
level=error msg="Request failed" error="Get \"http://127.0.0.1/metrics\": dial tcp 127.0.0.1:80: connect: connection refused" alertmanager=default uri=http://127.0.0.1
|
||||
level=error msg="Collection failed" error="Get \"http://127.0.0.1/api/v2/status\": dial tcp 127.0.0.1:80: connect: connection refused" alertmanager=default
|
||||
level=info msg="Collection completed"
|
||||
level=info msg="Done, starting HTTP server"
|
||||
level=info msg="Starting HTTP server" address=127.0.0.1:8069
|
||||
level=info msg="Shutting down HTTP server"
|
||||
level=info msg="HTTP server shut down"
|
||||
level=info msg="Removing PID file" path=karma.pid
|
||||
-- test.sh --
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
@@ -1,28 +1,125 @@
|
||||
# Validates that case sensitive keys are read correctly from config file
|
||||
karma.bin-should-work --log.format=text --log.config=true --config.file=karma.yaml --check-config
|
||||
karma.bin-should-work --log.config=true --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
stderr 'msg="labels:"'
|
||||
stderr 'msg=" keep: \[\]"'
|
||||
stderr 'msg=" strip: \[\]"'
|
||||
stderr 'msg=" color:"'
|
||||
stderr 'msg=" custom:"'
|
||||
stderr 'msg=" region:"'
|
||||
stderr 'msg=" - value_re: .*"'
|
||||
stderr 'msg=" color: ''#736598''"'
|
||||
stderr 'msg=" severity:"'
|
||||
stderr 'msg=" - value: P3"'
|
||||
stderr 'msg=" color: ''#87c4e0''"'
|
||||
stderr 'msg=" - value: P2"'
|
||||
stderr 'msg=" color: ''#ffae42''"'
|
||||
stderr 'msg=" - value: P1"'
|
||||
stderr 'msg=" color: ''#ff220c''"'
|
||||
! stderr 'level=error'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Parsed configuration:"
|
||||
level=info msg="authentication:"
|
||||
level=info msg=" header:"
|
||||
level=info msg=" name: \"\""
|
||||
level=info msg=" value_re: \"\""
|
||||
level=info msg=" basicAuth:"
|
||||
level=info msg=" users: []"
|
||||
level=info msg="authorization:"
|
||||
level=info msg=" groups: []"
|
||||
level=info msg=" acl:"
|
||||
level=info msg=" silences: \"\""
|
||||
level=info msg="alertmanager:"
|
||||
level=info msg=" interval: 1m0s"
|
||||
level=info msg=" servers:"
|
||||
level=info msg=" - cluster: \"\""
|
||||
level=info msg=" name: am"
|
||||
level=info msg=" uri: https://127.0.0.1:9093"
|
||||
level=info msg=" external_uri: \"\""
|
||||
level=info msg=" timeout: 40s"
|
||||
level=info msg=" proxy: false"
|
||||
level=info msg=" readonly: false"
|
||||
level=info msg=" tls:"
|
||||
level=info msg=" ca: \"\""
|
||||
level=info msg=" cert: \"\""
|
||||
level=info msg=" key: \"\""
|
||||
level=info msg=" insecureSkipVerify: false"
|
||||
level=info msg=" headers: {}"
|
||||
level=info msg=" cors:"
|
||||
level=info msg=" credentials: include"
|
||||
level=info msg="alertAcknowledgement:"
|
||||
level=info msg=" enabled: false"
|
||||
level=info msg=" duration: 15m0s"
|
||||
level=info msg=" author: karma"
|
||||
level=info msg=" commentPrefix: ACK!"
|
||||
level=info msg="annotations:"
|
||||
level=info msg=" default:"
|
||||
level=info msg=" hidden: false"
|
||||
level=info msg=" hidden: []"
|
||||
level=info msg=" visible: []"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" order: []"
|
||||
level=info msg="custom:"
|
||||
level=info msg=" css: \"\""
|
||||
level=info msg=" js: \"\""
|
||||
level=info msg="debug: false"
|
||||
level=info msg="filters:"
|
||||
level=info msg=" default: []"
|
||||
level=info msg="grid:"
|
||||
level=info msg=" sorting:"
|
||||
level=info msg=" order: startsAt"
|
||||
level=info msg=" reverse: true"
|
||||
level=info msg=" label: alertname"
|
||||
level=info msg=" customValues:"
|
||||
level=info msg=" labels: {}"
|
||||
level=info msg="karma:"
|
||||
level=info msg=" name: karma"
|
||||
level=info msg="labels:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg=" color:"
|
||||
level=info msg=" custom:"
|
||||
level=info msg=" region:"
|
||||
level=info msg=" - value_re: .*"
|
||||
level=info msg=" color: '#736598'"
|
||||
level=info msg=" severity:"
|
||||
level=info msg=" - value: P3"
|
||||
level=info msg=" color: '#87c4e0'"
|
||||
level=info msg=" - value: P2"
|
||||
level=info msg=" color: '#ffae42'"
|
||||
level=info msg=" - value: P1"
|
||||
level=info msg=" color: '#ff220c'"
|
||||
level=info msg=" static: []"
|
||||
level=info msg=" unique: []"
|
||||
level=info msg="listen:"
|
||||
level=info msg=" address: \"\""
|
||||
level=info msg=" port: 8080"
|
||||
level=info msg=" prefix: /"
|
||||
level=info msg="log:"
|
||||
level=info msg=" config: true"
|
||||
level=info msg=" level: info"
|
||||
level=info msg=" format: text"
|
||||
level=info msg=" timestamp: false"
|
||||
level=info msg="receivers:"
|
||||
level=info msg=" keep: []"
|
||||
level=info msg=" strip: []"
|
||||
level=info msg="sentry:"
|
||||
level=info msg=" private: \"\""
|
||||
level=info msg=" public: \"\""
|
||||
level=info msg="silences:"
|
||||
level=info msg=" comments:"
|
||||
level=info msg=" linkDetect:"
|
||||
level=info msg=" rules: []"
|
||||
level=info msg="silenceForm:"
|
||||
level=info msg=" strip:"
|
||||
level=info msg=" labels: []"
|
||||
level=info msg="ui:"
|
||||
level=info msg=" refresh: 30s"
|
||||
level=info msg=" hideFiltersWhenIdle: true"
|
||||
level=info msg=" colorTitlebar: false"
|
||||
level=info msg=" theme: auto"
|
||||
level=info msg=" animations: true"
|
||||
level=info msg=" minimalGroupWidth: 420"
|
||||
level=info msg=" alertsPerGroup: 5"
|
||||
level=info msg=" collapseGroups: collapsedOnMobile"
|
||||
level=info msg=" multiGridLabel: \"\""
|
||||
level=info msg=" multiGridSortReverse: false"
|
||||
level=info msg="Configured Alertmanager source" name=am proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Configuration is valid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: am
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
labels:
|
||||
color:
|
||||
custom:
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Fails is we cannot write a PID file
|
||||
|
||||
karma.bin-should-fail --pid-file=/foo/bar/karma.pid --log.format=text --log.config=false --alertmanager.uri=http://localhost
|
||||
karma.bin-should-fail --pid-file=/foo/bar/karma.pid --alertmanager.uri=http://127.0.0.1
|
||||
! stdout .
|
||||
stderr 'msg="Failed to write a PID file:'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://127.0.0.1
|
||||
level=info msg="Writing PID file" path=/foo/bar/karma.pid
|
||||
level=error msg="Execution failed" error="failed to write a PID file: open /foo/bar/karma.pid: no such file or directory"
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
# Fails is we cannot remove a PID file
|
||||
|
||||
exec sh -ex ./test.sh &
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=false --alertmanager.uri=http://localhost --listen.address=127.0.0.1 --listen.port=8073
|
||||
karma.bin-should-fail --pid-file=karma.pid --alertmanager.uri=http://127.0.0.1 --listen.address=127.0.0.1 --listen.port=8073
|
||||
! stdout .
|
||||
stderr 'msg="Failed to remove PID file:'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://127.0.0.1
|
||||
level=info msg="Writing PID file" path=karma.pid
|
||||
level=info msg="Initial Alertmanager collection"
|
||||
level=info msg="Pulling latest alerts and silences from Alertmanager"
|
||||
level=info msg="Collecting alerts and silences" alertmanager=default
|
||||
level=info msg="GET request" timeout=40 uri=http://127.0.0.1/metrics
|
||||
level=error msg="Request failed" error="Get \"http://127.0.0.1/metrics\": dial tcp 127.0.0.1:80: connect: connection refused" alertmanager=default uri=http://127.0.0.1
|
||||
level=error msg="Collection failed" error="Get \"http://127.0.0.1/api/v2/status\": dial tcp 127.0.0.1:80: connect: connection refused" alertmanager=default
|
||||
level=info msg="Collection completed"
|
||||
level=info msg="Done, starting HTTP server"
|
||||
level=info msg="Starting HTTP server" address=127.0.0.1:8073
|
||||
level=info msg="Shutting down HTTP server"
|
||||
level=info msg="HTTP server shut down"
|
||||
level=info msg="Removing PID file" path=karma.pid
|
||||
level=error msg="Execution failed" error="failed to remove PID file: remove karma.pid: no such file or directory"
|
||||
-- test.sh --
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Raises an error if --authorization.acl points to a file that contains unknown keys
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Reading silence ACL config file acl.yaml"'
|
||||
stderr 'msg="Failed to parse silence ACL configuration file \\"acl.yaml\\": yaml: unmarshal errors:\\n line 6: field nameFoo not found in type config.SilenceFilters"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="failed to parse silence ACL configuration file \"acl.yaml\": yaml: unmarshal errors:\n line 6: field nameFoo not found in type config.SilenceFilters"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -24,7 +28,7 @@ authorization:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
-- acl.yaml --
|
||||
rules:
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Raises an error if --config.file points to a file that contains unknown keys
|
||||
karma.bin-should-fail --log.format=text --log.config=false --check-config
|
||||
karma.bin-should-fail --check-config
|
||||
! stdout .
|
||||
! stderr 'msg="Configuration is valid"'
|
||||
stderr 'msg="Failed to parse configuration file \\"karma.yaml\\": yaml: unmarshal errors:\\n line 5: field authorizationFoo not found in type config.configSchema"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=error msg="Execution failed" error="failed to parse configuration file \"karma.yaml\": yaml: unmarshal errors:\n line 5: field authorizationFoo not found in type config.configSchema"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
@@ -23,4 +24,4 @@ authorizationFoo:
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Basic Auth headers are passed to the UI in the API response
|
||||
|
||||
exec sh -ex ./test.sh &
|
||||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=false --alertmanager.uri=http://foo:bar@localhost --listen.address=127.0.0.1 --listen.port=8076
|
||||
karma.bin-should-work --pid-file=karma.pid --alertmanager.uri=http://foo:bar@127.0.0.1 --listen.address=127.0.0.1 --listen.port=8076
|
||||
wait
|
||||
stdout '"publicURI":"http://foo:bar@localhost"'
|
||||
stdout '"headers":{"Authorization":"Basic Zm9vOmJhcg=="}'
|
||||
stdout '"publicURI":"http://foo:bar@127.0.0.1"'
|
||||
|
||||
-- test.sh --
|
||||
#!/bin/sh
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# Fails to start when invalid port is set
|
||||
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=false --alertmanager.uri=http://foo:bar@localhost --listen.address=127.0.0.1 --listen.port=9999999
|
||||
karma.bin-should-fail --pid-file=karma.pid --alertmanager.uri=http://foo:bar@127.0.0.1 --listen.address=127.0.0.1 --listen.port=9999999
|
||||
! stdout .
|
||||
stderr 'msg="listen tcp: address 9999999: invalid port"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://foo:xxx@127.0.0.1
|
||||
level=info msg="Writing PID file" path=karma.pid
|
||||
level=info msg="Initial Alertmanager collection"
|
||||
level=info msg="Pulling latest alerts and silences from Alertmanager"
|
||||
level=info msg="Collecting alerts and silences" alertmanager=default
|
||||
level=info msg="GET request" timeout=40 uri=http://foo:xxx@127.0.0.1/metrics
|
||||
level=error msg="Request failed" error="Get \"http://foo:***@127.0.0.1/metrics\": dial tcp 127.0.0.1:80: connect: connection refused" alertmanager=default uri=http://foo:xxx@127.0.0.1
|
||||
level=error msg="Collection failed" error="Get \"http://127.0.0.1/api/v2/status\": dial tcp 127.0.0.1:80: connect: connection refused" alertmanager=default
|
||||
level=info msg="Collection completed"
|
||||
level=info msg="Done, starting HTTP server"
|
||||
level=error msg="Execution failed" error="listen tcp: address 9999999: invalid port"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Raises an error if tls CA cert is missing
|
||||
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=true --log.level=info --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
karma.bin-should-fail --pid-file=karma.pid --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create HTTP transport for Alertmanager ''client-auth'' with URI ''https:\/\/localhost:9093'': open ca.crt: no such file or directory"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create HTTP transport for Alertmanager 'client-auth' with URI 'https://127.0.0.1:9093': open ca.crt: no such file or directory"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: client-auth
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
timeout: 10s
|
||||
tls:
|
||||
ca: ca.crt
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Raises an error if tls CA cert is missing
|
||||
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=true --log.level=info --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
karma.bin-should-fail --pid-file=karma.pid --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create HTTP transport for Alertmanager ''client-auth'' with URI ''https:\/\/localhost:9093'': open client.pem: no such file or directory"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create HTTP transport for Alertmanager 'client-auth' with URI 'https://127.0.0.1:9093': open client.pem: no such file or directory"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: client-auth
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
timeout: 10s
|
||||
tls:
|
||||
cert: client.pem
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Raises an error if tls CA cert is missing
|
||||
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=true --log.level=info --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
karma.bin-should-fail --pid-file=karma.pid --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create HTTP transport for Alertmanager ''client-auth'' with URI ''https:\/\/localhost:9093'': open client.key: no such file or directory"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create HTTP transport for Alertmanager 'client-auth' with URI 'https://127.0.0.1:9093': open client.key: no such file or directory"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: client-auth
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
timeout: 10s
|
||||
tls:
|
||||
cert: client.pem
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Raises an error if tls CA cert is missing
|
||||
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=true --log.level=info --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
karma.bin-should-fail --pid-file=karma.pid --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create HTTP transport for Alertmanager ''client-auth'' with URI ''https:\/\/localhost:9093'': tls: failed to find any PEM data in certificate input"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create HTTP transport for Alertmanager 'client-auth' with URI 'https://127.0.0.1:9093': tls: failed to find any PEM data in certificate input"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: client-auth
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
timeout: 10s
|
||||
tls:
|
||||
cert: client.pem
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Raises an error if tls CA cert is missing
|
||||
|
||||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=true --log.level=info --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
karma.bin-should-fail --pid-file=karma.pid --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8078
|
||||
! stdout .
|
||||
stderr 'msg="Failed to create HTTP transport for Alertmanager ''client-auth'' with URI ''https:\/\/localhost:9093'': tls: failed to find any PEM data in key input"'
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=error msg="Execution failed" error="failed to create HTTP transport for Alertmanager 'client-auth' with URI 'https://127.0.0.1:9093': tls: failed to find any PEM data in key input"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: client-auth
|
||||
uri: https://localhost:9093
|
||||
uri: https://127.0.0.1:9093
|
||||
timeout: 10s
|
||||
tls:
|
||||
cert: client.pem
|
||||
|
||||
+5
-5
@@ -6,14 +6,14 @@ import (
|
||||
|
||||
"github.com/prymitive/karma/internal/alertmanager"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func pullFromAlertmanager() {
|
||||
// always flush cache once we're done
|
||||
defer apiCache.Flush()
|
||||
|
||||
log.Info("Pulling latest alerts and silences from Alertmanager")
|
||||
log.Info().Msg("Pulling latest alerts and silences from Alertmanager")
|
||||
|
||||
upstreams := alertmanager.GetAlertmanagers()
|
||||
wg := sync.WaitGroup{}
|
||||
@@ -21,10 +21,10 @@ func pullFromAlertmanager() {
|
||||
|
||||
for _, upstream := range upstreams {
|
||||
go func(am *alertmanager.Alertmanager) {
|
||||
log.Infof("[%s] Collecting alerts and silences", am.Name)
|
||||
log.Info().Str("alertmanager", am.Name).Msg("Collecting alerts and silences")
|
||||
err := am.Pull()
|
||||
if err != nil {
|
||||
log.Errorf("[%s] %s", am.Name, err)
|
||||
log.Error().Err(err).Str("alertmanager", am.Name).Msg("Collection failed")
|
||||
}
|
||||
wg.Done()
|
||||
}(upstream)
|
||||
@@ -32,7 +32,7 @@ func pullFromAlertmanager() {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
log.Info("Pull completed")
|
||||
log.Info().Msg("Collection completed")
|
||||
runtime.GC()
|
||||
}
|
||||
|
||||
|
||||
+11
-63
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func notFound(c *gin.Context) {
|
||||
@@ -51,7 +51,7 @@ func compressResponse(data []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
compressed := b.Bytes()
|
||||
log.Debugf("Compressed %d bytes to %d bytes (%.2f%%)", len(data), len(compressed), (float64(len(compressed))/float64(len(data)))*100)
|
||||
log.Debug().Int("original", len(data)).Int("compressed", len(compressed)).Float64("ratio", (float64(len(compressed))/float64(len(data)))*100).Msg("Compressed response")
|
||||
|
||||
return compressed, nil
|
||||
}
|
||||
@@ -70,20 +70,12 @@ func decompressCachedResponse(data []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
func index(c *gin.Context) {
|
||||
start := time.Now()
|
||||
|
||||
noCache(c)
|
||||
|
||||
filtersJSON, err := json.Marshal(config.Config.Filters.Default)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
filtersJSON, _ := json.Marshal(config.Config.Filters.Default)
|
||||
filtersB64 := base64.StdEncoding.EncodeToString(filtersJSON)
|
||||
|
||||
defaults, err := json.Marshal(config.Config.UI)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defaults, _ := json.Marshal(config.Config.UI)
|
||||
defaultsB64 := base64.StdEncoding.EncodeToString(defaults)
|
||||
|
||||
c.HTML(http.StatusOK, "ui/build/index.html", gin.H{
|
||||
@@ -93,12 +85,6 @@ func index(c *gin.Context) {
|
||||
"DefaultFilter": filtersB64,
|
||||
"Defaults": defaultsB64,
|
||||
})
|
||||
|
||||
log.Infof("[%s] %s %s took %s", c.ClientIP(), c.Request.Method, c.Request.RequestURI, time.Since(start))
|
||||
}
|
||||
|
||||
func logAlertsView(c *gin.Context, cacheStatus string, duration time.Duration) {
|
||||
log.Infof("[%s %s] <%d> %s %s took %s", c.ClientIP(), cacheStatus, http.StatusOK, c.Request.Method, c.Request.RequestURI, duration)
|
||||
}
|
||||
|
||||
func populateAPIFilters(matchFilters []filters.FilterT) []models.Filter {
|
||||
@@ -177,29 +163,15 @@ func alerts(c *gin.Context) {
|
||||
|
||||
data, found := apiCache.Get(cacheKey)
|
||||
if found {
|
||||
rawData, err := decompressCachedResponse(data.([]byte))
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
|
||||
rawData, _ := decompressCachedResponse(data.([]byte))
|
||||
// need to overwrite settings as they can have user specific data
|
||||
newResp := models.AlertsResponse{}
|
||||
err = json.Unmarshal(rawData, &newResp)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
_ = json.Unmarshal(rawData, &newResp)
|
||||
newResp.Settings = resp.Settings
|
||||
newResp.Timestamp = string(ts)
|
||||
newResp.Authentication = resp.Authentication
|
||||
newData, err := json.Marshal(&newResp)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
newData, _ := json.Marshal(&newResp)
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, newData)
|
||||
logAlertsView(c, "HIT", time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -483,40 +455,28 @@ func alerts(c *gin.Context) {
|
||||
resp.Filters = populateAPIFilters(matchFilters)
|
||||
resp.Receivers = receivers
|
||||
|
||||
data, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
compressedData, err := compressResponse(data.([]byte))
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
data, _ = json.Marshal(resp)
|
||||
compressedData, _ := compressResponse(data.([]byte))
|
||||
apiCache.Set(cacheKey, compressedData, -1)
|
||||
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "MIS", time.Since(start))
|
||||
}
|
||||
|
||||
// autocomplete endpoint, json, used for filter autocomplete hints
|
||||
func autocomplete(c *gin.Context) {
|
||||
noCache(c)
|
||||
start := time.Now()
|
||||
|
||||
cacheKey := c.Request.RequestURI
|
||||
|
||||
data, found := apiCache.Get(cacheKey)
|
||||
if found {
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "HIT", time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
term, found := c.GetQuery("term")
|
||||
if !found || term == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "missing term=<token> parameter"})
|
||||
log.Infof("[%s] <%d> %s %s took %s", c.ClientIP(), http.StatusBadRequest, c.Request.Method, c.Request.RequestURI, time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -537,28 +497,21 @@ func autocomplete(c *gin.Context) {
|
||||
}
|
||||
|
||||
sort.Sort(sort.Reverse(acData))
|
||||
data, err := json.Marshal(acData)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
data, _ = json.Marshal(acData)
|
||||
|
||||
apiCache.Set(cacheKey, data, time.Second*15)
|
||||
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "MIS", time.Since(start))
|
||||
}
|
||||
|
||||
func silences(c *gin.Context) {
|
||||
noCache(c)
|
||||
start := time.Now()
|
||||
|
||||
cacheKey := c.Request.RequestURI
|
||||
|
||||
data, found := apiCache.Get(cacheKey)
|
||||
if found {
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "HIT", time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -665,14 +618,9 @@ func silences(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
data, err := json.Marshal(dedupedSilences)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
data, _ = json.Marshal(dedupedSilences)
|
||||
|
||||
apiCache.Set(cacheKey, data, time.Second*15)
|
||||
|
||||
c.Data(http.StatusOK, gin.MIMEJSON, data.([]byte))
|
||||
logAlertsView(c, "MIS", time.Since(start))
|
||||
}
|
||||
|
||||
+11
-7
@@ -18,9 +18,10 @@ import (
|
||||
"github.com/prymitive/karma/internal/mock"
|
||||
"github.com/prymitive/karma/internal/models"
|
||||
"github.com/prymitive/karma/internal/slices"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
@@ -31,7 +32,7 @@ import (
|
||||
var upstreamSetup = false
|
||||
|
||||
func mockConfig() {
|
||||
log.SetLevel(log.ErrorLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||
os.Setenv("ALERTMANAGER_URI", "http://localhost")
|
||||
os.Setenv("LABELS_COLOR_UNIQUE", "alertname @receiver @alertmanager @cluster")
|
||||
|
||||
@@ -39,14 +40,14 @@ func mockConfig() {
|
||||
config.SetupFlags(f)
|
||||
_, err := config.Config.Read(f)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal().Err(err).Msg("Error")
|
||||
}
|
||||
|
||||
if !upstreamSetup {
|
||||
upstreamSetup = true
|
||||
err := setupUpstreams()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal().Err(err).Msg("Error")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +58,10 @@ func ginTestEngine() *gin.Engine {
|
||||
setupRouter(r)
|
||||
|
||||
var t *template.Template
|
||||
t = loadTemplate(t, "ui/build/index.html")
|
||||
t, err := loadTemplate(t, "ui/build/index.html")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
r.SetHTMLTemplate(t)
|
||||
|
||||
return r
|
||||
@@ -997,7 +1001,7 @@ func TestAuthentication(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpstreamStatus(t *testing.T) {
|
||||
log.SetLevel(log.FatalLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
|
||||
type mockT struct {
|
||||
uri string
|
||||
@@ -2101,7 +2105,7 @@ func TestUpstreamStatus(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
log.SetLevel(log.FatalLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
pullFromAlertmanager()
|
||||
r := ginTestEngine()
|
||||
|
||||
|
||||
@@ -848,10 +848,10 @@ Defaults:
|
||||
|
||||
```YAML
|
||||
log:
|
||||
config: true
|
||||
config: false
|
||||
level: info
|
||||
format: text
|
||||
timestamp: true
|
||||
timestamp: false
|
||||
```
|
||||
|
||||
### Silences
|
||||
|
||||
@@ -32,7 +32,7 @@ require (
|
||||
github.com/prometheus/client_golang v1.7.1
|
||||
github.com/prometheus/common v0.14.0
|
||||
github.com/rogpeppe/go-internal v1.6.2
|
||||
github.com/sirupsen/logrus v1.7.0
|
||||
github.com/rs/zerolog v1.20.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
go.mongodb.org/mongo-driver v1.3.5 // indirect
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
|
||||
|
||||
@@ -18,10 +18,8 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
|
||||
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
|
||||
@@ -32,7 +30,6 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 h1:4daAzAu0S6Vi7/lbWECcX0j45yZReDZ56BQsrVBOEEY=
|
||||
@@ -60,6 +57,7 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
@@ -103,7 +101,6 @@ github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e h1:8bZpGwoPxkai
|
||||
github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e/go.mod h1:VhW/Ch/3FhimwZb8Oj+qJmdMmoB8r7lmJ5auRjm50oQ=
|
||||
github.com/gin-gonic/contrib v0.0.0-20201005132743-ca038bbf2944 h1:CUXsTZuAAdpQinpKgInZqKTOfn/jkIA9DLnozeybVRQ=
|
||||
github.com/gin-gonic/contrib v0.0.0-20201005132743-ca038bbf2944/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
|
||||
github.com/gin-gonic/gin v1.5.0 h1:fi+bqFAx/oLK54somfCtEZs9HeH1LHVoEPUgARpTqyc=
|
||||
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
||||
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
@@ -120,16 +117,13 @@ github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpR
|
||||
github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
|
||||
github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk=
|
||||
github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk=
|
||||
github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOXdfYzI=
|
||||
github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU=
|
||||
github.com/go-openapi/analysis v0.19.10 h1:5BHISBAXOc/aJK25irLZnx2D3s6WyYaY9D4gmuz9fdE=
|
||||
github.com/go-openapi/analysis v0.19.10/go.mod h1:qmhS3VNFxBlquFJ0RGoDtylO9y4pgTAUNE9AEEMdlJQ=
|
||||
github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
|
||||
github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
|
||||
github.com/go-openapi/errors v0.19.2 h1:a2kIyV3w+OS3S97zxUndRVD46+FhGOUBDFY7nmu4CsY=
|
||||
github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-openapi/errors v0.19.6 h1:xZMThgv5SQ7SMbWtKFkCf9bBdvR2iEyw9k3zGZONuys=
|
||||
github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
|
||||
github.com/go-openapi/errors v0.19.7 h1:Lcq+o0mSwCLKACMxZhreVHigB9ebghJ/lrmeaqASbjo=
|
||||
github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
|
||||
@@ -140,9 +134,7 @@ github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm7232
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
|
||||
github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
|
||||
github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w=
|
||||
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
||||
github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o=
|
||||
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
|
||||
github.com/go-openapi/jsonreference v0.19.4 h1:3Vw+rh13uq2JFNxgnMTGE1rnoieU9FmyE1gvnyylsYg=
|
||||
github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
|
||||
@@ -150,14 +142,12 @@ github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf
|
||||
github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
|
||||
github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
|
||||
github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs=
|
||||
github.com/go-openapi/loads v0.19.3 h1:jwIoahqCmaA5OBoc/B+1+Mu2L0Gr8xYQnbeyQEo/7b0=
|
||||
github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI=
|
||||
github.com/go-openapi/loads v0.19.5 h1:jZVYWawIQiA1NBnHla28ktg6hrcfTHsCE+3QLVRBIls=
|
||||
github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY=
|
||||
github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA=
|
||||
github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64=
|
||||
github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4=
|
||||
github.com/go-openapi/runtime v0.19.15 h1:2GIefxs9Rx1vCDNghRtypRq+ig8KSLrjHbAYI/gCLCM=
|
||||
github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo=
|
||||
github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98=
|
||||
github.com/go-openapi/runtime v0.19.22 h1:vtT7gJwxIK96BVTd9Ce5OPNQfIsk+q1j/+0e98NoVXk=
|
||||
@@ -165,10 +155,8 @@ github.com/go-openapi/runtime v0.19.22/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pt
|
||||
github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
|
||||
github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
|
||||
github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY=
|
||||
github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc=
|
||||
github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
|
||||
github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
|
||||
github.com/go-openapi/spec v0.19.8 h1:qAdZLh1r6QF/hI/gTq+TJTvsQUodZsM7KLqkAJdiJNg=
|
||||
github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
|
||||
github.com/go-openapi/spec v0.19.9 h1:9z9cbFuZJ7AcvOHKIY+f6Aevb4vObNDkTEyoMfO7rAc=
|
||||
github.com/go-openapi/spec v0.19.9/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28=
|
||||
@@ -176,40 +164,32 @@ github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pL
|
||||
github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU=
|
||||
github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY=
|
||||
github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU=
|
||||
github.com/go-openapi/strfmt v0.19.3 h1:eRfyY5SkaNJCAwmmMcADjY31ow9+N7MCLW7oRkbsINA=
|
||||
github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU=
|
||||
github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk=
|
||||
github.com/go-openapi/strfmt v0.19.5 h1:0utjKrw+BAh8s57XE9Xz8DUBsVvPmRUB6styvl9wWIM=
|
||||
github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk=
|
||||
github.com/go-openapi/strfmt v0.19.6 h1:epWc+q5qSgsy7A7+/HYyxLF37vLEYdPSkNB9G8mRqjw=
|
||||
github.com/go-openapi/strfmt v0.19.6/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk=
|
||||
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||
github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
|
||||
github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4azE=
|
||||
github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
|
||||
github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4=
|
||||
github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA=
|
||||
github.com/go-openapi/validate v0.19.3 h1:PAH/2DylwWcIU1s0Y7k3yNmeAgWOcKrNE2Q7Ww/kCg4=
|
||||
github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo=
|
||||
github.com/go-openapi/validate v0.19.10 h1:tG3SZ5DC5KF4cyt7nqLVcQXGj5A7mpaYkAcNPlDK+Yk=
|
||||
github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8=
|
||||
github.com/go-openapi/validate v0.19.11 h1:8lCr0b9lNWKjVjW/hSZZvltUy+bULl7vbnCTsOzlhPo=
|
||||
github.com/go-openapi/validate v0.19.11/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc=
|
||||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM=
|
||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/go-playground/validator/v10 v10.3.0 h1:nZU+7q+yJoFmwvNgv/LnPUkwPal62+b2xXj0AU1Es7o=
|
||||
github.com/go-playground/validator/v10 v10.3.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
@@ -250,15 +230,12 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
@@ -269,9 +246,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||
@@ -315,7 +290,6 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/jarcoal/httpmock v1.0.6 h1:e81vOSexXU3mJuJ4l//geOmKIt+Vkxerk1feQBC8D0g=
|
||||
@@ -325,10 +299,8 @@ github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqx
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
|
||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
@@ -338,27 +310,21 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8
|
||||
github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
|
||||
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/knadh/koanf v0.13.0 h1:OEjNdmrP/5oAhJkNwTtarioqOC4xe6WxRK8Q5ffW8WU=
|
||||
github.com/knadh/koanf v0.13.0/go.mod h1:7XDF7OJIqSQLUZnaXkjb1HB3CgMEYHyrzmgT8A6xAaE=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
|
||||
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
@@ -368,7 +334,6 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
|
||||
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
|
||||
@@ -377,7 +342,6 @@ github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kN
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
@@ -391,11 +355,8 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI
|
||||
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4=
|
||||
github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYGN7GeoRg=
|
||||
github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8=
|
||||
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
@@ -444,7 +405,6 @@ github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9
|
||||
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@@ -468,7 +428,6 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
|
||||
github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4=
|
||||
github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
|
||||
@@ -483,10 +442,12 @@ github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8d
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.6.2 h1:aIihoIOHCiLZHxyoNQ+ABL4NKhFTgKLBdMLyEAh98m0=
|
||||
github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||
github.com/rs/zerolog v1.20.0 h1:38k9hgtUBdxFwE34yS8rTHmHBa4eN16E4DJlv177LNs=
|
||||
github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
@@ -496,12 +457,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
@@ -516,11 +473,9 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3
|
||||
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
@@ -540,10 +495,8 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
|
||||
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
go.mongodb.org/mongo-driver v1.1.1 h1:Sq1fR+0c58RME5EoqKdjkiQAmPjmfHlZOoRI6fTUOcs=
|
||||
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
|
||||
go.mongodb.org/mongo-driver v1.3.4 h1:zs/dKNwX0gYUtzwrN9lLiR15hCO0nDwQj5xXx+vjCdE=
|
||||
go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
|
||||
go.mongodb.org/mongo-driver v1.3.5 h1:S0ZOruh4YGHjD7JoN7mIsTrNjnQbOjrmgrx6l6pZN7I=
|
||||
go.mongodb.org/mongo-driver v1.3.5/go.mod h1:Ual6Gkco7ZGQw8wE1t4tLnvBsf6yVSM60qW6TgOeJ5c=
|
||||
@@ -596,9 +549,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
|
||||
@@ -633,20 +584,16 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ixkcwXThoiF6yf+R9scA=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200722175500-76b94024e4b6 h1:X9xIZ1YU8bLZA3l6gqDUHSFiD0GFI9S548h6C8nDtOY=
|
||||
golang.org/x/sys v0.0.0-20200722175500-76b94024e4b6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@@ -670,6 +617,7 @@ golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgw
|
||||
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
@@ -680,7 +628,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
@@ -702,19 +649,15 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@@ -723,11 +666,9 @@ gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/colors.v1 v1.2.0 h1:SPweMUve+ywPrfwao+UvfD5Ah78aOLUkT5RlJiZn52c=
|
||||
gopkg.in/go-playground/colors.v1 v1.2.0/go.mod h1:AvbqcMpNXVl5gBrM20jBm3VjjKBbH/kI5UnqjU7lxFI=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
@@ -735,15 +676,12 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -7,25 +7,25 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/jarcoal/httpmock"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/prymitive/karma/internal/alertmanager"
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
"github.com/prymitive/karma/internal/mock"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/jarcoal/httpmock"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.SetLevel(log.ErrorLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||
httpmock.Activate()
|
||||
for _, version := range mock.ListAllMocks() {
|
||||
name := fmt.Sprintf("dedup-mock-%s", version)
|
||||
uri := fmt.Sprintf("http://%s.localhost", version)
|
||||
am, err := alertmanager.NewAlertmanager("cluster", name, uri, alertmanager.WithRequestTimeout(time.Second))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal().Err(err).Msg("Error")
|
||||
}
|
||||
err = alertmanager.RegisterAlertmanager(am)
|
||||
if err != nil {
|
||||
@@ -182,7 +182,7 @@ func TestStripReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClearData(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
httpmock.Activate()
|
||||
for _, version := range mock.ListAllMocks() {
|
||||
name := fmt.Sprintf("clear-data-mock-%s", version)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/prymitive/karma/internal/uri"
|
||||
"github.com/prymitive/karma/internal/verprobe"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -71,13 +71,13 @@ func (am *Alertmanager) probeVersion() string {
|
||||
|
||||
url, err := uri.JoinURL(am.URI, "metrics")
|
||||
if err != nil {
|
||||
log.Errorf("Failed to join url '%s' and path 'metrics': %s", am.SanitizedURI(), err)
|
||||
log.Error().Err(err).Str("uri", am.SanitizedURI()).Msg("Failed to join url with /metrics path")
|
||||
return fakeVersion
|
||||
}
|
||||
|
||||
source, err := am.reader.Read(url, am.HTTPHeaders)
|
||||
if err != nil {
|
||||
log.Errorf("[%s] %s request failed: %s", am.Name, uri.SanitizeURI(url), err)
|
||||
log.Error().Err(err).Str("alertmanager", am.Name).Str("uri", am.SanitizedURI()).Msg("Request failed")
|
||||
return fakeVersion
|
||||
}
|
||||
defer source.Close()
|
||||
@@ -86,7 +86,7 @@ func (am *Alertmanager) probeVersion() string {
|
||||
if err != nil {
|
||||
return fakeVersion
|
||||
}
|
||||
log.Infof("[%s] Upstream version: %s", am.Name, version)
|
||||
log.Info().Str("version", version).Str("alertmanager", am.Name).Msg("Upstream version")
|
||||
|
||||
return version
|
||||
}
|
||||
@@ -140,9 +140,9 @@ func (am *Alertmanager) pullSilences(version string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("[%s] Got %d silences(s) in %s", am.Name, len(silences), time.Since(start))
|
||||
log.Info().Str("alertmanager", am.Name).Int("silences", len(silences)).Dur("duration", time.Since(start)).Msg("Got silences")
|
||||
|
||||
log.Infof("[%s] Detecting ticket links in silences (%d)", am.Name, len(silences))
|
||||
log.Info().Str("alertmanager", am.Name).Int("silences", len(silences)).Msg("Detecting ticket links in silences")
|
||||
silenceMap := make(map[string]models.Silence, len(silences))
|
||||
for _, silence := range silences {
|
||||
silence := silence // scopelint pin
|
||||
@@ -190,15 +190,13 @@ func (am *Alertmanager) pullAlerts(version string) error {
|
||||
var groups []models.AlertGroup
|
||||
|
||||
start := time.Now()
|
||||
|
||||
groups, err = mapper.Collect(am.URI, am.HTTPHeaders, am.RequestTimeout, am.HTTPTransport)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info().Str("alertmanager", am.Name).Int("groups", len(groups)).Dur("duration", time.Since((start))).Msg("Collected alert groups")
|
||||
|
||||
log.Infof("[%s] Got %d alert group(s) in %s", am.Name, len(groups), time.Since(start))
|
||||
|
||||
log.Infof("[%s] Deduplicating alert groups (%d)", am.Name, len(groups))
|
||||
log.Info().Str("alertmanager", am.Name).Int("groups", len(groups)).Msg("Deduplicating alert groups")
|
||||
uniqueGroups := map[string]models.AlertGroup{}
|
||||
uniqueAlerts := map[string]map[string]models.Alert{}
|
||||
knownLabelsMap := map[string]bool{}
|
||||
@@ -230,7 +228,7 @@ func (am *Alertmanager) pullAlerts(version string) error {
|
||||
colors := models.LabelsColorMap{}
|
||||
autocompleteMap := map[string]models.Autocomplete{}
|
||||
|
||||
log.Infof("[%s] Processing unique alert groups (%d)", am.Name, len(uniqueGroups))
|
||||
log.Info().Str("alertmanager", am.Name).Int("groups", len(uniqueGroups)).Msg("Processing deduplicated alert groups")
|
||||
for _, ag := range uniqueGroups {
|
||||
alerts := make(models.AlertList, 0, len(uniqueAlerts[ag.ID]))
|
||||
for _, alert := range uniqueAlerts[ag.ID] {
|
||||
@@ -283,7 +281,7 @@ func (am *Alertmanager) pullAlerts(version string) error {
|
||||
dedupedGroups = append(dedupedGroups, ag)
|
||||
}
|
||||
|
||||
log.Infof("[%s] Merging autocomplete data (%d)", am.Name, len(autocompleteMap))
|
||||
log.Info().Str("alertmanager", am.Name).Int("hints", len(autocompleteMap)).Msg("Merging autocomplete hints")
|
||||
autocomplete := make([]models.Autocomplete, 0, len(autocompleteMap))
|
||||
for _, hint := range autocompleteMap {
|
||||
autocomplete = append(autocomplete, hint)
|
||||
@@ -442,7 +440,7 @@ func (am *Alertmanager) Error() string {
|
||||
missing, _ := slices.StringSliceDiff(configPeers, apiPeers)
|
||||
|
||||
if len(missing) > 0 {
|
||||
log.Debugf("[%s] cluster peers mismatch, configured: %v, api: %v, missing: %v\n", am.Name, configPeers, apiPeers, missing)
|
||||
log.Debug().Str("alertmanager", am.Name).Strs("configured", configPeers).Strs("api", apiPeers).Strs("missing", missing).Msg("Cluster peers mismatch")
|
||||
return fmt.Sprintf("missing cluster peers: %s", strings.Join(missing, ", "))
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type uriTest struct {
|
||||
@@ -186,7 +187,7 @@ func TestAlertmanagerSanitizedURI(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAlertmanagerPullWithInvalidURI(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
am, _ := NewAlertmanager("cluster", "test", "%gh&%ij")
|
||||
err := am.Pull()
|
||||
if err == nil {
|
||||
@@ -195,7 +196,7 @@ func TestAlertmanagerPullWithInvalidURI(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAlertmanagerPullAlertsWithInvalidVersion(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
am, _ := NewAlertmanager("cluster", "test", "http://localhost")
|
||||
err := am.pullAlerts("0.0.1")
|
||||
if err == nil {
|
||||
@@ -204,7 +205,7 @@ func TestAlertmanagerPullAlertsWithInvalidVersion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAlertmanagerPullSilencesWithInvalidVersion(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
am, _ := NewAlertmanager("cluster", "test", "http://localhost")
|
||||
err := am.pullSilences("0.0.1")
|
||||
if err == nil {
|
||||
@@ -213,7 +214,7 @@ func TestAlertmanagerPullSilencesWithInvalidVersion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAlertmanagerFetchStatusWithInvalidVersion(t *testing.T) {
|
||||
log.SetLevel(log.PanicLevel)
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
am, _ := NewAlertmanager("cluster", "test", "http://localhost")
|
||||
_, err := am.fetchStatus("0.0.1")
|
||||
if err == nil {
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func configureTLSRootCAs(tlsConfig *tls.Config, caPath string) error {
|
||||
log.Debugf("Loading TLS CA cert '%s'", caPath)
|
||||
log.Debug().Str("path", caPath).Msg("Loading TLS CA cert")
|
||||
caCert, err := ioutil.ReadFile(caPath)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -22,10 +22,10 @@ func configureTLSRootCAs(tlsConfig *tls.Config, caPath string) error {
|
||||
}
|
||||
|
||||
func configureTLSClientCert(tlsConfig *tls.Config, certPath, keyPath string) error {
|
||||
log.Debugf("Loading TLS cert '%s' and key '%s'", certPath, keyPath)
|
||||
log.Debug().Str("cert", certPath).Str("key", keyPath).Msg("Loading TLS cert and key")
|
||||
cert, err := tls.LoadX509KeyPair(certPath, keyPath)
|
||||
if err != nil {
|
||||
log.Debugf("Failed to load TLS cert and key: %s", err)
|
||||
log.Debug().Err(err).Msg("Failed to load TLS cert and key")
|
||||
return err
|
||||
}
|
||||
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/prymitive/karma/internal/models"
|
||||
"github.com/prymitive/karma/internal/uri"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// Option allows to pass functional options to NewAlertmanager()
|
||||
@@ -79,7 +79,8 @@ func RegisterAlertmanager(am *Alertmanager) error {
|
||||
}
|
||||
}
|
||||
upstreams[am.Name] = am
|
||||
log.Infof("[%s] Configured Alertmanager source at %s (proxied: %v, readonly: %v)", am.Name, uri.SanitizeURI(am.URI), am.ProxyRequests, am.ReadOnly)
|
||||
// am.Name, uri.SanitizeURI(am.URI), am.ProxyRequests, am.ReadOnly
|
||||
log.Info().Str("name", am.Name).Str("uri", uri.SanitizeURI(am.URI)).Bool("proxy", am.ProxyRequests).Bool("readonly", am.ReadOnly).Msg("Configured Alertmanager source")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ func ReadSilenceACLConfig(path string) (*silencesACLSchema, error) {
|
||||
|
||||
f, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to load silence ACL configuration file %q: %v", path, err)
|
||||
return nil, fmt.Errorf("failed to load silence ACL configuration file %q: %v", path, err)
|
||||
}
|
||||
|
||||
err = yaml.UnmarshalStrict(f, &cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to parse silence ACL configuration file %q: %v", path, err)
|
||||
return nil, fmt.Errorf("failed to parse silence ACL configuration file %q: %v", path, err)
|
||||
}
|
||||
|
||||
return &cfg, nil
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user