-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce continuous test tool (#1535)
* Added skeleton for mimir-continuous-test tool Signed-off-by: Marco Pracucci <marco@pracucci.com> * Added metrics server and init logger Signed-off-by: Marco Pracucci <marco@pracucci.com>
- Loading branch information
Showing
7 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
FROM alpine:3.15.0 | ||
RUN apk add --no-cache ca-certificates | ||
COPY mimir-continuous-test / | ||
ENTRYPOINT ["/mimir-continuous-test"] | ||
|
||
ARG revision | ||
LABEL org.opencontainers.image.title="mimir-continuous-test" \ | ||
org.opencontainers.image.source="https://github.com/grafana/mimir/tree/main/cmd/mimir-continuous-test" \ | ||
org.opencontainers.image.revision="${revision}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
|
||
"github.com/go-kit/log/level" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/collectors" | ||
"github.com/weaveworks/common/logging" | ||
"github.com/weaveworks/common/server" | ||
|
||
"github.com/grafana/mimir/pkg/util/instrumentation" | ||
util_log "github.com/grafana/mimir/pkg/util/log" | ||
) | ||
|
||
type Config struct { | ||
ServerMetricsPort int | ||
LogLevel logging.Level | ||
} | ||
|
||
func (cfg *Config) RegisterFlags(f *flag.FlagSet) { | ||
f.IntVar(&cfg.ServerMetricsPort, "server.metrics-port", 9900, "The port where metrics are exposed.") | ||
cfg.LogLevel.RegisterFlags(f) | ||
} | ||
|
||
func main() { | ||
// Parse CLI flags. | ||
cfg := &Config{} | ||
cfg.RegisterFlags(flag.CommandLine) | ||
flag.Parse() | ||
|
||
util_log.InitLogger(&server.Config{ | ||
LogLevel: cfg.LogLevel, | ||
}) | ||
logger := util_log.Logger | ||
|
||
// Run the instrumentation server. | ||
registry := prometheus.NewRegistry() | ||
registry.MustRegister(collectors.NewGoCollector()) | ||
|
||
i := instrumentation.NewMetricsServer(cfg.ServerMetricsPort, registry) | ||
if err := i.Start(); err != nil { | ||
level.Error(logger).Log("msg", "Unable to start instrumentation server", "err", err.Error()) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters