mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-23 12:44:05 -08:00
merge master/resolve conflict
Signed-off-by: jessicagreben <jessicagrebens@gmail.com>
This commit is contained in:
commit
ac06d0a657
|
@ -19,7 +19,9 @@ linters-settings:
|
|||
include-go-root: true
|
||||
packages:
|
||||
- sync/atomic
|
||||
- github.com/stretchr/testify/assert
|
||||
packages-with-error-message:
|
||||
- sync/atomic: "Use go.uber.org/atomic instead of sync/atomic"
|
||||
- github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert"
|
||||
errcheck:
|
||||
exclude: scripts/errcheck_excludes.txt
|
||||
|
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,11 +1,21 @@
|
|||
## 2.22.0-rc.0 / 2020-10-07
|
||||
## 2.22.2 / 2020-11-16
|
||||
|
||||
* [BUGFIX] Fix race condition in syncing/stopping/reloading scrapers. #8176
|
||||
|
||||
## 2.22.1 / 2020-11-03
|
||||
|
||||
* [BUGFIX] Fix potential "mmap: invalid argument" errors in loading the head chunks, after an unclean shutdown, by performing read repairs. #8061
|
||||
* [BUGFIX] Fix serving metrics and API when reloading scrape config. #8104
|
||||
* [BUGFIX] Fix head chunk size calculation for size based retention. #8139
|
||||
|
||||
## 2.22.0 / 2020-10-07
|
||||
|
||||
As announced in the 2.21.0 release notes, the experimental gRPC API v2 has been
|
||||
removed.
|
||||
|
||||
* [CHANGE] web: Remove APIv2. #7935
|
||||
* [ENHANCEMENT] React UI: Implement missing TSDB head stats section. #7876
|
||||
* [ENHANCEMENT] UI: Add Collapse all button. #6957
|
||||
* [ENHANCEMENT] UI: Add Collapse all button to targets page. #6957
|
||||
* [ENHANCEMENT] UI: Clarify alert state toggle via checkbox icon. #7936
|
||||
* [ENHANCEMENT] Add `rule_group_last_evaluation_samples` and `prometheus_tsdb_data_replay_duration_seconds` metrics. #7737 #7977
|
||||
* [ENHANCEMENT] Gracefully handle unknown WAL record types. #8004
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* `prometheus-mixin`: @beorn7
|
||||
* `storage`
|
||||
* `remote`: @csmarchbanks, @cstyan, @bwplotka
|
||||
* `tsdb`: @codesome, @krasi-georgiev, @bwplotka
|
||||
* `tsdb`: @codesome, @bwplotka
|
||||
* `web`
|
||||
* `ui`: @juliusv
|
||||
* `Makefile` and related build configuration: @simonpasquier, @SuperQ
|
||||
|
|
11
Makefile
11
Makefile
|
@ -15,10 +15,11 @@
|
|||
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le s390x
|
||||
|
||||
REACT_APP_PATH = web/ui/react-app
|
||||
REACT_APP_SOURCE_FILES = $(wildcard $(REACT_APP_PATH)/public/* $(REACT_APP_PATH)/src/* $(REACT_APP_PATH)/tsconfig.json)
|
||||
REACT_APP_SOURCE_FILES = $(shell find $(REACT_APP_PATH)/public/ $(REACT_APP_PATH)/src/ $(REACT_APP_PATH)/tsconfig.json)
|
||||
REACT_APP_OUTPUT_DIR = web/ui/static/react
|
||||
REACT_APP_NODE_MODULES_PATH = $(REACT_APP_PATH)/node_modules
|
||||
REACT_APP_NPM_LICENSES_TARBALL = "npm_licenses.tar.bz2"
|
||||
REACT_APP_BUILD_SCRIPT = ./scripts/build_react_app.sh
|
||||
|
||||
PROMTOOL = ./promtool
|
||||
TSDB_BENCHMARK_NUM_METRICS ?= 1000
|
||||
|
@ -32,9 +33,9 @@ DOCKER_IMAGE_NAME ?= prometheus
|
|||
$(REACT_APP_NODE_MODULES_PATH): $(REACT_APP_PATH)/package.json $(REACT_APP_PATH)/yarn.lock
|
||||
cd $(REACT_APP_PATH) && yarn --frozen-lockfile
|
||||
|
||||
$(REACT_APP_OUTPUT_DIR): $(REACT_APP_NODE_MODULES_PATH) $(REACT_APP_SOURCE_FILES)
|
||||
$(REACT_APP_OUTPUT_DIR): $(REACT_APP_NODE_MODULES_PATH) $(REACT_APP_SOURCE_FILES) $(REACT_APP_BUILD_SCRIPT)
|
||||
@echo ">> building React app"
|
||||
@./scripts/build_react_app.sh
|
||||
@$(REACT_APP_BUILD_SCRIPT)
|
||||
|
||||
.PHONY: assets
|
||||
assets: $(REACT_APP_OUTPUT_DIR)
|
||||
|
@ -46,12 +47,12 @@ assets: $(REACT_APP_OUTPUT_DIR)
|
|||
@$(GOFMT) -w ./web/ui
|
||||
|
||||
.PHONY: react-app-lint
|
||||
react-app-lint:
|
||||
react-app-lint:
|
||||
@echo ">> running React app linting"
|
||||
cd $(REACT_APP_PATH) && yarn lint:ci
|
||||
|
||||
.PHONY: react-app-lint-fix
|
||||
react-app-lint-fix:
|
||||
react-app-lint-fix:
|
||||
@echo ">> running React app linting and fixing errors where possible"
|
||||
cd $(REACT_APP_PATH) && yarn lint
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ ifneq ($(shell which gotestsum),)
|
|||
endif
|
||||
endif
|
||||
|
||||
PROMU_VERSION ?= 0.6.0
|
||||
PROMU_VERSION ?= 0.7.0
|
||||
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
|
||||
|
||||
GOLANGCI_LINT :=
|
||||
|
@ -245,10 +245,12 @@ common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
|
|||
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
|
||||
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
|
||||
|
||||
DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION)))
|
||||
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
|
||||
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
|
||||
$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
|
||||
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
|
||||
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"
|
||||
|
||||
.PHONY: common-docker-manifest
|
||||
common-docker-manifest:
|
||||
|
|
27
README.md
27
README.md
|
@ -13,19 +13,18 @@ examples and guides.
|
|||
|
||||
Prometheus, a [Cloud Native Computing Foundation](https://cncf.io/) project, is a systems and service monitoring system. It collects metrics
|
||||
from configured targets at given intervals, evaluates rule expressions,
|
||||
displays the results, and can trigger alerts if some condition is observed
|
||||
to be true.
|
||||
displays the results, and can trigger alerts when specified conditions are observed.
|
||||
|
||||
Prometheus's main distinguishing features as compared to other monitoring systems are:
|
||||
The features that distinguish Prometheus from other metrics and monitoring systems are:
|
||||
|
||||
- a **multi-dimensional** data model (timeseries defined by metric name and set of key/value dimensions)
|
||||
- A **multi-dimensional** data model (time series defined by metric name and set of key/value dimensions)
|
||||
- PromQL, a **powerful and flexible query language** to leverage this dimensionality
|
||||
- no dependency on distributed storage; **single server nodes are autonomous**
|
||||
- timeseries collection happens via a **pull model** over HTTP
|
||||
- **pushing timeseries** is supported via an intermediary gateway
|
||||
- targets are discovered via **service discovery** or **static configuration**
|
||||
- multiple modes of **graphing and dashboarding support**
|
||||
- support for hierarchical and horizontal **federation**
|
||||
- No dependency on distributed storage; **single server nodes are autonomous**
|
||||
- An HTTP **pull model** for time series collection
|
||||
- **Pushing time series** is supported via an intermediary gateway for batch jobs
|
||||
- Targets are discovered via **service discovery** or **static configuration**
|
||||
- Multiple modes of **graphing and dashboarding support**
|
||||
- Support for hierarchical and horizontal **federation**
|
||||
|
||||
## Architecture overview
|
||||
|
||||
|
@ -56,9 +55,9 @@ Prometheus will now be reachable at http://localhost:9090/.
|
|||
|
||||
### Building from source
|
||||
|
||||
To build Prometheus from the source code yourself you need to have a working
|
||||
Go environment with [version 1.13 or greater installed](https://golang.org/doc/install).
|
||||
You will also need to have [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/)
|
||||
To build Prometheus from source code, first ensure that have a working
|
||||
Go environment with [version 1.14 or greater installed](https://golang.org/doc/install).
|
||||
You also need [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/)
|
||||
installed in order to build the frontend assets.
|
||||
|
||||
You can directly use the `go` tool to download and install the `prometheus`
|
||||
|
@ -102,7 +101,7 @@ For more information on building, running, and developing on the new React-based
|
|||
## More information
|
||||
|
||||
* The source code is periodically indexed: [Prometheus Core](https://godoc.org/github.com/prometheus/prometheus).
|
||||
* You will find a CircleCI configuration in `.circleci/config.yml`.
|
||||
* You will find a CircleCI configuration in [`.circleci/config.yml`](.circleci/config.yml).
|
||||
* See the [Community page](https://prometheus.io/community) for how to reach the Prometheus developers and users on various communication channels.
|
||||
|
||||
## Contributing
|
||||
|
|
|
@ -27,7 +27,9 @@ Release cadence of first pre-releases being cut is 6 weeks.
|
|||
| v2.20 | 2020-07-15 | Björn Rabenstein (GitHub: @beorn7) |
|
||||
| v2.21 | 2020-08-26 | Julien Pivotto (GitHub: @roidelapluie) |
|
||||
| v2.22 | 2020-10-07 | Frederic Branczyk (GitHub: @brancz) |
|
||||
| v2.23 | 2020-11-18 | **searching for volunteer** |
|
||||
| v2.23 | 2020-11-18 | Ganesh Vernekar (GitHub: @codesome) |
|
||||
| v2.24 | 2020-12-30 | Björn Rabenstein (GitHub: @beorn7) |
|
||||
| v2.25 | 2021-02-10 | **searching for volunteer** |
|
||||
|
||||
If you are interested in volunteering please create a pull request against the [prometheus/prometheus](https://github.com/prometheus/prometheus) repository and propose yourself for the release series of your choice.
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/common/promlog"
|
||||
promlogflag "github.com/prometheus/common/promlog/flag"
|
||||
"github.com/prometheus/common/version"
|
||||
jcfg "github.com/uber/jaeger-client-go/config"
|
||||
jprom "github.com/uber/jaeger-lib/metrics/prometheus"
|
||||
|
@ -52,9 +53,9 @@ import (
|
|||
klog "k8s.io/klog"
|
||||
klogv2 "k8s.io/klog/v2"
|
||||
|
||||
promlogflag "github.com/prometheus/common/promlog/flag"
|
||||
"github.com/prometheus/prometheus/config"
|
||||
"github.com/prometheus/prometheus/discovery"
|
||||
_ "github.com/prometheus/prometheus/discovery/install" // Register service discovery implementations.
|
||||
"github.com/prometheus/prometheus/notifier"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/pkg/logging"
|
||||
|
@ -68,8 +69,6 @@ import (
|
|||
"github.com/prometheus/prometheus/tsdb"
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
"github.com/prometheus/prometheus/web"
|
||||
|
||||
_ "github.com/prometheus/prometheus/discovery/install" // Register service discovery implementations.
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -370,7 +369,8 @@ func main() {
|
|||
|
||||
var (
|
||||
localStorage = &readyStorage{}
|
||||
remoteStorage = remote.NewStorage(log.With(logger, "component", "remote"), prometheus.DefaultRegisterer, localStorage.StartTime, cfg.localStoragePath, time.Duration(cfg.RemoteFlushDeadline))
|
||||
scraper = &readyScrapeManager{}
|
||||
remoteStorage = remote.NewStorage(log.With(logger, "component", "remote"), prometheus.DefaultRegisterer, localStorage.StartTime, cfg.localStoragePath, time.Duration(cfg.RemoteFlushDeadline), scraper)
|
||||
fanoutStorage = storage.NewFanout(logger, localStorage, remoteStorage)
|
||||
)
|
||||
|
||||
|
@ -415,6 +415,8 @@ func main() {
|
|||
})
|
||||
)
|
||||
|
||||
scraper.Set(scrapeManager)
|
||||
|
||||
cfg.web.Context = ctxWeb
|
||||
cfg.web.TSDBRetentionDuration = cfg.tsdb.RetentionDuration
|
||||
cfg.web.TSDBMaxBytes = cfg.tsdb.MaxBytes
|
||||
|
@ -1096,6 +1098,35 @@ func (s *readyStorage) Stats(statsByLabelName string) (*tsdb.Stats, error) {
|
|||
return nil, tsdb.ErrNotReady
|
||||
}
|
||||
|
||||
// ErrNotReady is returned if the underlying scrape manager is not ready yet.
|
||||
var ErrNotReady = errors.New("Scrape manager not ready")
|
||||
|
||||
// ReadyScrapeManager allows a scrape manager to be retrieved. Even if it's set at a later point in time.
|
||||
type readyScrapeManager struct {
|
||||
mtx sync.RWMutex
|
||||
m *scrape.Manager
|
||||
}
|
||||
|
||||
// Set the scrape manager.
|
||||
func (rm *readyScrapeManager) Set(m *scrape.Manager) {
|
||||
rm.mtx.Lock()
|
||||
defer rm.mtx.Unlock()
|
||||
|
||||
rm.m = m
|
||||
}
|
||||
|
||||
// Get the scrape manager. If is not ready, return an error.
|
||||
func (rm *readyScrapeManager) Get() (*scrape.Manager, error) {
|
||||
rm.mtx.RLock()
|
||||
defer rm.mtx.RUnlock()
|
||||
|
||||
if rm.m != nil {
|
||||
return rm.m, nil
|
||||
}
|
||||
|
||||
return nil, ErrNotReady
|
||||
}
|
||||
|
||||
// tsdbOptions is tsdb.Option version with defined units.
|
||||
// This is required as tsdb.Option fields are unit agnostic (time).
|
||||
type tsdbOptions struct {
|
||||
|
|
|
@ -28,10 +28,11 @@ import (
|
|||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/notifier"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/rules"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
var promPath = os.Args[0]
|
||||
|
@ -97,9 +98,9 @@ func TestComputeExternalURL(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
_, err := computeExternalURL(test.input, "0.0.0.0:9090")
|
||||
if test.valid {
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
testutil.NotOk(t, err, "input=%q", test.input)
|
||||
require.Error(t, err, "input=%q", test.input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,11 +116,11 @@ func TestFailedStartupExitCode(t *testing.T) {
|
|||
|
||||
prom := exec.Command(promPath, "-test.main", "--config.file="+fakeInputFile)
|
||||
err := prom.Run()
|
||||
testutil.NotOk(t, err)
|
||||
require.Error(t, err)
|
||||
|
||||
if exitError, ok := err.(*exec.ExitError); ok {
|
||||
status := exitError.Sys().(syscall.WaitStatus)
|
||||
testutil.Equals(t, expectedExitStatus, status.ExitStatus())
|
||||
require.Equal(t, expectedExitStatus, status.ExitStatus())
|
||||
} else {
|
||||
t.Errorf("unable to retrieve the exit status for prometheus: %v", err)
|
||||
}
|
||||
|
@ -188,7 +189,7 @@ func TestSendAlerts(t *testing.T) {
|
|||
if len(tc.in) == 0 {
|
||||
t.Fatalf("sender called with 0 alert")
|
||||
}
|
||||
testutil.Equals(t, tc.exp, alerts)
|
||||
require.Equal(t, tc.exp, alerts)
|
||||
})
|
||||
sendAlerts(senderFunc, "http://localhost:9090")(context.TODO(), "up", tc.in...)
|
||||
})
|
||||
|
@ -205,14 +206,14 @@ func TestWALSegmentSizeBounds(t *testing.T) {
|
|||
|
||||
// Log stderr in case of failure.
|
||||
stderr, err := prom.StderrPipe()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
go func() {
|
||||
slurp, _ := ioutil.ReadAll(stderr)
|
||||
t.Log(string(slurp))
|
||||
}()
|
||||
|
||||
err = prom.Start()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
if expectedExitStatus == 0 {
|
||||
done := make(chan error, 1)
|
||||
|
@ -227,10 +228,10 @@ func TestWALSegmentSizeBounds(t *testing.T) {
|
|||
}
|
||||
|
||||
err = prom.Wait()
|
||||
testutil.NotOk(t, err)
|
||||
require.Error(t, err)
|
||||
if exitError, ok := err.(*exec.ExitError); ok {
|
||||
status := exitError.Sys().(syscall.WaitStatus)
|
||||
testutil.Equals(t, expectedExitStatus, status.ExitStatus())
|
||||
require.Equal(t, expectedExitStatus, status.ExitStatus())
|
||||
} else {
|
||||
t.Errorf("unable to retrieve the exit status for prometheus: %v", err)
|
||||
}
|
||||
|
@ -239,21 +240,21 @@ func TestWALSegmentSizeBounds(t *testing.T) {
|
|||
|
||||
func TestTimeMetrics(t *testing.T) {
|
||||
tmpDir, err := ioutil.TempDir("", "time_metrics_e2e")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
defer func() {
|
||||
testutil.Ok(t, os.RemoveAll(tmpDir))
|
||||
require.NoError(t, os.RemoveAll(tmpDir))
|
||||
}()
|
||||
|
||||
reg := prometheus.NewRegistry()
|
||||
db, err := openDBWithMetrics(tmpDir, log.NewNopLogger(), reg, nil)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
testutil.Ok(t, db.Close())
|
||||
require.NoError(t, db.Close())
|
||||
}()
|
||||
|
||||
// Check initial values.
|
||||
testutil.Equals(t, map[string]float64{
|
||||
require.Equal(t, map[string]float64{
|
||||
"prometheus_tsdb_lowest_timestamp_seconds": float64(math.MaxInt64) / 1000,
|
||||
"prometheus_tsdb_head_min_time_seconds": float64(math.MaxInt64) / 1000,
|
||||
"prometheus_tsdb_head_max_time_seconds": float64(math.MinInt64) / 1000,
|
||||
|
@ -265,14 +266,14 @@ func TestTimeMetrics(t *testing.T) {
|
|||
|
||||
app := db.Appender(context.Background())
|
||||
_, err = app.Add(labels.FromStrings(model.MetricNameLabel, "a"), 1000, 1)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Add(labels.FromStrings(model.MetricNameLabel, "a"), 2000, 1)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Add(labels.FromStrings(model.MetricNameLabel, "a"), 3000, 1)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Ok(t, app.Commit())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
testutil.Equals(t, map[string]float64{
|
||||
require.Equal(t, map[string]float64{
|
||||
"prometheus_tsdb_lowest_timestamp_seconds": 1.0,
|
||||
"prometheus_tsdb_head_min_time_seconds": 1.0,
|
||||
"prometheus_tsdb_head_max_time_seconds": 3.0,
|
||||
|
@ -285,7 +286,7 @@ func TestTimeMetrics(t *testing.T) {
|
|||
|
||||
func getCurrentGaugeValuesFor(t *testing.T, reg prometheus.Gatherer, metricNames ...string) map[string]float64 {
|
||||
f, err := reg.Gather()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
res := make(map[string]float64, len(metricNames))
|
||||
for _, g := range f {
|
||||
|
@ -294,7 +295,7 @@ func getCurrentGaugeValuesFor(t *testing.T, reg prometheus.Gatherer, metricNames
|
|||
continue
|
||||
}
|
||||
|
||||
testutil.Equals(t, 1, len(g.GetMetric()))
|
||||
require.Equal(t, 1, len(g.GetMetric()))
|
||||
if _, ok := res[m]; ok {
|
||||
t.Error("expected only one metric family for", m)
|
||||
t.FailNow()
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type origin int
|
||||
|
@ -82,22 +82,22 @@ func (p *queryLogTest) waitForPrometheus() error {
|
|||
// then reloads the configuration if needed.
|
||||
func (p *queryLogTest) setQueryLog(t *testing.T, queryLogFile string) {
|
||||
err := p.configFile.Truncate(0)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = p.configFile.Seek(0, 0)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
if queryLogFile != "" {
|
||||
_, err = p.configFile.Write([]byte(fmt.Sprintf("global:\n query_log_file: %s\n", queryLogFile)))
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
_, err = p.configFile.Write([]byte(p.configuration()))
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// reloadConfig reloads the configuration using POST.
|
||||
func (p *queryLogTest) reloadConfig(t *testing.T) {
|
||||
r, err := http.Post(fmt.Sprintf("http://%s:%d%s/-/reload", p.host, p.port, p.prefix), "text/plain", nil)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 200, r.StatusCode)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 200, r.StatusCode)
|
||||
}
|
||||
|
||||
// query runs a query according to the test origin.
|
||||
|
@ -111,8 +111,8 @@ func (p *queryLogTest) query(t *testing.T) {
|
|||
p.prefix,
|
||||
url.QueryEscape("query_with_api"),
|
||||
))
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 200, r.StatusCode)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 200, r.StatusCode)
|
||||
case consoleOrigin:
|
||||
r, err := http.Get(fmt.Sprintf(
|
||||
"http://%s:%d%s/consoles/test.html",
|
||||
|
@ -120,8 +120,8 @@ func (p *queryLogTest) query(t *testing.T) {
|
|||
p.port,
|
||||
p.prefix,
|
||||
))
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 200, r.StatusCode)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 200, r.StatusCode)
|
||||
case ruleOrigin:
|
||||
time.Sleep(2 * time.Second)
|
||||
default:
|
||||
|
@ -147,15 +147,15 @@ func (p *queryLogTest) queryString() string {
|
|||
// test parameters.
|
||||
func (p *queryLogTest) validateLastQuery(t *testing.T, ql []queryLogLine) {
|
||||
q := ql[len(ql)-1]
|
||||
testutil.Equals(t, p.queryString(), q.Params.Query)
|
||||
require.Equal(t, p.queryString(), q.Params.Query)
|
||||
|
||||
switch p.origin {
|
||||
case apiOrigin:
|
||||
testutil.Equals(t, 5, q.Params.Step)
|
||||
testutil.Equals(t, "1970-01-01T00:00:00.000Z", q.Params.Start)
|
||||
testutil.Equals(t, "1970-01-01T01:00:00.000Z", q.Params.End)
|
||||
require.Equal(t, 5, q.Params.Step)
|
||||
require.Equal(t, "1970-01-01T00:00:00.000Z", q.Params.Start)
|
||||
require.Equal(t, "1970-01-01T01:00:00.000Z", q.Params.End)
|
||||
default:
|
||||
testutil.Equals(t, 0, q.Params.Step)
|
||||
require.Equal(t, 0, q.Params.Step)
|
||||
}
|
||||
|
||||
if p.origin != ruleOrigin {
|
||||
|
@ -163,17 +163,17 @@ func (p *queryLogTest) validateLastQuery(t *testing.T, ql []queryLogLine) {
|
|||
if host == "[::1]" {
|
||||
host = "::1"
|
||||
}
|
||||
testutil.Equals(t, host, q.Request.ClientIP)
|
||||
require.Equal(t, host, q.Request.ClientIP)
|
||||
}
|
||||
|
||||
switch p.origin {
|
||||
case apiOrigin:
|
||||
testutil.Equals(t, p.prefix+"/api/v1/query_range", q.Request.Path)
|
||||
require.Equal(t, p.prefix+"/api/v1/query_range", q.Request.Path)
|
||||
case consoleOrigin:
|
||||
testutil.Equals(t, p.prefix+"/consoles/test.html", q.Request.Path)
|
||||
require.Equal(t, p.prefix+"/consoles/test.html", q.Request.Path)
|
||||
case ruleOrigin:
|
||||
testutil.Equals(t, "querylogtest", q.RuleGroup.Name)
|
||||
testutil.Equals(t, filepath.Join(p.cwd, "testdata", "rules", "test.yml"), q.RuleGroup.File)
|
||||
require.Equal(t, "querylogtest", q.RuleGroup.Name)
|
||||
require.Equal(t, filepath.Join(p.cwd, "testdata", "rules", "test.yml"), q.RuleGroup.File)
|
||||
default:
|
||||
panic("unknown origin")
|
||||
}
|
||||
|
@ -234,10 +234,10 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
|
||||
// Setup temporary files for this test.
|
||||
queryLogFile, err := ioutil.TempFile("", "query")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer os.Remove(queryLogFile.Name())
|
||||
p.configFile, err = ioutil.TempFile("", "config")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer os.Remove(p.configFile.Name())
|
||||
|
||||
if p.enabledAtStart {
|
||||
|
@ -247,9 +247,9 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
}
|
||||
|
||||
dir, err := ioutil.TempDir("", "query_log_test")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
testutil.Ok(t, os.RemoveAll(dir))
|
||||
require.NoError(t, os.RemoveAll(dir))
|
||||
}()
|
||||
|
||||
params := append([]string{
|
||||
|
@ -264,7 +264,7 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
|
||||
// Log stderr in case of failure.
|
||||
stderr, err := prom.StderrPipe()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
// We use a WaitGroup to avoid calling t.Log after the test is done.
|
||||
var wg sync.WaitGroup
|
||||
|
@ -276,17 +276,17 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
wg.Done()
|
||||
}()
|
||||
|
||||
testutil.Ok(t, prom.Start())
|
||||
require.NoError(t, prom.Start())
|
||||
|
||||
defer func() {
|
||||
prom.Process.Kill()
|
||||
prom.Wait()
|
||||
}()
|
||||
testutil.Ok(t, p.waitForPrometheus())
|
||||
require.NoError(t, p.waitForPrometheus())
|
||||
|
||||
if !p.enabledAtStart {
|
||||
p.query(t)
|
||||
testutil.Equals(t, 0, len(readQueryLog(t, queryLogFile.Name())))
|
||||
require.Equal(t, 0, len(readQueryLog(t, queryLogFile.Name())))
|
||||
p.setQueryLog(t, queryLogFile.Name())
|
||||
p.reloadConfig(t)
|
||||
}
|
||||
|
@ -296,9 +296,9 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
ql := readQueryLog(t, queryLogFile.Name())
|
||||
qc := len(ql)
|
||||
if p.exactQueryCount() {
|
||||
testutil.Equals(t, 1, qc)
|
||||
require.Equal(t, 1, qc)
|
||||
} else {
|
||||
testutil.Assert(t, qc > 0, "no queries logged")
|
||||
require.Greater(t, qc, 0, "no queries logged")
|
||||
}
|
||||
p.validateLastQuery(t, ql)
|
||||
|
||||
|
@ -311,7 +311,7 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
p.query(t)
|
||||
|
||||
ql = readQueryLog(t, queryLogFile.Name())
|
||||
testutil.Equals(t, qc, len(ql))
|
||||
require.Equal(t, qc, len(ql))
|
||||
|
||||
qc = len(ql)
|
||||
p.setQueryLog(t, queryLogFile.Name())
|
||||
|
@ -322,9 +322,9 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
|
||||
ql = readQueryLog(t, queryLogFile.Name())
|
||||
if p.exactQueryCount() {
|
||||
testutil.Equals(t, qc, len(ql))
|
||||
require.Equal(t, qc, len(ql))
|
||||
} else {
|
||||
testutil.Assert(t, len(ql) > qc, "no queries logged")
|
||||
require.Greater(t, len(ql), qc, "no queries logged")
|
||||
}
|
||||
p.validateLastQuery(t, ql)
|
||||
qc = len(ql)
|
||||
|
@ -336,13 +336,13 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
}
|
||||
// Move the file, Prometheus should still write to the old file.
|
||||
newFile, err := ioutil.TempFile("", "newLoc")
|
||||
testutil.Ok(t, err)
|
||||
testutil.Ok(t, newFile.Close())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, newFile.Close())
|
||||
defer os.Remove(newFile.Name())
|
||||
testutil.Ok(t, os.Rename(queryLogFile.Name(), newFile.Name()))
|
||||
require.NoError(t, os.Rename(queryLogFile.Name(), newFile.Name()))
|
||||
ql = readQueryLog(t, newFile.Name())
|
||||
if p.exactQueryCount() {
|
||||
testutil.Equals(t, qc, len(ql))
|
||||
require.Equal(t, qc, len(ql))
|
||||
}
|
||||
p.validateLastQuery(t, ql)
|
||||
qc = len(ql)
|
||||
|
@ -353,9 +353,9 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
|
||||
ql = readQueryLog(t, newFile.Name())
|
||||
if p.exactQueryCount() {
|
||||
testutil.Equals(t, qc, len(ql))
|
||||
require.Equal(t, qc, len(ql))
|
||||
} else {
|
||||
testutil.Assert(t, len(ql) > qc, "no queries logged")
|
||||
require.Greater(t, len(ql), qc, "no queries logged")
|
||||
}
|
||||
p.validateLastQuery(t, ql)
|
||||
|
||||
|
@ -366,9 +366,9 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
ql = readQueryLog(t, queryLogFile.Name())
|
||||
qc = len(ql)
|
||||
if p.exactQueryCount() {
|
||||
testutil.Equals(t, 1, qc)
|
||||
require.Equal(t, 1, qc)
|
||||
} else {
|
||||
testutil.Assert(t, qc > 0, "no queries logged")
|
||||
require.Greater(t, qc, 0, "no queries logged")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,12 +393,12 @@ type queryLogLine struct {
|
|||
func readQueryLog(t *testing.T, path string) []queryLogLine {
|
||||
ql := []queryLogLine{}
|
||||
file, err := os.Open(path)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer file.Close()
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
var q queryLogLine
|
||||
testutil.Ok(t, json.Unmarshal(scanner.Bytes(), &q))
|
||||
require.NoError(t, json.Unmarshal(scanner.Bytes(), &q))
|
||||
ql = append(ql, q)
|
||||
}
|
||||
return ql
|
||||
|
@ -410,7 +410,7 @@ func TestQueryLog(t *testing.T) {
|
|||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
port := 15000
|
||||
for _, host := range []string{"127.0.0.1", "[::1]"} {
|
||||
|
|
204
cmd/promtool/backfill.go
Normal file
204
cmd/promtool/backfill.go
Normal file
|
@ -0,0 +1,204 @@
|
|||
// Copyright 2020 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/common/expfmt"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/pkg/textparse"
|
||||
"github.com/prometheus/prometheus/tsdb"
|
||||
tsdb_errors "github.com/prometheus/prometheus/tsdb/errors"
|
||||
)
|
||||
|
||||
// OpenMetricsParser implements textparse.Parser.
|
||||
type OpenMetricsParser struct {
|
||||
textparse.Parser
|
||||
s *bufio.Scanner
|
||||
}
|
||||
|
||||
// NewOpenMetricsParser returns an OpenMetricsParser reading from the provided reader.
|
||||
func NewOpenMetricsParser(r io.Reader) *OpenMetricsParser {
|
||||
return &OpenMetricsParser{s: bufio.NewScanner(r)}
|
||||
}
|
||||
|
||||
// Next advances the parser to the next sample. It returns io.EOF if no
|
||||
// more samples were read.
|
||||
func (p *OpenMetricsParser) Next() (textparse.Entry, error) {
|
||||
for p.s.Scan() {
|
||||
line := p.s.Bytes()
|
||||
line = append(line, '\n')
|
||||
|
||||
p.Parser = textparse.New(line, string(expfmt.FmtOpenMetrics))
|
||||
if et, err := p.Parser.Next(); err != io.EOF {
|
||||
return et, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := p.s.Err(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
func getMinAndMaxTimestamps(p textparse.Parser) (int64, int64, error) {
|
||||
var maxt, mint int64 = math.MinInt64, math.MaxInt64
|
||||
|
||||
for {
|
||||
entry, err := p.Next()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return 0, 0, errors.Wrap(err, "next")
|
||||
}
|
||||
|
||||
if entry != textparse.EntrySeries {
|
||||
continue
|
||||
}
|
||||
|
||||
_, ts, _ := p.Series()
|
||||
if ts == nil {
|
||||
return 0, 0, errors.Errorf("expected timestamp for series got none")
|
||||
}
|
||||
|
||||
if *ts > maxt {
|
||||
maxt = *ts
|
||||
}
|
||||
if *ts < mint {
|
||||
mint = *ts
|
||||
}
|
||||
}
|
||||
|
||||
if maxt == math.MinInt64 {
|
||||
maxt = 0
|
||||
}
|
||||
if mint == math.MaxInt64 {
|
||||
mint = 0
|
||||
}
|
||||
|
||||
return maxt, mint, nil
|
||||
}
|
||||
|
||||
func createBlocks(input *os.File, mint, maxt int64, maxSamplesInAppender int, outputDir string) (returnErr error) {
|
||||
blockDuration := tsdb.DefaultBlockDuration
|
||||
mint = blockDuration * (mint / blockDuration)
|
||||
|
||||
db, err := tsdb.OpenDBReadOnly(outputDir, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
returnErr = tsdb_errors.NewMulti(returnErr, db.Close()).Err()
|
||||
}()
|
||||
|
||||
for t := mint; t <= maxt; t = t + blockDuration {
|
||||
err := func() error {
|
||||
w, err := tsdb.NewBlockWriter(log.NewNopLogger(), outputDir, blockDuration)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "block writer")
|
||||
}
|
||||
defer func() {
|
||||
err = tsdb_errors.NewMulti(err, w.Close()).Err()
|
||||
}()
|
||||
|
||||
if _, err := input.Seek(0, 0); err != nil {
|
||||
return errors.Wrap(err, "seek file")
|
||||
}
|
||||
ctx := context.Background()
|
||||
app := w.Appender(ctx)
|
||||
p := NewOpenMetricsParser(input)
|
||||
tsUpper := t + blockDuration
|
||||
samplesCount := 0
|
||||
for {
|
||||
e, err := p.Next()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "parse")
|
||||
}
|
||||
if e != textparse.EntrySeries {
|
||||
continue
|
||||
}
|
||||
|
||||
l := labels.Labels{}
|
||||
p.Metric(&l)
|
||||
_, ts, v := p.Series()
|
||||
if ts == nil {
|
||||
return errors.Errorf("expected timestamp for series %v, got none", l)
|
||||
}
|
||||
if *ts < t || *ts >= tsUpper {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, err := app.Add(l, *ts, v); err != nil {
|
||||
return errors.Wrap(err, "add sample")
|
||||
}
|
||||
|
||||
samplesCount++
|
||||
if samplesCount < maxSamplesInAppender {
|
||||
continue
|
||||
}
|
||||
|
||||
// If we arrive here, the samples count is greater than the maxSamplesInAppender.
|
||||
// Therefore the old appender is committed and a new one is created.
|
||||
// This prevents keeping too many samples lined up in an appender and thus in RAM.
|
||||
if err := app.Commit(); err != nil {
|
||||
return errors.Wrap(err, "commit")
|
||||
}
|
||||
|
||||
app = w.Appender(ctx)
|
||||
samplesCount = 0
|
||||
}
|
||||
if err := app.Commit(); err != nil {
|
||||
return errors.Wrap(err, "commit")
|
||||
}
|
||||
if _, err := w.Flush(ctx); err != nil && err != tsdb.ErrNoSeriesAppended {
|
||||
return errors.Wrap(err, "flush")
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "process blocks")
|
||||
}
|
||||
|
||||
blocks, err := db.Blocks()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get blocks")
|
||||
}
|
||||
if len(blocks) <= 0 {
|
||||
continue
|
||||
}
|
||||
printBlocks(blocks[len(blocks)-1:], true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func backfill(maxSamplesInAppender int, input *os.File, outputDir string) (err error) {
|
||||
p := NewOpenMetricsParser(input)
|
||||
maxt, mint, err := getMinAndMaxTimestamps(p)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "getting min and max timestamp")
|
||||
}
|
||||
return errors.Wrap(createBlocks(input, mint, maxt, maxSamplesInAppender, outputDir), "block creation")
|
||||
}
|
418
cmd/promtool/backfill_test.go
Normal file
418
cmd/promtool/backfill_test.go
Normal file
|
@ -0,0 +1,418 @@
|
|||
// Copyright 2020 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
"github.com/prometheus/prometheus/tsdb"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type backfillSample struct {
|
||||
Timestamp int64
|
||||
Value float64
|
||||
Labels labels.Labels
|
||||
}
|
||||
|
||||
func createTemporaryOpenMetricsFile(t *testing.T, text string) string {
|
||||
newf, err := ioutil.TempFile("", "")
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = newf.WriteString(text)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, newf.Close())
|
||||
|
||||
return newf.Name()
|
||||
}
|
||||
|
||||
func sortSamples(samples []backfillSample) {
|
||||
sort.Slice(samples, func(x, y int) bool {
|
||||
sx, sy := samples[x], samples[y]
|
||||
if sx.Timestamp != sy.Timestamp {
|
||||
return sx.Timestamp < sy.Timestamp
|
||||
}
|
||||
return sx.Value < sy.Value
|
||||
})
|
||||
}
|
||||
|
||||
func queryAllSeries(t testing.TB, q storage.Querier, expectedMinTime, expectedMaxTime int64) []backfillSample {
|
||||
ss := q.Select(false, nil, labels.MustNewMatcher(labels.MatchRegexp, "", ".*"))
|
||||
samples := []backfillSample{}
|
||||
for ss.Next() {
|
||||
series := ss.At()
|
||||
it := series.Iterator()
|
||||
require.NoError(t, it.Err())
|
||||
for it.Next() {
|
||||
ts, v := it.At()
|
||||
samples = append(samples, backfillSample{Timestamp: ts, Value: v, Labels: series.Labels()})
|
||||
}
|
||||
}
|
||||
return samples
|
||||
}
|
||||
|
||||
func testBlocks(t *testing.T, db *tsdb.DB, expectedMinTime, expectedMaxTime int64, expectedSamples []backfillSample, expectedNumBlocks int) {
|
||||
blocks := db.Blocks()
|
||||
require.Equal(t, expectedNumBlocks, len(blocks))
|
||||
|
||||
for _, block := range blocks {
|
||||
require.Equal(t, true, block.MinTime()/tsdb.DefaultBlockDuration == (block.MaxTime()-1)/tsdb.DefaultBlockDuration)
|
||||
}
|
||||
|
||||
q, err := db.Querier(context.Background(), math.MinInt64, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
require.NoError(t, q.Close())
|
||||
}()
|
||||
|
||||
allSamples := queryAllSeries(t, q, expectedMinTime, expectedMaxTime)
|
||||
sortSamples(allSamples)
|
||||
sortSamples(expectedSamples)
|
||||
require.Equal(t, expectedSamples, allSamples)
|
||||
|
||||
if len(allSamples) > 0 {
|
||||
require.Equal(t, expectedMinTime, allSamples[0].Timestamp)
|
||||
require.Equal(t, expectedMaxTime, allSamples[len(allSamples)-1].Timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBackfill(t *testing.T) {
|
||||
tests := []struct {
|
||||
ToParse string
|
||||
IsOk bool
|
||||
Description string
|
||||
MaxSamplesInAppender int
|
||||
Expected struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}
|
||||
}{
|
||||
{
|
||||
ToParse: `# EOF`,
|
||||
IsOk: true,
|
||||
Description: "Empty file.",
|
||||
MaxSamplesInAppender: 5000,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: math.MaxInt64,
|
||||
MaxTime: math.MinInt64,
|
||||
NumBlocks: 0,
|
||||
Samples: []backfillSample{},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP http_requests_total The total number of HTTP requests.
|
||||
# TYPE http_requests_total counter
|
||||
http_requests_total{code="200"} 1021 1565133713.989
|
||||
http_requests_total{code="400"} 1 1565133713.990
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "Multiple samples with different timestamp for different series.",
|
||||
MaxSamplesInAppender: 5000,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 1565133713989,
|
||||
MaxTime: 1565133713990,
|
||||
NumBlocks: 1,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 1565133713989,
|
||||
Value: 1021,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565133713990,
|
||||
Value: 1,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP http_requests_total The total number of HTTP requests.
|
||||
# TYPE http_requests_total counter
|
||||
http_requests_total{code="200"} 1021 1565133713.989
|
||||
http_requests_total{code="200"} 1 1565133714.989
|
||||
http_requests_total{code="400"} 2 1565133715.989
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "Multiple samples with different timestamp for the same series.",
|
||||
MaxSamplesInAppender: 5000,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 1565133713989,
|
||||
MaxTime: 1565133715989,
|
||||
NumBlocks: 1,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 1565133713989,
|
||||
Value: 1021,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565133714989,
|
||||
Value: 1,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565133715989,
|
||||
Value: 2,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP http_requests_total The total number of HTTP requests.
|
||||
# TYPE http_requests_total counter
|
||||
http_requests_total{code="200"} 1021 1565133713.989
|
||||
http_requests_total{code="200"} 1022 1565144513.989
|
||||
http_requests_total{code="400"} 2 1565155313.989
|
||||
http_requests_total{code="400"} 1 1565166113.989
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "Multiple samples that end up in different blocks.",
|
||||
MaxSamplesInAppender: 5000,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 1565133713989,
|
||||
MaxTime: 1565166113989,
|
||||
NumBlocks: 4,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 1565133713989,
|
||||
Value: 1021,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565144513989,
|
||||
Value: 1022,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565155313989,
|
||||
Value: 2,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565166113989,
|
||||
Value: 1,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP http_requests_total The total number of HTTP requests.
|
||||
# TYPE http_requests_total counter
|
||||
http_requests_total{code="200"} 1021 1565133713.989
|
||||
http_requests_total{code="200"} 1022 1565133714
|
||||
http_requests_total{code="200"} 1023 1565133716
|
||||
http_requests_total{code="200"} 1022 1565144513.989
|
||||
http_requests_total{code="400"} 2 1565155313.989
|
||||
http_requests_total{code="400"} 3 1565155314
|
||||
http_requests_total{code="400"} 1 1565166113.989
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "Number of samples are greater than the sample batch size.",
|
||||
MaxSamplesInAppender: 2,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 1565133713989,
|
||||
MaxTime: 1565166113989,
|
||||
NumBlocks: 4,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 1565133713989,
|
||||
Value: 1021,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565133714000,
|
||||
Value: 1022,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565133716000,
|
||||
Value: 1023,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565144513989,
|
||||
Value: 1022,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565155313989,
|
||||
Value: 2,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565155314000,
|
||||
Value: 3,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
{
|
||||
Timestamp: 1565166113989,
|
||||
Value: 1,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `no_help_no_type{foo="bar"} 42 6900
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "Sample with no #HELP or #TYPE keyword.",
|
||||
MaxSamplesInAppender: 5000,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 6900000,
|
||||
MaxTime: 6900000,
|
||||
NumBlocks: 1,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 6900000,
|
||||
Value: 42,
|
||||
Labels: labels.FromStrings("__name__", "no_help_no_type", "foo", "bar"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `bare_metric 42.24 1001
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "Bare sample.",
|
||||
MaxSamplesInAppender: 5000,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 1001000,
|
||||
MaxTime: 1001000,
|
||||
NumBlocks: 1,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 1001000,
|
||||
Value: 42.24,
|
||||
Labels: labels.FromStrings("__name__", "bare_metric"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP rpc_duration_seconds A summary of the RPC duration in seconds.
|
||||
# TYPE rpc_duration_seconds summary
|
||||
rpc_duration_seconds{quantile="0.01"} 3102
|
||||
rpc_duration_seconds{quantile="0.05"} 3272
|
||||
# EOF
|
||||
`,
|
||||
IsOk: false,
|
||||
Description: "Does not have timestamp.",
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP bad_metric This a bad metric
|
||||
# TYPE bad_metric bad_type
|
||||
bad_metric{type="has a bad type information"} 0.0 111
|
||||
# EOF
|
||||
`,
|
||||
IsOk: false,
|
||||
Description: "Has a bad type information.",
|
||||
},
|
||||
{
|
||||
ToParse: `# HELP no_nl This test has no newline so will fail
|
||||
# TYPE no_nl gauge
|
||||
no_nl{type="no newline"}
|
||||
# EOF
|
||||
`,
|
||||
IsOk: false,
|
||||
Description: "No newline.",
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Logf("Test:%s", test.Description)
|
||||
|
||||
openMetricsFile := createTemporaryOpenMetricsFile(t, test.ToParse)
|
||||
input, err := os.Open(openMetricsFile)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
require.NoError(t, input.Close())
|
||||
}()
|
||||
|
||||
outputDir, err := ioutil.TempDir("", "myDir")
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
require.NoError(t, os.RemoveAll(outputDir))
|
||||
}()
|
||||
|
||||
err = backfill(test.MaxSamplesInAppender, input, outputDir)
|
||||
|
||||
if !test.IsOk {
|
||||
require.Error(t, err, test.Description)
|
||||
continue
|
||||
}
|
||||
|
||||
require.NoError(t, err)
|
||||
db, err := tsdb.Open(outputDir, nil, nil, tsdb.DefaultOptions())
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
require.NoError(t, db.Close())
|
||||
}()
|
||||
|
||||
testBlocks(t, db, test.Expected.MinTime, test.Expected.MaxTime, test.Expected.Samples, test.Expected.NumBlocks)
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@ import (
|
|||
|
||||
"github.com/prometheus/prometheus/config"
|
||||
"github.com/prometheus/prometheus/discovery/file"
|
||||
_ "github.com/prometheus/prometheus/discovery/install" // Register service discovery implementations.
|
||||
"github.com/prometheus/prometheus/discovery/kubernetes"
|
||||
"github.com/prometheus/prometheus/pkg/rulefmt"
|
||||
"github.com/prometheus/prometheus/tsdb"
|
||||
|
@ -136,16 +137,20 @@ func main() {
|
|||
dumpMinTime := tsdbDumpCmd.Flag("min-time", "Minimum timestamp to dump.").Default(strconv.FormatInt(math.MinInt64, 10)).Int64()
|
||||
dumpMaxTime := tsdbDumpCmd.Flag("max-time", "Maximum timestamp to dump.").Default(strconv.FormatInt(math.MaxInt64, 10)).Int64()
|
||||
|
||||
createBlocksFromCmd := tsdbCmd.Command("create-blocks-from", "Create blocks from new input data.")
|
||||
createBlocksFromRulesCmd := createBlocksFromCmd.Command("rules", "Create new blocks of data from Prometheus data for new rules.")
|
||||
createBlocksFromRulesStart := createBlocksFromRulesCmd.Flag("start", "The time to start backfilling the new rule from. It is required. Start time should be RFC3339 or Unix timestamp.").
|
||||
importCmd := tsdbCmd.Command("create-blocks-from", "[Experimental] Import samples from input and produce TSDB blocks. Please refer to the storage docs for more details.")
|
||||
openMetricsImportCmd := importCmd.Command("openmetrics", "Import samples from OpenMetrics input and produce TSDB blocks. Please refer to the storage docs for more details.")
|
||||
// TODO(aSquare14): add flag to set default block duration
|
||||
importFilePath := openMetricsImportCmd.Arg("input file", "OpenMetrics file to read samples from.").Required().String()
|
||||
importDBPath := openMetricsImportCmd.Arg("output directory", "Output directory for generated blocks.").Default(defaultDBPath).String()
|
||||
importRulesCmd := importCmd.Command("rules", "Create new blocks of data from Prometheus data for new rules.")
|
||||
importRulesStart := importRulesCmd.Flag("start", "The time to start backfilling the new rule from. It is required. Start time should be RFC3339 or Unix timestamp.").
|
||||
Required().String()
|
||||
createBlocksFromRulesEnd := createBlocksFromRulesCmd.Flag("end", "If an end time is provided, all recording rules in the rule files provided will be backfilled to the end time. Default will backfill up to 3 hrs ago. End time should be RFC3339 or Unix timestamp.").String()
|
||||
createBlocksFromRulesOutputDir := createBlocksFromRulesCmd.Flag("output dir", "The filepath on the local filesystem to write the output to. Output will be blocks containing the data of the backfilled recording rules. Don't use an active Prometheus data directory. If command is run many times with same start/end time, it will create duplicate series.").Default("backfilldata/").String()
|
||||
createBlocksFromRulesURL := createBlocksFromRulesCmd.Flag("url", "Prometheus API url with the data where the rule will be backfilled from.").Default("http://localhost:9090").String()
|
||||
createBlocksFromRulesEvalInterval := createBlocksFromRulesCmd.Flag("evaluation-interval-default", "How frequently to evaluate rules when backfilling if a value is not set in the rules file.").
|
||||
importRulesEnd := importRulesCmd.Flag("end", "If an end time is provided, all recording rules in the rule files provided will be backfilled to the end time. Default will backfill up to 3 hrs ago. End time should be RFC3339 or Unix timestamp.").String()
|
||||
importRulesOutputDir := importRulesCmd.Flag("output dir", "The filepath on the local filesystem to write the output to. Output will be blocks containing the data of the backfilled recording rules. Don't use an active Prometheus data directory. If command is run many times with same start/end time, it will create duplicate series.").Default("backfilldata/").String()
|
||||
importRulesURL := importRulesCmd.Flag("url", "Prometheus API url with the data where the rule will be backfilled from.").Default("http://localhost:9090").String()
|
||||
importRulesEvalInterval := importRulesCmd.Flag("evaluation-interval-default", "How frequently to evaluate rules when backfilling if a value is not set in the rules file.").
|
||||
Default("60s").Duration()
|
||||
createBlocksFromRulesFiles := createBlocksFromRulesCmd.Arg(
|
||||
importRulesFiles := importRulesCmd.Arg(
|
||||
"rule-files",
|
||||
"A list of one or more files containing recording rules to be backfilled. All recording rules listed in the files will be backfilled. Alerting rules are not evaluated.",
|
||||
).Required().ExistingFiles()
|
||||
|
@ -206,8 +211,12 @@ func main() {
|
|||
case tsdbDumpCmd.FullCommand():
|
||||
os.Exit(checkErr(dumpSamples(*dumpPath, *dumpMinTime, *dumpMaxTime)))
|
||||
|
||||
case createBlocksFromRulesCmd.FullCommand():
|
||||
os.Exit(checkErr(CreateBlocksFromRules(*createBlocksFromRulesURL, *createBlocksFromRulesStart, *createBlocksFromRulesEnd, *createBlocksFromRulesOutputDir, *createBlocksFromRulesEvalInterval, *createBlocksFromRulesFiles...)))
|
||||
//TODO(aSquare14): Work on adding support for custom block size.
|
||||
case openMetricsImportCmd.FullCommand():
|
||||
os.Exit(checkErr(backfillOpenMetrics(*importFilePath, *importDBPath)))
|
||||
|
||||
case importRulesCmd.FullCommand():
|
||||
os.Exit(checkErr(ImportRules(*importRulesURL, *importRulesStart, *importRulesEnd, *importRulesOutputDir, *importRulesEvalInterval, *importRulesFiles...)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,9 +792,9 @@ func (j *jsonPrinter) printLabelValues(v model.LabelValues) {
|
|||
json.NewEncoder(os.Stdout).Encode(v)
|
||||
}
|
||||
|
||||
// CreateBlocksFromRules backfills recording rules from the files provided. The output are blocks of data
|
||||
// ImportRules backfills recording rules from the files provided. The output are blocks of data
|
||||
// at the outputDir location.
|
||||
func CreateBlocksFromRules(url, start, end, outputDir string, evalInterval time.Duration, files ...string) error {
|
||||
func ImportRules(url, start, end, outputDir string, evalInterval time.Duration, files ...string) error {
|
||||
ctx := context.Background()
|
||||
var stime, etime time.Time
|
||||
var err error
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestQueryRange(t *testing.T) {
|
||||
|
@ -29,18 +29,18 @@ func TestQueryRange(t *testing.T) {
|
|||
|
||||
p := &promqlPrinter{}
|
||||
exitCode := QueryRange(s.URL, map[string]string{}, "up", "0", "300", 0, p)
|
||||
testutil.Equals(t, "/api/v1/query_range", getRequest().URL.Path)
|
||||
require.Equal(t, "/api/v1/query_range", getRequest().URL.Path)
|
||||
form := getRequest().Form
|
||||
testutil.Equals(t, "up", form.Get("query"))
|
||||
testutil.Equals(t, "1", form.Get("step"))
|
||||
testutil.Equals(t, 0, exitCode)
|
||||
require.Equal(t, "up", form.Get("query"))
|
||||
require.Equal(t, "1", form.Get("step"))
|
||||
require.Equal(t, 0, exitCode)
|
||||
|
||||
exitCode = QueryRange(s.URL, map[string]string{}, "up", "0", "300", 10*time.Millisecond, p)
|
||||
testutil.Equals(t, "/api/v1/query_range", getRequest().URL.Path)
|
||||
require.Equal(t, "/api/v1/query_range", getRequest().URL.Path)
|
||||
form = getRequest().Form
|
||||
testutil.Equals(t, "up", form.Get("query"))
|
||||
testutil.Equals(t, "0.01", form.Get("step"))
|
||||
testutil.Equals(t, 0, exitCode)
|
||||
require.Equal(t, "up", form.Get("query"))
|
||||
require.Equal(t, "0.01", form.Get("step"))
|
||||
require.Equal(t, 0, exitCode)
|
||||
}
|
||||
|
||||
func TestQueryInstant(t *testing.T) {
|
||||
|
@ -49,11 +49,11 @@ func TestQueryInstant(t *testing.T) {
|
|||
|
||||
p := &promqlPrinter{}
|
||||
exitCode := QueryInstant(s.URL, "up", "300", p)
|
||||
testutil.Equals(t, "/api/v1/query", getRequest().URL.Path)
|
||||
require.Equal(t, "/api/v1/query", getRequest().URL.Path)
|
||||
form := getRequest().Form
|
||||
testutil.Equals(t, "up", form.Get("query"))
|
||||
testutil.Equals(t, "300", form.Get("time"))
|
||||
testutil.Equals(t, 0, exitCode)
|
||||
require.Equal(t, "up", form.Get("query"))
|
||||
require.Equal(t, "300", form.Get("time"))
|
||||
require.Equal(t, 0, exitCode)
|
||||
}
|
||||
|
||||
func mockServer(code int, body string) (*httptest.Server, func() *http.Request) {
|
||||
|
|
4
cmd/promtool/testdata/bad-input-series.yml
vendored
Normal file
4
cmd/promtool/testdata/bad-input-series.yml
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
tests:
|
||||
- input_series:
|
||||
- series: 'up{job="prometheus", instance="localhost:9090"'
|
||||
values: "0+0x1440"
|
12
cmd/promtool/testdata/bad-promql.yml
vendored
Normal file
12
cmd/promtool/testdata/bad-promql.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
tests:
|
||||
- input_series:
|
||||
- series: 'join_1{a="1",b="2"}'
|
||||
values: 1
|
||||
- series: 'join_2{a="1",b="3"}'
|
||||
values: 2
|
||||
- series: 'join_2{a="1",b="4"}'
|
||||
values: 3
|
||||
|
||||
promql_expr_test:
|
||||
# This PromQL generates an error.
|
||||
- expr: "join_1 + on(a) join_2"
|
14
cmd/promtool/testdata/bad-rules-error-test.yml
vendored
Normal file
14
cmd/promtool/testdata/bad-rules-error-test.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
rule_files:
|
||||
- bad-rules-error.yml
|
||||
|
||||
tests:
|
||||
- input_series:
|
||||
- series: 'join_1{a="1",b="2"}'
|
||||
values: 1
|
||||
- series: 'join_2{a="1",b="3"}'
|
||||
values: 2
|
||||
- series: 'join_2{a="1",b="4"}'
|
||||
values: 3
|
||||
|
||||
# Just the existance of the data, that can't be joined, makes the recording
|
||||
# rules error.
|
7
cmd/promtool/testdata/bad-rules-error.yml
vendored
Normal file
7
cmd/promtool/testdata/bad-rules-error.yml
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This is the rules file for bad-rules-error-test.yml.
|
||||
|
||||
groups:
|
||||
- name: bad-example
|
||||
rules:
|
||||
- record: joined
|
||||
expr: join_1 + on(a) join_2
|
6
cmd/promtool/testdata/bad-rules-syntax-test.yml
vendored
Normal file
6
cmd/promtool/testdata/bad-rules-syntax-test.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
rule_files:
|
||||
- bad-rules-syntax.yml
|
||||
|
||||
tests:
|
||||
# Need a test to ensure the recording rules actually run.
|
||||
- {}
|
7
cmd/promtool/testdata/bad-rules-syntax.yml
vendored
Normal file
7
cmd/promtool/testdata/bad-rules-syntax.yml
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This is the rules file for bad-rules-syntax-test.yml.
|
||||
|
||||
groups:
|
||||
- name: bad-syntax
|
||||
rules:
|
||||
- record: x
|
||||
expr: 'test +'
|
19
cmd/promtool/testdata/failing.yml
vendored
Normal file
19
cmd/promtool/testdata/failing.yml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
tests:
|
||||
# Simple failing test.
|
||||
- interval: 1m
|
||||
input_series:
|
||||
- series: test
|
||||
values: '0'
|
||||
|
||||
promql_expr_test:
|
||||
- expr: test
|
||||
eval_time: 0m
|
||||
exp_samples:
|
||||
- value: 1
|
||||
labels: test
|
||||
|
||||
alert_rule_test:
|
||||
- eval_time: 0m
|
||||
alertname: Test
|
||||
exp_alerts:
|
||||
- exp_labels: {}
|
|
@ -1,7 +1,7 @@
|
|||
# This is the rules file.
|
||||
|
||||
groups:
|
||||
- name: example
|
||||
- name: alerts
|
||||
rules:
|
||||
- alert: InstanceDown
|
||||
expr: up == 0
|
||||
|
@ -11,3 +11,12 @@ groups:
|
|||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} down"
|
||||
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
|
||||
|
||||
- name: rules
|
||||
rules:
|
||||
- record: job:test:count_over_time1m
|
||||
expr: sum without(instance) (count_over_time(test[1m]))
|
||||
|
||||
# A recording rule that doesn't depend on input series.
|
||||
- record: fixed_data
|
||||
expr: 1
|
114
cmd/promtool/testdata/unittest.yml
vendored
114
cmd/promtool/testdata/unittest.yml
vendored
|
@ -1,9 +1,79 @@
|
|||
rule_files:
|
||||
- alerts.yml
|
||||
- rules.yml
|
||||
|
||||
evaluation_interval: 1m
|
||||
|
||||
tests:
|
||||
# Basic tests for promql_expr_test, not dependent on rules.
|
||||
- interval: 1m
|
||||
input_series:
|
||||
- series: test_full
|
||||
values: '0 0'
|
||||
|
||||
- series: test_stale
|
||||
values: '0 stale'
|
||||
|
||||
- series: test_missing
|
||||
values: '0 _ _ _ _ _ _ 0'
|
||||
|
||||
promql_expr_test:
|
||||
# Ensure the sample is evaluated at the time we expect it to be.
|
||||
- expr: timestamp(test_full)
|
||||
eval_time: 0m
|
||||
exp_samples:
|
||||
- value: 0
|
||||
- expr: timestamp(test_full)
|
||||
eval_time: 1m
|
||||
exp_samples:
|
||||
- value: 60
|
||||
- expr: timestamp(test_full)
|
||||
eval_time: 2m
|
||||
exp_samples:
|
||||
- value: 60
|
||||
|
||||
# Ensure a value is stale as soon as it is marked as such.
|
||||
- expr: test_stale
|
||||
eval_time: 59s
|
||||
exp_samples:
|
||||
- value: 0
|
||||
labels: 'test_stale'
|
||||
- expr: test_stale
|
||||
eval_time: 1m
|
||||
exp_samples: []
|
||||
|
||||
# Ensure lookback delta is respected, when a value is missing.
|
||||
- expr: timestamp(test_missing)
|
||||
eval_time: 5m
|
||||
exp_samples:
|
||||
- value: 0
|
||||
- expr: timestamp(test_missing)
|
||||
eval_time: 5m1s
|
||||
exp_samples: []
|
||||
|
||||
# Minimal test case to check edge case of a single sample.
|
||||
- input_series:
|
||||
- series: test
|
||||
values: 1
|
||||
|
||||
promql_expr_test:
|
||||
- expr: test
|
||||
eval_time: 0
|
||||
exp_samples:
|
||||
- value: 1
|
||||
labels: test
|
||||
|
||||
# Test recording rules run even if input_series isn't provided.
|
||||
- promql_expr_test:
|
||||
- expr: count_over_time(fixed_data[1h])
|
||||
eval_time: 1h
|
||||
exp_samples:
|
||||
- value: 61
|
||||
- expr: timestamp(fixed_data)
|
||||
eval_time: 1h
|
||||
exp_samples:
|
||||
- value: 3600
|
||||
|
||||
# Tests for alerting rules.
|
||||
- interval: 1m
|
||||
input_series:
|
||||
- series: 'up{job="prometheus", instance="localhost:9090"}'
|
||||
|
@ -27,3 +97,45 @@ tests:
|
|||
exp_annotations:
|
||||
summary: "Instance localhost:9090 down"
|
||||
description: "localhost:9090 of job prometheus has been down for more than 5 minutes."
|
||||
|
||||
# Tests for interval vs evaluation_interval.
|
||||
- interval: 1s
|
||||
input_series:
|
||||
- series: 'test{job="test", instance="x:0"}'
|
||||
# 2 minutes + 1 second of input data, recording rules should only run
|
||||
# once a minute.
|
||||
values: '0+1x120'
|
||||
|
||||
promql_expr_test:
|
||||
- expr: job:test:count_over_time1m
|
||||
eval_time: 0m
|
||||
exp_samples:
|
||||
- value: 1
|
||||
labels: 'job:test:count_over_time1m{job="test"}'
|
||||
- expr: timestamp(job:test:count_over_time1m)
|
||||
eval_time: 10s
|
||||
exp_samples:
|
||||
- value: 0
|
||||
labels: '{job="test"}'
|
||||
|
||||
- expr: job:test:count_over_time1m
|
||||
eval_time: 1m
|
||||
exp_samples:
|
||||
- value: 61
|
||||
labels: 'job:test:count_over_time1m{job="test"}'
|
||||
- expr: timestamp(job:test:count_over_time1m)
|
||||
eval_time: 1m10s
|
||||
exp_samples:
|
||||
- value: 60
|
||||
labels: '{job="test"}'
|
||||
|
||||
- expr: job:test:count_over_time1m
|
||||
eval_time: 2m
|
||||
exp_samples:
|
||||
- value: 61
|
||||
labels: 'job:test:count_over_time1m{job="test"}'
|
||||
- expr: timestamp(job:test:count_over_time1m)
|
||||
eval_time: 2m59s999ms
|
||||
exp_samples:
|
||||
- value: 120
|
||||
labels: '{job="test"}'
|
||||
|
|
|
@ -33,6 +33,7 @@ import (
|
|||
"github.com/alecthomas/units"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
"github.com/prometheus/prometheus/tsdb"
|
||||
|
@ -40,8 +41,6 @@ import (
|
|||
tsdb_errors "github.com/prometheus/prometheus/tsdb/errors"
|
||||
)
|
||||
|
||||
var merr tsdb_errors.MultiError
|
||||
|
||||
const timeDelta = 30000
|
||||
|
||||
type writeBenchmark struct {
|
||||
|
@ -348,9 +347,7 @@ func listBlocks(path string, humanReadable bool) error {
|
|||
return err
|
||||
}
|
||||
defer func() {
|
||||
merr.Add(err)
|
||||
merr.Add(db.Close())
|
||||
err = merr.Err()
|
||||
err = tsdb_errors.NewMulti(err, db.Close()).Err()
|
||||
}()
|
||||
blocks, err := db.Blocks()
|
||||
if err != nil {
|
||||
|
@ -428,9 +425,7 @@ func analyzeBlock(path, blockID string, limit int) error {
|
|||
return err
|
||||
}
|
||||
defer func() {
|
||||
merr.Add(err)
|
||||
merr.Add(db.Close())
|
||||
err = merr.Err()
|
||||
err = tsdb_errors.NewMulti(err, db.Close()).Err()
|
||||
}()
|
||||
|
||||
meta := block.Meta()
|
||||
|
@ -578,9 +573,7 @@ func dumpSamples(path string, mint, maxt int64) (err error) {
|
|||
return err
|
||||
}
|
||||
defer func() {
|
||||
merr.Add(err)
|
||||
merr.Add(db.Close())
|
||||
err = merr.Err()
|
||||
err = tsdb_errors.NewMulti(err, db.Close()).Err()
|
||||
}()
|
||||
q, err := db.Querier(context.TODO(), mint, maxt)
|
||||
if err != nil {
|
||||
|
@ -604,11 +597,7 @@ func dumpSamples(path string, mint, maxt int64) (err error) {
|
|||
}
|
||||
|
||||
if ws := ss.Warnings(); len(ws) > 0 {
|
||||
var merr tsdb_errors.MultiError
|
||||
for _, w := range ws {
|
||||
merr.Add(w)
|
||||
}
|
||||
return merr.Err()
|
||||
return tsdb_errors.NewMulti(ws...).Err()
|
||||
}
|
||||
|
||||
if ss.Err() != nil {
|
||||
|
@ -624,3 +613,14 @@ func checkErr(err error) int {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func backfillOpenMetrics(path string, outputDir string) (err error) {
|
||||
input, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
input.Close()
|
||||
}()
|
||||
return backfill(5000, input, outputDir)
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ import (
|
|||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/common/model"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
|
@ -80,13 +80,7 @@ func ruleUnitTest(filename string) []error {
|
|||
unitTestInp.EvaluationInterval = model.Duration(1 * time.Minute)
|
||||
}
|
||||
|
||||
// Bounds for evaluating the rules.
|
||||
mint := time.Unix(0, 0).UTC()
|
||||
maxd := unitTestInp.maxEvalTime()
|
||||
maxt := mint.Add(maxd)
|
||||
evalInterval := time.Duration(unitTestInp.EvaluationInterval)
|
||||
// Rounding off to nearest Eval time (> maxt).
|
||||
maxt = maxt.Add(evalInterval / 2).Round(evalInterval)
|
||||
|
||||
// Giving number for groups mentioned in the file for ordering.
|
||||
// Lower number group should be evaluated before higher number group.
|
||||
|
@ -101,8 +95,7 @@ func ruleUnitTest(filename string) []error {
|
|||
// Testing.
|
||||
var errs []error
|
||||
for _, t := range unitTestInp.Tests {
|
||||
ers := t.test(mint, maxt, evalInterval, groupOrderMap,
|
||||
unitTestInp.RuleFiles...)
|
||||
ers := t.test(evalInterval, groupOrderMap, unitTestInp.RuleFiles...)
|
||||
if ers != nil {
|
||||
errs = append(errs, ers...)
|
||||
}
|
||||
|
@ -122,17 +115,6 @@ type unitTestFile struct {
|
|||
Tests []testGroup `yaml:"tests"`
|
||||
}
|
||||
|
||||
func (utf *unitTestFile) maxEvalTime() time.Duration {
|
||||
var maxd time.Duration
|
||||
for _, t := range utf.Tests {
|
||||
d := t.maxEvalTime()
|
||||
if d > maxd {
|
||||
maxd = d
|
||||
}
|
||||
}
|
||||
return maxd
|
||||
}
|
||||
|
||||
// resolveAndGlobFilepaths joins all relative paths in a configuration
|
||||
// with a given base directory and replaces all globs with matching files.
|
||||
func resolveAndGlobFilepaths(baseDir string, utf *unitTestFile) error {
|
||||
|
@ -167,7 +149,7 @@ type testGroup struct {
|
|||
}
|
||||
|
||||
// test performs the unit tests.
|
||||
func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, groupOrderMap map[string]int, ruleFiles ...string) []error {
|
||||
func (tg *testGroup) test(evalInterval time.Duration, groupOrderMap map[string]int, ruleFiles ...string) []error {
|
||||
// Setup testing suite.
|
||||
suite, err := promql.NewLazyLoader(nil, tg.seriesLoadingString())
|
||||
if err != nil {
|
||||
|
@ -190,6 +172,10 @@ func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, grou
|
|||
}
|
||||
groups := orderedGroups(groupsMap, groupOrderMap)
|
||||
|
||||
// Bounds for evaluating the rules.
|
||||
mint := time.Unix(0, 0).UTC()
|
||||
maxt := mint.Add(tg.maxEvalTime())
|
||||
|
||||
// Pre-processing some data for testing alerts.
|
||||
// All this preparation is so that we can test alerts as we evaluate the rules.
|
||||
// This avoids storing them in memory, as the number of evals might be high.
|
||||
|
@ -232,7 +218,7 @@ func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, grou
|
|||
}
|
||||
|
||||
var errs []error
|
||||
for ts := mint; ts.Before(maxt); ts = ts.Add(evalInterval) {
|
||||
for ts := mint; ts.Before(maxt) || ts.Equal(maxt); ts = ts.Add(evalInterval) {
|
||||
// Collects the alerts asked for unit testing.
|
||||
suite.WithSamplesTill(ts, func(err error) {
|
||||
if err != nil {
|
||||
|
|
|
@ -31,6 +31,41 @@ func TestRulesUnitTest(t *testing.T) {
|
|||
},
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "Bad input series",
|
||||
args: args{
|
||||
files: []string{"./testdata/bad-input-series.yml"},
|
||||
},
|
||||
want: 1,
|
||||
},
|
||||
{
|
||||
name: "Bad PromQL",
|
||||
args: args{
|
||||
files: []string{"./testdata/bad-promql.yml"},
|
||||
},
|
||||
want: 1,
|
||||
},
|
||||
{
|
||||
name: "Bad rules (syntax error)",
|
||||
args: args{
|
||||
files: []string{"./testdata/bad-rules-syntax-test.yml"},
|
||||
},
|
||||
want: 1,
|
||||
},
|
||||
{
|
||||
name: "Bad rules (error evaluating)",
|
||||
args: args{
|
||||
files: []string{"./testdata/bad-rules-error-test.yml"},
|
||||
},
|
||||
want: 1,
|
||||
},
|
||||
{
|
||||
name: "Simple failing test",
|
||||
args: args{
|
||||
files: []string{"./testdata/failing.yml"},
|
||||
},
|
||||
want: 1,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
@ -98,8 +98,9 @@ var (
|
|||
|
||||
// DefaultRemoteWriteConfig is the default remote write configuration.
|
||||
DefaultRemoteWriteConfig = RemoteWriteConfig{
|
||||
RemoteTimeout: model.Duration(30 * time.Second),
|
||||
QueueConfig: DefaultQueueConfig,
|
||||
RemoteTimeout: model.Duration(30 * time.Second),
|
||||
QueueConfig: DefaultQueueConfig,
|
||||
MetadataConfig: DefaultMetadataConfig,
|
||||
}
|
||||
|
||||
// DefaultQueueConfig is the default remote queue configuration.
|
||||
|
@ -121,6 +122,12 @@ var (
|
|||
MaxBackoff: model.Duration(100 * time.Millisecond),
|
||||
}
|
||||
|
||||
// DefaultMetadataConfig is the default metadata configuration for a remote write endpoint.
|
||||
DefaultMetadataConfig = MetadataConfig{
|
||||
Send: true,
|
||||
SendInterval: model.Duration(1 * time.Minute),
|
||||
}
|
||||
|
||||
// DefaultRemoteReadConfig is the default remote read configuration.
|
||||
DefaultRemoteReadConfig = RemoteReadConfig{
|
||||
RemoteTimeout: model.Duration(1 * time.Minute),
|
||||
|
@ -570,6 +577,7 @@ type RemoteWriteConfig struct {
|
|||
// values arbitrarily into the overflow maps of further-down types.
|
||||
HTTPClientConfig config.HTTPClientConfig `yaml:",inline"`
|
||||
QueueConfig QueueConfig `yaml:"queue_config,omitempty"`
|
||||
MetadataConfig MetadataConfig `yaml:"metadata_config,omitempty"`
|
||||
}
|
||||
|
||||
// SetDirectory joins any relative file paths with dir.
|
||||
|
@ -623,6 +631,15 @@ type QueueConfig struct {
|
|||
MaxBackoff model.Duration `yaml:"max_backoff,omitempty"`
|
||||
}
|
||||
|
||||
// MetadataConfig is the configuration for sending metadata to remote
|
||||
// storage.
|
||||
type MetadataConfig struct {
|
||||
// Send controls whether we send metric metadata to remote storage.
|
||||
Send bool `yaml:"send"`
|
||||
// SendInterval controls how frequently we send metric metadata.
|
||||
SendInterval model.Duration `yaml:"send_interval"`
|
||||
}
|
||||
|
||||
// RemoteReadConfig is the configuration for reading from remote storage.
|
||||
type RemoteReadConfig struct {
|
||||
URL *config.URL `yaml:"url"`
|
||||
|
|
|
@ -19,12 +19,12 @@ import (
|
|||
"net/url"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery"
|
||||
|
@ -45,7 +45,6 @@ import (
|
|||
"github.com/prometheus/prometheus/discovery/zookeeper"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/pkg/relabel"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func mustParseURL(u string) *config.URL {
|
||||
|
@ -88,13 +87,15 @@ var expectedConf = &Config{
|
|||
Action: relabel.Drop,
|
||||
},
|
||||
},
|
||||
QueueConfig: DefaultQueueConfig,
|
||||
QueueConfig: DefaultQueueConfig,
|
||||
MetadataConfig: DefaultMetadataConfig,
|
||||
},
|
||||
{
|
||||
URL: mustParseURL("http://remote2/push"),
|
||||
RemoteTimeout: model.Duration(30 * time.Second),
|
||||
QueueConfig: DefaultQueueConfig,
|
||||
Name: "rw_tls",
|
||||
URL: mustParseURL("http://remote2/push"),
|
||||
RemoteTimeout: model.Duration(30 * time.Second),
|
||||
QueueConfig: DefaultQueueConfig,
|
||||
MetadataConfig: DefaultMetadataConfig,
|
||||
Name: "rw_tls",
|
||||
HTTPClientConfig: config.HTTPClientConfig{
|
||||
TLSConfig: config.TLSConfig{
|
||||
CertFile: filepath.FromSlash("testdata/valid_cert_file"),
|
||||
|
@ -620,6 +621,7 @@ var expectedConf = &Config{
|
|||
|
||||
ServiceDiscoveryConfigs: discovery.Configs{
|
||||
&dockerswarm.SDConfig{
|
||||
Filters: []dockerswarm.Filter{},
|
||||
Host: "http://127.0.0.1:2375",
|
||||
Role: "nodes",
|
||||
Port: 80,
|
||||
|
@ -720,77 +722,77 @@ var expectedConf = &Config{
|
|||
|
||||
func TestYAMLRoundtrip(t *testing.T) {
|
||||
want, err := LoadFile("testdata/roundtrip.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
out, err := yaml.Marshal(want)
|
||||
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
got := &Config{}
|
||||
testutil.Ok(t, yaml.UnmarshalStrict(out, got))
|
||||
require.NoError(t, yaml.UnmarshalStrict(out, got))
|
||||
|
||||
testutil.Equals(t, want, got)
|
||||
require.Equal(t, want, got)
|
||||
}
|
||||
|
||||
func TestLoadConfig(t *testing.T) {
|
||||
// Parse a valid file that sets a global scrape timeout. This tests whether parsing
|
||||
// an overwritten default field in the global config permanently changes the default.
|
||||
_, err := LoadFile("testdata/global_timeout.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
c, err := LoadFile("testdata/conf.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, expectedConf, c)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedConf, c)
|
||||
}
|
||||
|
||||
func TestScrapeIntervalLarger(t *testing.T) {
|
||||
c, err := LoadFile("testdata/scrape_interval_larger.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 1, len(c.ScrapeConfigs))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(c.ScrapeConfigs))
|
||||
for _, sc := range c.ScrapeConfigs {
|
||||
testutil.Equals(t, true, sc.ScrapeInterval >= sc.ScrapeTimeout)
|
||||
require.Equal(t, true, sc.ScrapeInterval >= sc.ScrapeTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
// YAML marshaling must not reveal authentication credentials.
|
||||
func TestElideSecrets(t *testing.T) {
|
||||
c, err := LoadFile("testdata/conf.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
secretRe := regexp.MustCompile(`\\u003csecret\\u003e|<secret>`)
|
||||
|
||||
config, err := yaml.Marshal(c)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
yamlConfig := string(config)
|
||||
|
||||
matches := secretRe.FindAllStringIndex(yamlConfig, -1)
|
||||
testutil.Assert(t, len(matches) == 10, "wrong number of secret matches found")
|
||||
testutil.Assert(t, !strings.Contains(yamlConfig, "mysecret"),
|
||||
require.Equal(t, 10, len(matches), "wrong number of secret matches found")
|
||||
require.NotContains(t, yamlConfig, "mysecret",
|
||||
"yaml marshal reveals authentication credentials.")
|
||||
}
|
||||
|
||||
func TestLoadConfigRuleFilesAbsolutePath(t *testing.T) {
|
||||
// Parse a valid file that sets a rule files with an absolute path
|
||||
c, err := LoadFile(ruleFilesConfigFile)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, ruleFilesExpectedConf, c)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, ruleFilesExpectedConf, c)
|
||||
}
|
||||
|
||||
func TestKubernetesEmptyAPIServer(t *testing.T) {
|
||||
_, err := LoadFile("testdata/kubernetes_empty_apiserver.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestKubernetesSelectors(t *testing.T) {
|
||||
_, err := LoadFile("testdata/kubernetes_selectors_endpoints.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = LoadFile("testdata/kubernetes_selectors_node.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = LoadFile("testdata/kubernetes_selectors_ingress.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = LoadFile("testdata/kubernetes_selectors_pod.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
_, err = LoadFile("testdata/kubernetes_selectors_service.good.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
var expectedErrors = []struct {
|
||||
|
@ -1026,40 +1028,40 @@ var expectedErrors = []struct {
|
|||
func TestBadConfigs(t *testing.T) {
|
||||
for _, ee := range expectedErrors {
|
||||
_, err := LoadFile("testdata/" + ee.filename)
|
||||
testutil.NotOk(t, err, "%s", ee.filename)
|
||||
testutil.Assert(t, strings.Contains(err.Error(), ee.errMsg),
|
||||
require.Error(t, err, "%s", ee.filename)
|
||||
require.Contains(t, err.Error(), ee.errMsg,
|
||||
"Expected error for %s to contain %q but got: %s", ee.filename, ee.errMsg, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBadStaticConfigsJSON(t *testing.T) {
|
||||
content, err := ioutil.ReadFile("testdata/static_config.bad.json")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
var tg targetgroup.Group
|
||||
err = json.Unmarshal(content, &tg)
|
||||
testutil.NotOk(t, err)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestBadStaticConfigsYML(t *testing.T) {
|
||||
content, err := ioutil.ReadFile("testdata/static_config.bad.yml")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
var tg targetgroup.Group
|
||||
err = yaml.UnmarshalStrict(content, &tg)
|
||||
testutil.NotOk(t, err)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestEmptyConfig(t *testing.T) {
|
||||
c, err := Load("")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
exp := DefaultConfig
|
||||
testutil.Equals(t, exp, *c)
|
||||
require.Equal(t, exp, *c)
|
||||
}
|
||||
|
||||
func TestEmptyGlobalBlock(t *testing.T) {
|
||||
c, err := Load("global:\n")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
exp := DefaultConfig
|
||||
testutil.Equals(t, exp, *c)
|
||||
require.Equal(t, exp, *c)
|
||||
}
|
||||
|
||||
func kubernetesSDHostURL() config.URL {
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
{{/* vim: set ft=html: */}}
|
||||
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
|
||||
{{ define "prom_console_head" }}
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-4.5.2/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prom_console.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css">
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/jquery-3.5.1.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/popper.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/bootstrap-4.5.2/js/bootstrap.min.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/classic/static/vendor/rickshaw/rickshaw.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/classic/static/vendor/bootstrap-4.5.2/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/classic/static/css/prom_console.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/classic/static/vendor/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css">
|
||||
<script src="{{ pathPrefix }}/classic/static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
||||
<script src="{{ pathPrefix }}/classic/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/classic/static/vendor/rickshaw/rickshaw.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/classic/static/vendor/js/jquery-3.5.1.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/classic/static/vendor/js/popper.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/classic/static/vendor/bootstrap-4.5.2/js/bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
var PATH_PREFIX = "{{ pathPrefix }}";
|
||||
</script>
|
||||
<script src="{{ pathPrefix }}/static/js/prom_console.js"></script>
|
||||
<script src="{{ pathPrefix }}/classic/static/js/prom_console.js"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* Top of all pages. */}}
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
package azure
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
)
|
||||
|
||||
|
@ -63,9 +63,7 @@ func TestMapFromVMWithEmptyTags(t *testing.T) {
|
|||
|
||||
actualVM := mapFromVM(testVM)
|
||||
|
||||
if !reflect.DeepEqual(expectedVM, actualVM) {
|
||||
t.Errorf("Expected %v got %v", expectedVM, actualVM)
|
||||
}
|
||||
require.Equal(t, expectedVM, actualVM)
|
||||
}
|
||||
|
||||
func TestMapFromVMWithTags(t *testing.T) {
|
||||
|
@ -109,9 +107,7 @@ func TestMapFromVMWithTags(t *testing.T) {
|
|||
|
||||
actualVM := mapFromVM(testVM)
|
||||
|
||||
if !reflect.DeepEqual(expectedVM, actualVM) {
|
||||
t.Errorf("Expected %v got %v", expectedVM, actualVM)
|
||||
}
|
||||
require.Equal(t, expectedVM, actualVM)
|
||||
}
|
||||
|
||||
func TestMapFromVMScaleSetVMWithEmptyTags(t *testing.T) {
|
||||
|
@ -154,9 +150,7 @@ func TestMapFromVMScaleSetVMWithEmptyTags(t *testing.T) {
|
|||
|
||||
actualVM := mapFromVMScaleSetVM(testVM, scaleSet)
|
||||
|
||||
if !reflect.DeepEqual(expectedVM, actualVM) {
|
||||
t.Errorf("Expected %v got %v", expectedVM, actualVM)
|
||||
}
|
||||
require.Equal(t, expectedVM, actualVM)
|
||||
}
|
||||
|
||||
func TestMapFromVMScaleSetVMWithTags(t *testing.T) {
|
||||
|
@ -202,9 +196,7 @@ func TestMapFromVMScaleSetVMWithTags(t *testing.T) {
|
|||
|
||||
actualVM := mapFromVMScaleSetVM(testVM, scaleSet)
|
||||
|
||||
if !reflect.DeepEqual(expectedVM, actualVM) {
|
||||
t.Errorf("Expected %v got %v", expectedVM, actualVM)
|
||||
}
|
||||
require.Equal(t, expectedVM, actualVM)
|
||||
}
|
||||
|
||||
func TestNewAzureResourceFromID(t *testing.T) {
|
||||
|
@ -222,8 +214,6 @@ func TestNewAzureResourceFromID(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
actual, _ := newAzureResourceFromID(tc.id, nil)
|
||||
if !reflect.DeepEqual(tc.expected, actual) {
|
||||
t.Errorf("Expected %v got %v", tc.expected, actual)
|
||||
}
|
||||
require.Equal(t, tc.expected, actual)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,18 @@ package consul
|
|||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
@ -251,7 +251,7 @@ func newServer(t *testing.T) (*httptest.Server, *SDConfig) {
|
|||
w.Write([]byte(response))
|
||||
}))
|
||||
stuburl, err := url.Parse(stub.URL)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
config := &SDConfig{
|
||||
Server: stuburl.Host,
|
||||
|
@ -264,18 +264,18 @@ func newServer(t *testing.T) (*httptest.Server, *SDConfig) {
|
|||
func newDiscovery(t *testing.T, config *SDConfig) *Discovery {
|
||||
logger := log.NewNopLogger()
|
||||
d, err := NewDiscovery(config, logger)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
return d
|
||||
}
|
||||
|
||||
func checkOneTarget(t *testing.T, tg []*targetgroup.Group) {
|
||||
testutil.Equals(t, 1, len(tg))
|
||||
require.Equal(t, 1, len(tg))
|
||||
target := tg[0]
|
||||
testutil.Equals(t, "test-dc", string(target.Labels["__meta_consul_dc"]))
|
||||
testutil.Equals(t, target.Source, string(target.Labels["__meta_consul_service"]))
|
||||
require.Equal(t, "test-dc", string(target.Labels["__meta_consul_dc"]))
|
||||
require.Equal(t, target.Source, string(target.Labels["__meta_consul_service"]))
|
||||
if target.Source == "test" {
|
||||
// test service should have one node.
|
||||
testutil.Assert(t, len(target.Targets) > 0, "Test service should have one node")
|
||||
require.Greater(t, len(target.Targets), 0, "Test service should have one node")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ func TestGetDatacenterShouldReturnError(t *testing.T) {
|
|||
} {
|
||||
stub := httptest.NewServer(http.HandlerFunc(tc.handler))
|
||||
stuburl, err := url.Parse(stub.URL)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
config := &SDConfig{
|
||||
Server: stuburl.Host,
|
||||
|
@ -370,13 +370,13 @@ func TestGetDatacenterShouldReturnError(t *testing.T) {
|
|||
d := newDiscovery(t, config)
|
||||
|
||||
// Should be empty if not initialized.
|
||||
testutil.Equals(t, "", d.clientDatacenter)
|
||||
require.Equal(t, "", d.clientDatacenter)
|
||||
|
||||
err = d.getDatacenter()
|
||||
|
||||
// An error should be returned.
|
||||
testutil.Equals(t, tc.errMessage, err.Error())
|
||||
require.Equal(t, tc.errMessage, err.Error())
|
||||
// Should still be empty.
|
||||
testutil.Equals(t, "", d.clientDatacenter)
|
||||
require.Equal(t, "", d.clientDatacenter)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type DigitalOceanSDTestSuite struct {
|
||||
|
@ -47,21 +47,21 @@ func TestDigitalOceanSDRefresh(t *testing.T) {
|
|||
cfg := DefaultSDConfig
|
||||
cfg.HTTPClientConfig.BearerToken = tokenID
|
||||
d, err := NewDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
endpoint, err := url.Parse(sdmock.Mock.Endpoint())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
d.client.BaseURL = endpoint
|
||||
|
||||
ctx := context.Background()
|
||||
tgs, err := d.refresh(ctx)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.Equal(t, 1, len(tgs))
|
||||
|
||||
tg := tgs[0]
|
||||
testutil.Assert(t, tg != nil, "tg should not be nil")
|
||||
testutil.Assert(t, tg.Targets != nil, "tg.targets should not be nil")
|
||||
testutil.Equals(t, 4, len(tg.Targets))
|
||||
require.NotNil(t, tg)
|
||||
require.NotNil(t, tg.Targets)
|
||||
require.Equal(t, 4, len(tg.Targets))
|
||||
|
||||
for i, lbls := range []model.LabelSet{
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ func TestDigitalOceanSDRefresh(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, lbls, tg.Targets[i])
|
||||
require.Equal(t, lbls, tg.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"reflect"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
|
||||
"github.com/prometheus/common/config"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ import (
|
|||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/miekg/dns"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
@ -205,8 +205,8 @@ func TestDNS(t *testing.T) {
|
|||
sd.lookupFn = tc.lookup
|
||||
|
||||
tgs, err := sd.refresh(context.Background())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, tc.expected, tgs)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tc.expected, tgs)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ func TestSDConfigUnmarshalYAML(t *testing.T) {
|
|||
var config SDConfig
|
||||
d := marshal(c.input)
|
||||
err := config.UnmarshalYAML(unmarshal(d))
|
||||
testutil.Equals(t, c.expectErr, err != nil)
|
||||
require.Equal(t, c.expectErr, err != nil)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/config"
|
||||
|
@ -41,6 +42,7 @@ var userAgent = fmt.Sprintf("Prometheus/%s", version.Version)
|
|||
var DefaultSDConfig = SDConfig{
|
||||
RefreshInterval: model.Duration(60 * time.Second),
|
||||
Port: 80,
|
||||
Filters: []Filter{},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -51,13 +53,21 @@ func init() {
|
|||
type SDConfig struct {
|
||||
HTTPClientConfig config.HTTPClientConfig `yaml:",inline"`
|
||||
|
||||
Host string `yaml:"host"`
|
||||
Role string `yaml:"role"`
|
||||
Port int `yaml:"port"`
|
||||
Host string `yaml:"host"`
|
||||
Role string `yaml:"role"`
|
||||
Port int `yaml:"port"`
|
||||
Filters []Filter `yaml:"filters"`
|
||||
|
||||
RefreshInterval model.Duration `yaml:"refresh_interval"`
|
||||
}
|
||||
|
||||
// Filter represent a filter that can be passed to Docker Swarm to reduce the
|
||||
// amount of data received.
|
||||
type Filter struct {
|
||||
Name string `yaml:"name"`
|
||||
Values []string `yaml:"values"`
|
||||
}
|
||||
|
||||
// Name returns the name of the Config.
|
||||
func (*SDConfig) Name() string { return "dockerswarm" }
|
||||
|
||||
|
@ -99,9 +109,10 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
// the Discoverer interface.
|
||||
type Discovery struct {
|
||||
*refresh.Discovery
|
||||
client *client.Client
|
||||
role string
|
||||
port int
|
||||
client *client.Client
|
||||
role string
|
||||
port int
|
||||
filters filters.Args
|
||||
}
|
||||
|
||||
// NewDiscovery returns a new Discovery which periodically refreshes its targets.
|
||||
|
@ -123,6 +134,13 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) {
|
|||
client.WithAPIVersionNegotiation(),
|
||||
}
|
||||
|
||||
d.filters = filters.NewArgs()
|
||||
for _, f := range conf.Filters {
|
||||
for _, v := range f.Values {
|
||||
d.filters.Add(f.Name, v)
|
||||
}
|
||||
}
|
||||
|
||||
// There are other protocols than HTTP supported by the Docker daemon, like
|
||||
// unix, which are not supported by the HTTP client. Passing HTTP client
|
||||
// options to the Docker client makes those non-HTTP requests fail.
|
||||
|
|
|
@ -23,9 +23,10 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
)
|
||||
|
||||
// SDMock is the interface for the DigitalOcean mock
|
||||
|
@ -63,7 +64,7 @@ func (m *SDMock) Setup() {
|
|||
func (m *SDMock) SetupHandlers() {
|
||||
headers := make(map[string]string)
|
||||
rawHeaders, err := ioutil.ReadFile(filepath.Join("testdata", m.directory, "headers.yml"))
|
||||
testutil.Ok(m.t, err)
|
||||
require.NoError(m.t, err)
|
||||
yaml.Unmarshal(rawHeaders, &headers)
|
||||
|
||||
prefix := "/"
|
||||
|
@ -93,7 +94,7 @@ func (m *SDMock) SetupHandlers() {
|
|||
f = filepath.Join(p[:len(p)-1], strutil.SanitizeLabelName(parts[len(parts)-1]))
|
||||
} else {
|
||||
query := strings.Split(parts[len(parts)-1], "?")
|
||||
f = query[0]
|
||||
f = query[0] + ".json"
|
||||
if len(query) == 2 {
|
||||
h := sha1.New()
|
||||
h.Write([]byte(query[1]))
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ func (d *Discovery) refreshNodes(ctx context.Context) ([]*targetgroup.Group, err
|
|||
Source: "DockerSwarm",
|
||||
}
|
||||
|
||||
nodes, err := d.client.NodeList(ctx, types.NodeListOptions{})
|
||||
nodes, err := d.client.NodeList(ctx, types.NodeListOptions{Filters: d.filters})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while listing swarm nodes: %w", err)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
@ -36,21 +36,21 @@ role: nodes
|
|||
host: %s
|
||||
`, url)
|
||||
var cfg SDConfig
|
||||
testutil.Ok(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
require.NoError(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
|
||||
d, err := NewDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
tgs, err := d.refresh(ctx)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.Equal(t, 1, len(tgs))
|
||||
|
||||
tg := tgs[0]
|
||||
testutil.Assert(t, tg != nil, "tg should not be nil")
|
||||
testutil.Assert(t, tg.Targets != nil, "tg.targets should not be nil")
|
||||
testutil.Equals(t, 5, len(tg.Targets))
|
||||
require.NotNil(t, tg)
|
||||
require.NotNil(t, tg.Targets)
|
||||
require.Equal(t, 5, len(tg.Targets))
|
||||
|
||||
for i, lbls := range []model.LabelSet{
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ host: %s
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, lbls, tg.Targets[i])
|
||||
require.Equal(t, lbls, tg.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func (d *Discovery) refreshServices(ctx context.Context) ([]*targetgroup.Group,
|
|||
Source: "DockerSwarm",
|
||||
}
|
||||
|
||||
services, err := d.client.ServiceList(ctx, types.ServiceListOptions{})
|
||||
services, err := d.client.ServiceList(ctx, types.ServiceListOptions{Filters: d.filters})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while listing swarm services: %w", err)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
@ -36,21 +36,21 @@ role: services
|
|||
host: %s
|
||||
`, url)
|
||||
var cfg SDConfig
|
||||
testutil.Ok(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
require.NoError(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
|
||||
d, err := NewDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
tgs, err := d.refresh(ctx)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.Equal(t, 1, len(tgs))
|
||||
|
||||
tg := tgs[0]
|
||||
testutil.Assert(t, tg != nil, "tg should not be nil")
|
||||
testutil.Assert(t, tg.Targets != nil, "tg.targets should not be nil")
|
||||
testutil.Equals(t, 15, len(tg.Targets))
|
||||
require.NotNil(t, tg)
|
||||
require.NotNil(t, tg.Targets)
|
||||
require.Equal(t, 15, len(tg.Targets))
|
||||
|
||||
for i, lbls := range []model.LabelSet{
|
||||
{
|
||||
|
@ -310,7 +310,116 @@ host: %s
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, lbls, tg.Targets[i])
|
||||
require.Equal(t, lbls, tg.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDockerSwarmSDServicesRefreshWithFilters(t *testing.T) {
|
||||
sdmock := NewSDMock(t, "swarmprom")
|
||||
sdmock.Setup()
|
||||
|
||||
e := sdmock.Endpoint()
|
||||
url := e[:len(e)-1]
|
||||
cfgString := fmt.Sprintf(`
|
||||
---
|
||||
role: services
|
||||
host: %s
|
||||
filters:
|
||||
- name: name
|
||||
values: ["mon_node-exporter", "mon_grafana"]
|
||||
`, url)
|
||||
var cfg SDConfig
|
||||
require.NoError(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
|
||||
d, err := NewDiscovery(&cfg, log.NewNopLogger())
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
tgs, err := d.refresh(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, 1, len(tgs))
|
||||
|
||||
tg := tgs[0]
|
||||
require.NotNil(t, tg, "tg should not be nil")
|
||||
require.NotNil(t, tg.Targets, "tg.targets should not be nil")
|
||||
require.Equal(t, 4, len(tg.Targets))
|
||||
|
||||
for i, lbls := range []model.LabelSet{
|
||||
{
|
||||
"__address__": model.LabelValue("10.0.0.7:9100"),
|
||||
"__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"),
|
||||
"__meta_dockerswarm_network_ingress": model.LabelValue("true"),
|
||||
"__meta_dockerswarm_network_internal": model.LabelValue("false"),
|
||||
"__meta_dockerswarm_network_name": model.LabelValue("ingress"),
|
||||
"__meta_dockerswarm_network_scope": model.LabelValue("swarm"),
|
||||
"__meta_dockerswarm_service_endpoint_port_name": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_endpoint_port_publish_mode": model.LabelValue("ingress"),
|
||||
"__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"),
|
||||
"__meta_dockerswarm_service_mode": model.LabelValue("global"),
|
||||
"__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"),
|
||||
"__meta_dockerswarm_service_task_container_hostname": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_task_container_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0@sha256:1d2518ec0501dd848e718bf008df37852b1448c862d6f256f2d39244975758d6"),
|
||||
},
|
||||
{
|
||||
"__address__": model.LabelValue("10.0.1.2:9100"),
|
||||
"__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"),
|
||||
"__meta_dockerswarm_network_ingress": model.LabelValue("false"),
|
||||
"__meta_dockerswarm_network_internal": model.LabelValue("false"),
|
||||
"__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"),
|
||||
"__meta_dockerswarm_network_name": model.LabelValue("mon_net"),
|
||||
"__meta_dockerswarm_network_scope": model.LabelValue("swarm"),
|
||||
"__meta_dockerswarm_service_endpoint_port_name": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_endpoint_port_publish_mode": model.LabelValue("ingress"),
|
||||
"__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"),
|
||||
"__meta_dockerswarm_service_mode": model.LabelValue("global"),
|
||||
"__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"),
|
||||
"__meta_dockerswarm_service_task_container_hostname": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_task_container_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0@sha256:1d2518ec0501dd848e718bf008df37852b1448c862d6f256f2d39244975758d6"),
|
||||
},
|
||||
{
|
||||
"__address__": model.LabelValue("10.0.0.15:3000"),
|
||||
"__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"),
|
||||
"__meta_dockerswarm_network_ingress": model.LabelValue("true"),
|
||||
"__meta_dockerswarm_network_internal": model.LabelValue("false"),
|
||||
"__meta_dockerswarm_network_name": model.LabelValue("ingress"),
|
||||
"__meta_dockerswarm_network_scope": model.LabelValue("swarm"),
|
||||
"__meta_dockerswarm_service_endpoint_port_name": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_endpoint_port_publish_mode": model.LabelValue("ingress"),
|
||||
"__meta_dockerswarm_service_id": model.LabelValue("uk9su5tb9ykfzew3qtmp14uzh"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-grafana:5.3.4"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"),
|
||||
"__meta_dockerswarm_service_mode": model.LabelValue("replicated"),
|
||||
"__meta_dockerswarm_service_name": model.LabelValue("mon_grafana"),
|
||||
"__meta_dockerswarm_service_task_container_hostname": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_task_container_image": model.LabelValue("stefanprodan/swarmprom-grafana:5.3.4@sha256:2aca8aa5716e6e0eed3fcdc88fec256a0a1828c491a8cf240486ae7cc473092d"),
|
||||
},
|
||||
{
|
||||
"__address__": model.LabelValue("10.0.1.29:3000"),
|
||||
"__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"),
|
||||
"__meta_dockerswarm_network_ingress": model.LabelValue("false"),
|
||||
"__meta_dockerswarm_network_internal": model.LabelValue("false"),
|
||||
"__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"),
|
||||
"__meta_dockerswarm_network_name": model.LabelValue("mon_net"),
|
||||
"__meta_dockerswarm_network_scope": model.LabelValue("swarm"),
|
||||
"__meta_dockerswarm_service_endpoint_port_name": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_endpoint_port_publish_mode": model.LabelValue("ingress"),
|
||||
"__meta_dockerswarm_service_id": model.LabelValue("uk9su5tb9ykfzew3qtmp14uzh"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-grafana:5.3.4"),
|
||||
"__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"),
|
||||
"__meta_dockerswarm_service_mode": model.LabelValue("replicated"),
|
||||
"__meta_dockerswarm_service_name": model.LabelValue("mon_grafana"),
|
||||
"__meta_dockerswarm_service_task_container_hostname": model.LabelValue(""),
|
||||
"__meta_dockerswarm_service_task_container_image": model.LabelValue("stefanprodan/swarmprom-grafana:5.3.4@sha256:2aca8aa5716e6e0eed3fcdc88fec256a0a1828c491a8cf240486ae7cc473092d"),
|
||||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
require.Equal(t, lbls, tg.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ func (d *Discovery) refreshTasks(ctx context.Context) ([]*targetgroup.Group, err
|
|||
Source: "DockerSwarm",
|
||||
}
|
||||
|
||||
tasks, err := d.client.TaskList(ctx, types.TaskListOptions{})
|
||||
tasks, err := d.client.TaskList(ctx, types.TaskListOptions{Filters: d.filters})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while listing swarm services: %w", err)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
@ -36,21 +36,21 @@ role: tasks
|
|||
host: %s
|
||||
`, url)
|
||||
var cfg SDConfig
|
||||
testutil.Ok(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
require.NoError(t, yaml.Unmarshal([]byte(cfgString), &cfg))
|
||||
|
||||
d, err := NewDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
tgs, err := d.refresh(ctx)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.Equal(t, 1, len(tgs))
|
||||
|
||||
tg := tgs[0]
|
||||
testutil.Assert(t, tg != nil, "tg should not be nil")
|
||||
testutil.Assert(t, tg.Targets != nil, "tg.targets should not be nil")
|
||||
testutil.Equals(t, 27, len(tg.Targets))
|
||||
require.NotNil(t, tg)
|
||||
require.NotNil(t, tg.Targets)
|
||||
require.Equal(t, 27, len(tg.Targets))
|
||||
|
||||
for i, lbls := range []model.LabelSet{
|
||||
{
|
||||
|
@ -787,7 +787,7 @@ host: %s
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, lbls, tg.Targets[i])
|
||||
require.Equal(t, lbls, tg.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
257
discovery/dockerswarm/testdata/swarmprom/services.json__wvKVCQ4HhD
vendored
Normal file
257
discovery/dockerswarm/testdata/swarmprom/services.json__wvKVCQ4HhD
vendored
Normal file
|
@ -0,0 +1,257 @@
|
|||
[
|
||||
{
|
||||
"ID": "3qvd7bwfptmoht16t1f7jllb6",
|
||||
"Version": {
|
||||
"Index": 41
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:29.269637662Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:29.288101671Z",
|
||||
"Spec": {
|
||||
"Name": "mon_node-exporter",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/swarmprom-node-exporter:v0.16.0",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/swarmprom-node-exporter:v0.16.0@sha256:1d2518ec0501dd848e718bf008df37852b1448c862d6f256f2d39244975758d6",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Args": [
|
||||
"--path.sysfs=/host/sys",
|
||||
"--path.procfs=/host/proc",
|
||||
"--collector.textfile.directory=/etc/node-exporter/",
|
||||
"--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($|/)",
|
||||
"--no-collector.ipvs"
|
||||
],
|
||||
"Env": [
|
||||
"NODE_ID={{.Node.ID}}"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/proc",
|
||||
"Target": "/host/proc",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/sys",
|
||||
"Target": "/host/sys",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/",
|
||||
"Target": "/rootfs",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/etc/hostname",
|
||||
"Target": "/etc/nodename"
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"node-exporter"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Global": {}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 9100,
|
||||
"PublishedPort": 9100,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 9100,
|
||||
"PublishedPort": 9100,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 9100,
|
||||
"PublishedPort": 9100,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
],
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "qvwhwd6p61k4o0ulsknqb066z",
|
||||
"Addr": "10.0.0.7/24"
|
||||
},
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.2/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "uk9su5tb9ykfzew3qtmp14uzh",
|
||||
"Version": {
|
||||
"Index": 92
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:54.28743674Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:54.301718496Z",
|
||||
"Spec": {
|
||||
"Name": "mon_grafana",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/swarmprom-grafana:5.3.4",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/swarmprom-grafana:5.3.4@sha256:2aca8aa5716e6e0eed3fcdc88fec256a0a1828c491a8cf240486ae7cc473092d",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Env": [
|
||||
"GF_SECURITY_ADMIN_PASSWORD=admin",
|
||||
"GF_SECURITY_ADMIN_USER=admin",
|
||||
"GF_USERS_ALLOW_SIGN_UP=false"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "volume",
|
||||
"Source": "mon_grafana",
|
||||
"Target": "/var/lib/grafana",
|
||||
"VolumeOptions": {
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Constraints": [
|
||||
"node.role == manager"
|
||||
],
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"grafana"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Replicated": {
|
||||
"Replicas": 1
|
||||
}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 3000,
|
||||
"PublishedPort": 3000,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 3000,
|
||||
"PublishedPort": 3000,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 3000,
|
||||
"PublishedPort": 3000,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
],
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "qvwhwd6p61k4o0ulsknqb066z",
|
||||
"Addr": "10.0.0.15/24"
|
||||
},
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.29/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
|
@ -1,724 +0,0 @@
|
|||
[
|
||||
{
|
||||
"ID": "3qvd7bwfptmoht16t1f7jllb6",
|
||||
"Version": {
|
||||
"Index": 41
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:29.269637662Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:29.288101671Z",
|
||||
"Spec": {
|
||||
"Name": "mon_node-exporter",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/swarmprom-node-exporter:v0.16.0",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/swarmprom-node-exporter:v0.16.0@sha256:1d2518ec0501dd848e718bf008df37852b1448c862d6f256f2d39244975758d6",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Args": [
|
||||
"--path.sysfs=/host/sys",
|
||||
"--path.procfs=/host/proc",
|
||||
"--collector.textfile.directory=/etc/node-exporter/",
|
||||
"--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($|/)",
|
||||
"--no-collector.ipvs"
|
||||
],
|
||||
"Env": [
|
||||
"NODE_ID={{.Node.ID}}"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/proc",
|
||||
"Target": "/host/proc",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/sys",
|
||||
"Target": "/host/sys",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/",
|
||||
"Target": "/rootfs",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/etc/hostname",
|
||||
"Target": "/etc/nodename"
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"node-exporter"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Global": {}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 9100,
|
||||
"PublishedPort": 9100,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 9100,
|
||||
"PublishedPort": 9100,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 9100,
|
||||
"PublishedPort": 9100,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
],
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "qvwhwd6p61k4o0ulsknqb066z",
|
||||
"Addr": "10.0.0.7/24"
|
||||
},
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.2/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "9bbq7j55tzzz85k2gg52x73rg",
|
||||
"Version": {
|
||||
"Index": 116
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:15:16.676178796Z",
|
||||
"UpdatedAt": "2020-06-19T19:15:16.690701679Z",
|
||||
"Spec": {
|
||||
"Name": "mon_unsee",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "cloudflare/unsee:v0.8.0",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "cloudflare/unsee:v0.8.0@sha256:28398f47f63feb1647887999701fa730da351fc6d3cc7228e5da44b40a663ada",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Env": [
|
||||
"ALERTMANAGER_URIS=default:http://alertmanager:9093"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {},
|
||||
"Placement": {
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"unsee"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Replicated": {
|
||||
"Replicas": 1
|
||||
}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip"
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip"
|
||||
},
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.34/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "hv645udwaaewyw7wuc6nspm68",
|
||||
"Version": {
|
||||
"Index": 54
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:31.707250955Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:31.713627185Z",
|
||||
"Spec": {
|
||||
"Name": "mon_prometheus",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/swarmprom-prometheus:v2.5.0",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/swarmprom-prometheus:v2.5.0@sha256:f1a3781c4785637ba088dcf54889f77d9b6b69f21b2c0a167c1347473f4e2587",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Args": [
|
||||
"--config.file=/etc/prometheus/prometheus.yml",
|
||||
"--storage.tsdb.path=/prometheus",
|
||||
"--storage.tsdb.retention=24h"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "volume",
|
||||
"Source": "mon_prometheus",
|
||||
"Target": "/prometheus",
|
||||
"VolumeOptions": {
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Configs": [
|
||||
{
|
||||
"File": {
|
||||
"Name": "/etc/prometheus/swarm_node.rules.yml",
|
||||
"UID": "0",
|
||||
"GID": "0",
|
||||
"Mode": 292
|
||||
},
|
||||
"ConfigID": "zffindunvquarrlgdrklzczbz",
|
||||
"ConfigName": "mon_node_rules"
|
||||
},
|
||||
{
|
||||
"File": {
|
||||
"Name": "/etc/prometheus/swarm_task.rules.yml",
|
||||
"UID": "0",
|
||||
"GID": "0",
|
||||
"Mode": 292
|
||||
},
|
||||
"ConfigID": "fbhk5cmleeicn5fkzujm909k7",
|
||||
"ConfigName": "mon_task_rules"
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 2147483648
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 134217728
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Constraints": [
|
||||
"node.role == manager"
|
||||
],
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"prometheus"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Replicated": {
|
||||
"Replicas": 1
|
||||
}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip"
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip"
|
||||
},
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.13/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "iml8vdd2dudvq457sbirpf66z",
|
||||
"Version": {
|
||||
"Index": 83
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:49.165966453Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:49.1722461Z",
|
||||
"Spec": {
|
||||
"Name": "mon_cadvisor",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "google/cadvisor",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "google/cadvisor:latest@sha256:815386ebbe9a3490f38785ab11bda34ec8dacf4634af77b8912832d4f85dca04",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Args": [
|
||||
"-logtostderr",
|
||||
"-docker_only"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/var/run/docker.sock",
|
||||
"Target": "/var/run/docker.sock",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/",
|
||||
"Target": "/rootfs",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/var/run",
|
||||
"Target": "/var/run"
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/sys",
|
||||
"Target": "/sys",
|
||||
"ReadOnly": true
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/var/lib/docker/",
|
||||
"Target": "/var/lib/docker",
|
||||
"ReadOnly": true
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"cadvisor"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Global": {}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip"
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip"
|
||||
},
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.23/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "rl4jhdws3r4lkfvq8kx6c4xnr",
|
||||
"Version": {
|
||||
"Index": 104
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:15:09.840775581Z",
|
||||
"UpdatedAt": "2020-06-19T19:15:09.854119631Z",
|
||||
"Spec": {
|
||||
"Name": "mon_alertmanager",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/swarmprom-alertmanager:v0.14.0",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/swarmprom-alertmanager:v0.14.0@sha256:7069b656bd5df0606ff1db81a7553a25dc72be51d3aca6a7e08d776566cefbd8",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Args": [
|
||||
"--config.file=/etc/alertmanager/alertmanager.yml",
|
||||
"--storage.path=/alertmanager"
|
||||
],
|
||||
"Env": [
|
||||
"SLACK_CHANNEL=devops-alerts",
|
||||
"SLACK_URL=https://hooks.slack.com/services/TOKEN",
|
||||
"SLACK_USER=alertmanager"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "volume",
|
||||
"Source": "mon_alertmanager",
|
||||
"Target": "/alertmanager",
|
||||
"VolumeOptions": {
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Constraints": [
|
||||
"node.role == manager"
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"alertmanager"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Replicated": {
|
||||
"Replicas": 1
|
||||
}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip"
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip"
|
||||
},
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.31/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "uk9su5tb9ykfzew3qtmp14uzh",
|
||||
"Version": {
|
||||
"Index": 92
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:54.28743674Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:54.301718496Z",
|
||||
"Spec": {
|
||||
"Name": "mon_grafana",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/swarmprom-grafana:5.3.4",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/swarmprom-grafana:5.3.4@sha256:2aca8aa5716e6e0eed3fcdc88fec256a0a1828c491a8cf240486ae7cc473092d",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Env": [
|
||||
"GF_SECURITY_ADMIN_PASSWORD=admin",
|
||||
"GF_SECURITY_ADMIN_USER=admin",
|
||||
"GF_USERS_ALLOW_SIGN_UP=false"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Mounts": [
|
||||
{
|
||||
"Type": "volume",
|
||||
"Source": "mon_grafana",
|
||||
"Target": "/var/lib/grafana",
|
||||
"VolumeOptions": {
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Constraints": [
|
||||
"node.role == manager"
|
||||
],
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"grafana"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Replicated": {
|
||||
"Replicas": 1
|
||||
}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 3000,
|
||||
"PublishedPort": 3000,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip",
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 3000,
|
||||
"PublishedPort": 3000,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Ports": [
|
||||
{
|
||||
"Protocol": "tcp",
|
||||
"TargetPort": 3000,
|
||||
"PublishedPort": 3000,
|
||||
"PublishMode": "ingress"
|
||||
}
|
||||
],
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "qvwhwd6p61k4o0ulsknqb066z",
|
||||
"Addr": "10.0.0.15/24"
|
||||
},
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.29/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "ul5qawv4s7f7msm7dtyfarw80",
|
||||
"Version": {
|
||||
"Index": 74
|
||||
},
|
||||
"CreatedAt": "2020-06-19T19:14:45.311963014Z",
|
||||
"UpdatedAt": "2020-06-19T19:14:45.327315101Z",
|
||||
"Spec": {
|
||||
"Name": "mon_dockerd-exporter",
|
||||
"Labels": {
|
||||
"com.docker.stack.image": "stefanprodan/caddy",
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"TaskTemplate": {
|
||||
"ContainerSpec": {
|
||||
"Image": "stefanprodan/caddy:latest@sha256:44541cfacb66f4799f81f17fcfb3cb757ccc8f327592745549f5930c42d115c9",
|
||||
"Labels": {
|
||||
"com.docker.stack.namespace": "mon"
|
||||
},
|
||||
"Env": [
|
||||
"DOCKER_GWBRIDGE_IP=172.18.0.1"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
"SELinuxContext": null
|
||||
},
|
||||
"Configs": [
|
||||
{
|
||||
"File": {
|
||||
"Name": "/etc/caddy/Caddyfile",
|
||||
"UID": "0",
|
||||
"GID": "0",
|
||||
"Mode": 292
|
||||
},
|
||||
"ConfigID": "4glhzmw6fndnkjn2cok90a9gu",
|
||||
"ConfigName": "mon_dockerd_config"
|
||||
}
|
||||
],
|
||||
"Isolation": "default"
|
||||
},
|
||||
"Resources": {
|
||||
"Limits": {
|
||||
"MemoryBytes": 134217728
|
||||
},
|
||||
"Reservations": {
|
||||
"MemoryBytes": 67108864
|
||||
}
|
||||
},
|
||||
"Placement": {
|
||||
"Platforms": [
|
||||
{
|
||||
"Architecture": "amd64",
|
||||
"OS": "linux"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Networks": [
|
||||
{
|
||||
"Target": "npq2closzy836m07eaq1425k3",
|
||||
"Aliases": [
|
||||
"dockerd-exporter"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ForceUpdate": 0,
|
||||
"Runtime": "container"
|
||||
},
|
||||
"Mode": {
|
||||
"Global": {}
|
||||
},
|
||||
"EndpointSpec": {
|
||||
"Mode": "vip"
|
||||
}
|
||||
},
|
||||
"Endpoint": {
|
||||
"Spec": {
|
||||
"Mode": "vip"
|
||||
},
|
||||
"VirtualIPs": [
|
||||
{
|
||||
"NetworkID": "npq2closzy836m07eaq1425k3",
|
||||
"Addr": "10.0.1.17/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
|
@ -42,21 +42,22 @@ const (
|
|||
ec2LabelAMI = ec2Label + "ami"
|
||||
ec2LabelAZ = ec2Label + "availability_zone"
|
||||
ec2LabelArch = ec2Label + "architecture"
|
||||
ec2LabelIPv6Addresses = ec2Label + "ipv6_addresses"
|
||||
ec2LabelInstanceID = ec2Label + "instance_id"
|
||||
ec2LabelInstanceLifecycle = ec2Label + "instance_lifecycle"
|
||||
ec2LabelInstanceState = ec2Label + "instance_state"
|
||||
ec2LabelInstanceType = ec2Label + "instance_type"
|
||||
ec2LabelInstanceLifecycle = ec2Label + "instance_lifecycle"
|
||||
ec2LabelOwnerID = ec2Label + "owner_id"
|
||||
ec2LabelPlatform = ec2Label + "platform"
|
||||
ec2LabelPublicDNS = ec2Label + "public_dns_name"
|
||||
ec2LabelPublicIP = ec2Label + "public_ip"
|
||||
ec2LabelPrimarySubnetID = ec2Label + "primary_subnet_id"
|
||||
ec2LabelPrivateDNS = ec2Label + "private_dns_name"
|
||||
ec2LabelPrivateIP = ec2Label + "private_ip"
|
||||
ec2LabelPrimarySubnetID = ec2Label + "primary_subnet_id"
|
||||
ec2LabelPublicDNS = ec2Label + "public_dns_name"
|
||||
ec2LabelPublicIP = ec2Label + "public_ip"
|
||||
ec2LabelSubnetID = ec2Label + "subnet_id"
|
||||
ec2LabelTag = ec2Label + "tag_"
|
||||
ec2LabelVPCID = ec2Label + "vpc_id"
|
||||
subnetSeparator = ","
|
||||
ec2LabelSeparator = ","
|
||||
)
|
||||
|
||||
// DefaultSDConfig is the default EC2 SD configuration.
|
||||
|
@ -243,22 +244,33 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
|||
labels[ec2LabelVPCID] = model.LabelValue(*inst.VpcId)
|
||||
labels[ec2LabelPrimarySubnetID] = model.LabelValue(*inst.SubnetId)
|
||||
|
||||
// Deduplicate VPC Subnet IDs maintaining the order of the network interfaces returned by EC2.
|
||||
var subnets []string
|
||||
var ipv6addrs []string
|
||||
subnetsMap := make(map[string]struct{})
|
||||
for _, eni := range inst.NetworkInterfaces {
|
||||
if eni.SubnetId == nil {
|
||||
continue
|
||||
}
|
||||
// Deduplicate VPC Subnet IDs maintaining the order of the subnets returned by EC2.
|
||||
if _, ok := subnetsMap[*eni.SubnetId]; !ok {
|
||||
subnetsMap[*eni.SubnetId] = struct{}{}
|
||||
subnets = append(subnets, *eni.SubnetId)
|
||||
}
|
||||
|
||||
for _, ipv6addr := range eni.Ipv6Addresses {
|
||||
ipv6addrs = append(ipv6addrs, *ipv6addr.Ipv6Address)
|
||||
}
|
||||
}
|
||||
labels[ec2LabelSubnetID] = model.LabelValue(
|
||||
subnetSeparator +
|
||||
strings.Join(subnets, subnetSeparator) +
|
||||
subnetSeparator)
|
||||
ec2LabelSeparator +
|
||||
strings.Join(subnets, ec2LabelSeparator) +
|
||||
ec2LabelSeparator)
|
||||
if len(ipv6addrs) > 0 {
|
||||
labels[ec2LabelIPv6Addresses] = model.LabelValue(
|
||||
ec2LabelSeparator +
|
||||
strings.Join(ipv6addrs, ec2LabelSeparator) +
|
||||
ec2LabelSeparator)
|
||||
}
|
||||
}
|
||||
|
||||
for _, t := range inst.Tags {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestFetchApps(t *testing.T) {
|
||||
|
@ -182,19 +182,19 @@ func TestFetchApps(t *testing.T) {
|
|||
defer ts.Close()
|
||||
|
||||
apps, err := fetchApps(context.TODO(), ts.URL, &http.Client{})
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
testutil.Equals(t, len(apps.Applications), 2)
|
||||
testutil.Equals(t, apps.Applications[0].Name, "CONFIG-SERVICE")
|
||||
testutil.Equals(t, apps.Applications[1].Name, "META-SERVICE")
|
||||
require.Equal(t, len(apps.Applications), 2)
|
||||
require.Equal(t, apps.Applications[0].Name, "CONFIG-SERVICE")
|
||||
require.Equal(t, apps.Applications[1].Name, "META-SERVICE")
|
||||
|
||||
testutil.Equals(t, len(apps.Applications[1].Instances), 2)
|
||||
testutil.Equals(t, apps.Applications[1].Instances[0].InstanceID, "meta-service002.test.com:meta-service:8080")
|
||||
testutil.Equals(t, apps.Applications[1].Instances[0].Metadata.Items[0].XMLName.Local, "project")
|
||||
testutil.Equals(t, apps.Applications[1].Instances[0].Metadata.Items[0].Content, "meta-service")
|
||||
testutil.Equals(t, apps.Applications[1].Instances[0].Metadata.Items[1].XMLName.Local, "management.port")
|
||||
testutil.Equals(t, apps.Applications[1].Instances[0].Metadata.Items[1].Content, "8090")
|
||||
testutil.Equals(t, apps.Applications[1].Instances[1].InstanceID, "meta-service001.test.com:meta-service:8080")
|
||||
require.Equal(t, len(apps.Applications[1].Instances), 2)
|
||||
require.Equal(t, apps.Applications[1].Instances[0].InstanceID, "meta-service002.test.com:meta-service:8080")
|
||||
require.Equal(t, apps.Applications[1].Instances[0].Metadata.Items[0].XMLName.Local, "project")
|
||||
require.Equal(t, apps.Applications[1].Instances[0].Metadata.Items[0].Content, "meta-service")
|
||||
require.Equal(t, apps.Applications[1].Instances[0].Metadata.Items[1].XMLName.Local, "management.port")
|
||||
require.Equal(t, apps.Applications[1].Instances[0].Metadata.Items[1].Content, "8090")
|
||||
require.Equal(t, apps.Applications[1].Instances[1].InstanceID, "meta-service001.test.com:meta-service:8080")
|
||||
}
|
||||
|
||||
func Test500ErrorHttpResponse(t *testing.T) {
|
||||
|
@ -209,5 +209,5 @@ func Test500ErrorHttpResponse(t *testing.T) {
|
|||
defer ts.Close()
|
||||
|
||||
_, err := fetchApps(context.TODO(), ts.URL, &http.Client{})
|
||||
testutil.NotOk(t, err, "5xx HTTP response")
|
||||
require.Error(t, err, "5xx HTTP response")
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ package eureka
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
|
@ -45,7 +45,7 @@ func testUpdateServices(respHandler http.HandlerFunc) ([]*targetgroup.Group, err
|
|||
|
||||
func TestEurekaSDHandleError(t *testing.T) {
|
||||
var (
|
||||
errTesting = errors.Errorf("non 2xx status '%d' response during eureka service discovery", http.StatusInternalServerError)
|
||||
errTesting = "non 2xx status '500' response during eureka service discovery"
|
||||
respHandler = func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Header().Set("Content-Type", "application/xml")
|
||||
|
@ -54,8 +54,8 @@ func TestEurekaSDHandleError(t *testing.T) {
|
|||
)
|
||||
tgs, err := testUpdateServices(respHandler)
|
||||
|
||||
testutil.ErrorEqual(t, err, errTesting)
|
||||
testutil.Equals(t, len(tgs), 0)
|
||||
require.EqualError(t, err, errTesting)
|
||||
require.Equal(t, len(tgs), 0)
|
||||
}
|
||||
|
||||
func TestEurekaSDEmptyList(t *testing.T) {
|
||||
|
@ -71,8 +71,8 @@ func TestEurekaSDEmptyList(t *testing.T) {
|
|||
}
|
||||
)
|
||||
tgs, err := testUpdateServices(respHandler)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, len(tgs), 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, len(tgs), 1)
|
||||
}
|
||||
|
||||
func TestEurekaSDSendGroup(t *testing.T) {
|
||||
|
@ -231,16 +231,16 @@ func TestEurekaSDSendGroup(t *testing.T) {
|
|||
)
|
||||
|
||||
tgs, err := testUpdateServices(respHandler)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, len(tgs), 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, len(tgs), 1)
|
||||
|
||||
tg := tgs[0]
|
||||
testutil.Equals(t, tg.Source, "eureka")
|
||||
testutil.Equals(t, len(tg.Targets), 4)
|
||||
require.Equal(t, tg.Source, "eureka")
|
||||
require.Equal(t, len(tg.Targets), 4)
|
||||
|
||||
tgt := tg.Targets[0]
|
||||
testutil.Equals(t, tgt[model.AddressLabel], model.LabelValue("config-service001.test.com:8080"))
|
||||
require.Equal(t, tgt[model.AddressLabel], model.LabelValue("config-service001.test.com:8080"))
|
||||
|
||||
tgt = tg.Targets[2]
|
||||
testutil.Equals(t, tgt[model.AddressLabel], model.LabelValue("meta-service002.test.com:8080"))
|
||||
require.Equal(t, tgt[model.AddressLabel], model.LabelValue("meta-service002.test.com:8080"))
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
@ -54,7 +54,7 @@ func newTestRunner(t *testing.T) *testRunner {
|
|||
t.Helper()
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "prometheus-file-sd")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
return &testRunner{
|
||||
T: t,
|
||||
|
@ -77,19 +77,19 @@ func (t *testRunner) copyFileTo(src string, name string) string {
|
|||
t.Helper()
|
||||
|
||||
newf, err := ioutil.TempFile(t.dir, "")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
f, err := os.Open(src)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = io.Copy(newf, f)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Ok(t, f.Close())
|
||||
testutil.Ok(t, newf.Close())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
require.NoError(t, newf.Close())
|
||||
|
||||
dst := filepath.Join(t.dir, name)
|
||||
err = os.Rename(newf.Name(), dst)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
return dst
|
||||
}
|
||||
|
@ -99,14 +99,14 @@ func (t *testRunner) writeString(file string, data string) {
|
|||
t.Helper()
|
||||
|
||||
newf, err := ioutil.TempFile(t.dir, "")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = newf.WriteString(data)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Ok(t, newf.Close())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, newf.Close())
|
||||
|
||||
err = os.Rename(newf.Name(), file)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// appendString appends a string to a file.
|
||||
|
@ -114,11 +114,11 @@ func (t *testRunner) appendString(file, data string) {
|
|||
t.Helper()
|
||||
|
||||
f, err := os.OpenFile(file, os.O_WRONLY|os.O_APPEND, 0)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer f.Close()
|
||||
|
||||
_, err = f.WriteString(data)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// run starts the file SD and the loop receiving target groups updates.
|
||||
|
@ -230,7 +230,7 @@ func (t *testRunner) requireTargetGroups(expected, got []*targetgroup.Group) {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
testutil.Equals(t, string(b1), string(b2))
|
||||
require.Equal(t, string(b1), string(b2))
|
||||
}
|
||||
|
||||
// validTg() maps to fixtures/valid.{json,yml}.
|
||||
|
@ -468,7 +468,7 @@ func TestRemoveFile(t *testing.T) {
|
|||
|
||||
// Verify that we receive the update about the target groups being removed.
|
||||
ref := runner.lastReceive()
|
||||
testutil.Ok(t, os.Remove(sdFile))
|
||||
require.NoError(t, os.Remove(sdFile))
|
||||
runner.requireUpdate(
|
||||
ref,
|
||||
[]*targetgroup.Group{
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
"github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/common/version"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/refresh"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
|
|
|
@ -16,10 +16,11 @@ package hetzner
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type hcloudSDTestSuite struct {
|
||||
|
@ -43,16 +44,16 @@ func TestHCloudSDRefresh(t *testing.T) {
|
|||
cfg.hcloudEndpoint = suite.Mock.Endpoint()
|
||||
|
||||
d, err := newHcloudDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
targetGroups, err := d.refresh(context.Background())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 1, len(targetGroups))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(targetGroups))
|
||||
|
||||
targetGroup := targetGroups[0]
|
||||
testutil.Assert(t, targetGroup != nil, "targetGroup should not be nil")
|
||||
testutil.Assert(t, targetGroup.Targets != nil, "targetGroup.targets should not be nil")
|
||||
testutil.Equals(t, 3, len(targetGroup.Targets))
|
||||
require.NotNil(t, targetGroup, "targetGroup should not be nil")
|
||||
require.NotNil(t, targetGroup.Targets, "targetGroup.targets should not be nil")
|
||||
require.Equal(t, 3, len(targetGroup.Targets))
|
||||
|
||||
for i, labelSet := range []model.LabelSet{
|
||||
{
|
||||
|
@ -118,7 +119,7 @@ func TestHCloudSDRefresh(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, labelSet, targetGroup.Targets[i])
|
||||
require.Equal(t, labelSet, targetGroup.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,14 @@ package hetzner
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
"time"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/hetznercloud/hcloud-go/hcloud"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery"
|
||||
"github.com/prometheus/prometheus/discovery/refresh"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
"github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/common/version"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/refresh"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
|
|
@ -16,11 +16,12 @@ package hetzner
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type robotSDTestSuite struct {
|
||||
|
@ -42,16 +43,16 @@ func TestRobotSDRefresh(t *testing.T) {
|
|||
cfg.robotEndpoint = suite.Mock.Endpoint()
|
||||
|
||||
d, err := newRobotDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
targetGroups, err := d.refresh(context.Background())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 1, len(targetGroups))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(targetGroups))
|
||||
|
||||
targetGroup := targetGroups[0]
|
||||
testutil.Assert(t, targetGroup != nil, "targetGroup should not be nil")
|
||||
testutil.Assert(t, targetGroup.Targets != nil, "targetGroup.targets should not be nil")
|
||||
testutil.Equals(t, 2, len(targetGroup.Targets))
|
||||
require.NotNil(t, targetGroup, "targetGroup should not be nil")
|
||||
require.NotNil(t, targetGroup.Targets, "targetGroup.targets should not be nil")
|
||||
require.Equal(t, 2, len(targetGroup.Targets))
|
||||
|
||||
for i, labelSet := range []model.LabelSet{
|
||||
{
|
||||
|
@ -79,7 +80,7 @@ func TestRobotSDRefresh(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, labelSet, targetGroup.Targets[i])
|
||||
require.Equal(t, labelSet, targetGroup.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -91,11 +92,11 @@ func TestRobotSDRefreshHandleError(t *testing.T) {
|
|||
cfg.robotEndpoint = suite.Mock.Endpoint()
|
||||
|
||||
d, err := newRobotDiscovery(&cfg, log.NewNopLogger())
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
targetGroups, err := d.refresh(context.Background())
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Equals(t, "non 2xx status '401' response during hetzner service discovery with role robot", err.Error())
|
||||
require.Error(t, err)
|
||||
require.Equal(t, "non 2xx status '401' response during hetzner service discovery with role robot", err.Error())
|
||||
|
||||
testutil.Equals(t, 0, len(targetGroups))
|
||||
require.Equal(t, 0, len(targetGroups))
|
||||
}
|
||||
|
|
|
@ -18,12 +18,13 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
disv1beta1 "k8s.io/api/discovery/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
func strptr(str string) *string {
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/stretchr/testify/require"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
|
@ -150,7 +151,7 @@ func requireTargetGroups(t *testing.T, expected, res map[string]*targetgroup.Gro
|
|||
panic(err)
|
||||
}
|
||||
|
||||
testutil.Equals(t, string(b1), string(b2))
|
||||
require.Equal(t, string(b1), string(b2))
|
||||
}
|
||||
|
||||
type hasSynced interface {
|
||||
|
|
|
@ -16,7 +16,6 @@ package discovery
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
@ -25,6 +24,8 @@ import (
|
|||
"github.com/go-kit/kit/log"
|
||||
client_testutil "github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
@ -696,25 +697,12 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
|
||||
func assertEqualGroups(t *testing.T, got, expected []*targetgroup.Group, msg func(got, expected string) string) {
|
||||
t.Helper()
|
||||
format := func(groups []*targetgroup.Group) string {
|
||||
var s string
|
||||
for i, group := range groups {
|
||||
if i > 0 {
|
||||
s += ","
|
||||
}
|
||||
s += group.Source + ":" + fmt.Sprint(group.Targets)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Need to sort by the groups's source as the received order is not guaranteed.
|
||||
sort.Sort(byGroupSource(got))
|
||||
sort.Sort(byGroupSource(expected))
|
||||
|
||||
if !reflect.DeepEqual(got, expected) {
|
||||
t.Errorf(msg(format(got), format(expected)))
|
||||
}
|
||||
|
||||
require.Equal(t, expected, got)
|
||||
}
|
||||
|
||||
func staticConfig(addrs ...string) StaticConfig {
|
||||
|
@ -894,10 +882,7 @@ func TestApplyConfigDoesNotModifyStaticTargets(t *testing.T) {
|
|||
<-discoveryManager.SyncCh()
|
||||
|
||||
for _, cfg := range cfgs {
|
||||
if !reflect.DeepEqual(originalConfig, cfg) {
|
||||
t.Fatalf("discovery manager modified static config \n expected: %v\n got: %v\n",
|
||||
originalConfig, cfg)
|
||||
}
|
||||
require.Equal(t, originalConfig, cfg)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
|
|
|
@ -15,11 +15,10 @@ package openstack
|
|||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type OpenstackSDHypervisorTestSuite struct {
|
||||
|
@ -55,12 +54,12 @@ func TestOpenstackSDHypervisorRefresh(t *testing.T) {
|
|||
hypervisor, _ := mock.openstackAuthSuccess()
|
||||
ctx := context.Background()
|
||||
tgs, err := hypervisor.refresh(ctx)
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.Equal(t, 1, len(tgs))
|
||||
tg := tgs[0]
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, tg != nil, "")
|
||||
testutil.Assert(t, tg.Targets != nil, "")
|
||||
testutil.Equals(t, 2, len(tg.Targets))
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, tg)
|
||||
require.NotNil(t, tg.Targets)
|
||||
require.Equal(t, 2, len(tg.Targets))
|
||||
|
||||
for l, v := range map[string]string{
|
||||
"__address__": "172.16.70.14:0",
|
||||
|
@ -71,7 +70,7 @@ func TestOpenstackSDHypervisorRefresh(t *testing.T) {
|
|||
"__meta_openstack_hypervisor_status": "enabled",
|
||||
"__meta_openstack_hypervisor_id": "1",
|
||||
} {
|
||||
testutil.Equals(t, model.LabelValue(v), tg.Targets[0][model.LabelName(l)])
|
||||
require.Equal(t, model.LabelValue(v), tg.Targets[0][model.LabelName(l)])
|
||||
}
|
||||
|
||||
for l, v := range map[string]string{
|
||||
|
@ -83,7 +82,7 @@ func TestOpenstackSDHypervisorRefresh(t *testing.T) {
|
|||
"__meta_openstack_hypervisor_status": "enabled",
|
||||
"__meta_openstack_hypervisor_id": "721",
|
||||
} {
|
||||
testutil.Equals(t, model.LabelValue(v), tg.Targets[1][model.LabelName(l)])
|
||||
require.Equal(t, model.LabelValue(v), tg.Targets[1][model.LabelName(l)])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +94,6 @@ func TestOpenstackSDHypervisorRefreshWithDoneContext(t *testing.T) {
|
|||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, err := hypervisor.refresh(ctx)
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Assert(t, strings.Contains(err.Error(), context.Canceled.Error()), "%q doesn't contain %q", err, context.Canceled)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), context.Canceled.Error(), "%q doesn't contain %q", err, context.Canceled)
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/gophercloud/gophercloud/pagination"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
)
|
||||
|
|
|
@ -16,11 +16,10 @@ package openstack
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type OpenstackSDInstanceTestSuite struct {
|
||||
|
@ -57,18 +56,18 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
|
|||
mock.SetupTest(t)
|
||||
|
||||
instance, err := mock.openstackAuthSuccess()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
tgs, err := instance.refresh(ctx)
|
||||
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(tgs))
|
||||
|
||||
tg := tgs[0]
|
||||
testutil.Assert(t, tg != nil, "")
|
||||
testutil.Assert(t, tg.Targets != nil, "")
|
||||
testutil.Equals(t, 4, len(tg.Targets))
|
||||
require.NotNil(t, tg)
|
||||
require.NotNil(t, tg.Targets)
|
||||
require.Equal(t, 4, len(tg.Targets))
|
||||
|
||||
for i, lbls := range []model.LabelSet{
|
||||
{
|
||||
|
@ -121,7 +120,7 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
|
||||
testutil.Equals(t, lbls, tg.Targets[i])
|
||||
require.Equal(t, lbls, tg.Targets[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +133,6 @@ func TestOpenstackSDInstanceRefreshWithDoneContext(t *testing.T) {
|
|||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, err := hypervisor.refresh(ctx)
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Assert(t, strings.Contains(err.Error(), context.Canceled.Error()), "%q doesn't contain %q", err, context.Canceled)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), context.Canceled.Error(), "%q doesn't contain %q", err, context.Canceled)
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
@ -73,10 +73,10 @@ func TestRefresh(t *testing.T) {
|
|||
go d.Run(ctx, ch)
|
||||
|
||||
tg := <-ch
|
||||
testutil.Equals(t, tg1, tg)
|
||||
require.Equal(t, tg1, tg)
|
||||
|
||||
tg = <-ch
|
||||
testutil.Equals(t, tg2, tg)
|
||||
require.Equal(t, tg2, tg)
|
||||
|
||||
tick := time.NewTicker(2 * interval)
|
||||
defer tick.Stop()
|
||||
|
|
|
@ -21,8 +21,9 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -18,9 +18,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestTargetGroupStrictJsonUnmarshal(t *testing.T) {
|
||||
|
@ -54,8 +53,8 @@ func TestTargetGroupStrictJsonUnmarshal(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
tg := Group{}
|
||||
actual := tg.UnmarshalJSON([]byte(test.json))
|
||||
testutil.Equals(t, test.expectedReply, actual)
|
||||
testutil.Equals(t, test.expectedGroup, tg)
|
||||
require.Equal(t, test.expectedReply, actual)
|
||||
require.Equal(t, test.expectedGroup, tg)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -93,8 +92,8 @@ func TestTargetGroupYamlMarshal(t *testing.T) {
|
|||
|
||||
for _, test := range tests {
|
||||
actual, err := test.group.MarshalYAML()
|
||||
testutil.Equals(t, test.expectedErr, err)
|
||||
testutil.Equals(t, test.expectedYaml, string(marshal(actual)))
|
||||
require.Equal(t, test.expectedErr, err)
|
||||
require.Equal(t, test.expectedYaml, string(marshal(actual)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,8 +132,8 @@ func TestTargetGroupYamlUnmarshal(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
tg := Group{}
|
||||
actual := tg.UnmarshalYAML(unmarshal([]byte(test.yaml)))
|
||||
testutil.Equals(t, test.expectedReply, actual)
|
||||
testutil.Equals(t, test.expectedGroup, tg)
|
||||
require.Equal(t, test.expectedReply, actual)
|
||||
require.Equal(t, test.expectedGroup, tg)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -151,7 +150,7 @@ func TestString(t *testing.T) {
|
|||
Group{Targets: []model.LabelSet{},
|
||||
Source: "<source>",
|
||||
Labels: model.LabelSet{}}
|
||||
testutil.Equals(t, "<source>", group1.String())
|
||||
testutil.Equals(t, "<source>", group2.String())
|
||||
testutil.Equals(t, group1.String(), group2.String())
|
||||
require.Equal(t, "<source>", group1.String())
|
||||
require.Equal(t, "<source>", group2.String())
|
||||
require.Equal(t, group1.String(), group2.String())
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ import (
|
|||
|
||||
"github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -85,54 +84,54 @@ func newTritonDiscovery(c SDConfig) (*Discovery, error) {
|
|||
|
||||
func TestTritonSDNew(t *testing.T) {
|
||||
td, err := newTritonDiscovery(conf)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, td != nil, "")
|
||||
testutil.Assert(t, td.client != nil, "")
|
||||
testutil.Assert(t, td.interval != 0, "")
|
||||
testutil.Assert(t, td.sdConfig != nil, "")
|
||||
testutil.Equals(t, conf.Account, td.sdConfig.Account)
|
||||
testutil.Equals(t, conf.DNSSuffix, td.sdConfig.DNSSuffix)
|
||||
testutil.Equals(t, conf.Endpoint, td.sdConfig.Endpoint)
|
||||
testutil.Equals(t, conf.Port, td.sdConfig.Port)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, td)
|
||||
require.NotNil(t, td.client)
|
||||
require.NotZero(t, td.interval)
|
||||
require.NotNil(t, td.sdConfig)
|
||||
require.Equal(t, conf.Account, td.sdConfig.Account)
|
||||
require.Equal(t, conf.DNSSuffix, td.sdConfig.DNSSuffix)
|
||||
require.Equal(t, conf.Endpoint, td.sdConfig.Endpoint)
|
||||
require.Equal(t, conf.Port, td.sdConfig.Port)
|
||||
}
|
||||
|
||||
func TestTritonSDNewBadConfig(t *testing.T) {
|
||||
td, err := newTritonDiscovery(badconf)
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Assert(t, td == nil, "")
|
||||
require.Error(t, err)
|
||||
require.Nil(t, td)
|
||||
}
|
||||
|
||||
func TestTritonSDNewGroupsConfig(t *testing.T) {
|
||||
td, err := newTritonDiscovery(groupsconf)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, td != nil, "")
|
||||
testutil.Assert(t, td.client != nil, "")
|
||||
testutil.Assert(t, td.interval != 0, "")
|
||||
testutil.Assert(t, td.sdConfig != nil, "")
|
||||
testutil.Equals(t, groupsconf.Account, td.sdConfig.Account)
|
||||
testutil.Equals(t, groupsconf.DNSSuffix, td.sdConfig.DNSSuffix)
|
||||
testutil.Equals(t, groupsconf.Endpoint, td.sdConfig.Endpoint)
|
||||
testutil.Equals(t, groupsconf.Groups, td.sdConfig.Groups)
|
||||
testutil.Equals(t, groupsconf.Port, td.sdConfig.Port)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, td)
|
||||
require.NotNil(t, td.client)
|
||||
require.NotZero(t, td.interval)
|
||||
require.NotNil(t, td.sdConfig)
|
||||
require.Equal(t, groupsconf.Account, td.sdConfig.Account)
|
||||
require.Equal(t, groupsconf.DNSSuffix, td.sdConfig.DNSSuffix)
|
||||
require.Equal(t, groupsconf.Endpoint, td.sdConfig.Endpoint)
|
||||
require.Equal(t, groupsconf.Groups, td.sdConfig.Groups)
|
||||
require.Equal(t, groupsconf.Port, td.sdConfig.Port)
|
||||
}
|
||||
|
||||
func TestTritonSDNewCNConfig(t *testing.T) {
|
||||
td, err := newTritonDiscovery(cnconf)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, td != nil, "")
|
||||
testutil.Assert(t, td.client != nil, "")
|
||||
testutil.Assert(t, td.interval != 0, "")
|
||||
testutil.Assert(t, td.sdConfig != nil, "")
|
||||
testutil.Equals(t, cnconf.Role, td.sdConfig.Role)
|
||||
testutil.Equals(t, cnconf.Account, td.sdConfig.Account)
|
||||
testutil.Equals(t, cnconf.DNSSuffix, td.sdConfig.DNSSuffix)
|
||||
testutil.Equals(t, cnconf.Endpoint, td.sdConfig.Endpoint)
|
||||
testutil.Equals(t, cnconf.Port, td.sdConfig.Port)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, td)
|
||||
require.NotNil(t, td.client)
|
||||
require.NotZero(t, td.interval)
|
||||
require.NotZero(t, td.sdConfig)
|
||||
require.Equal(t, cnconf.Role, td.sdConfig.Role)
|
||||
require.Equal(t, cnconf.Account, td.sdConfig.Account)
|
||||
require.Equal(t, cnconf.DNSSuffix, td.sdConfig.DNSSuffix)
|
||||
require.Equal(t, cnconf.Endpoint, td.sdConfig.Endpoint)
|
||||
require.Equal(t, cnconf.Port, td.sdConfig.Port)
|
||||
}
|
||||
|
||||
func TestTritonSDRefreshNoTargets(t *testing.T) {
|
||||
tgts := testTritonSDRefresh(t, conf, "{\"containers\":[]}")
|
||||
testutil.Assert(t, tgts == nil, "")
|
||||
require.Nil(t, tgts)
|
||||
}
|
||||
|
||||
func TestTritonSDRefreshMultipleTargets(t *testing.T) {
|
||||
|
@ -157,8 +156,8 @@ func TestTritonSDRefreshMultipleTargets(t *testing.T) {
|
|||
)
|
||||
|
||||
tgts := testTritonSDRefresh(t, conf, dstr)
|
||||
testutil.Assert(t, tgts != nil, "")
|
||||
testutil.Equals(t, 2, len(tgts))
|
||||
require.NotNil(t, tgts)
|
||||
require.Equal(t, 2, len(tgts))
|
||||
}
|
||||
|
||||
func TestTritonSDRefreshNoServer(t *testing.T) {
|
||||
|
@ -167,8 +166,8 @@ func TestTritonSDRefreshNoServer(t *testing.T) {
|
|||
)
|
||||
|
||||
_, err := td.refresh(context.Background())
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Equals(t, strings.Contains(err.Error(), "an error occurred when requesting targets from the discovery endpoint"), true)
|
||||
require.Error(t, err)
|
||||
require.Equal(t, strings.Contains(err.Error(), "an error occurred when requesting targets from the discovery endpoint"), true)
|
||||
}
|
||||
|
||||
func TestTritonSDRefreshCancelled(t *testing.T) {
|
||||
|
@ -179,8 +178,8 @@ func TestTritonSDRefreshCancelled(t *testing.T) {
|
|||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, err := td.refresh(ctx)
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Equals(t, strings.Contains(err.Error(), context.Canceled.Error()), true)
|
||||
require.Error(t, err)
|
||||
require.Equal(t, strings.Contains(err.Error(), context.Canceled.Error()), true)
|
||||
}
|
||||
|
||||
func TestTritonSDRefreshCNsUUIDOnly(t *testing.T) {
|
||||
|
@ -196,8 +195,8 @@ func TestTritonSDRefreshCNsUUIDOnly(t *testing.T) {
|
|||
)
|
||||
|
||||
tgts := testTritonSDRefresh(t, cnconf, dstr)
|
||||
testutil.Assert(t, tgts != nil, "")
|
||||
testutil.Equals(t, 2, len(tgts))
|
||||
require.NotNil(t, tgts)
|
||||
require.Equal(t, 2, len(tgts))
|
||||
}
|
||||
|
||||
func TestTritonSDRefreshCNsWithHostname(t *testing.T) {
|
||||
|
@ -215,8 +214,8 @@ func TestTritonSDRefreshCNsWithHostname(t *testing.T) {
|
|||
)
|
||||
|
||||
tgts := testTritonSDRefresh(t, cnconf, dstr)
|
||||
testutil.Assert(t, tgts != nil, "")
|
||||
testutil.Equals(t, 2, len(tgts))
|
||||
require.NotNil(t, tgts)
|
||||
require.Equal(t, 2, len(tgts))
|
||||
}
|
||||
|
||||
func testTritonSDRefresh(t *testing.T, c SDConfig, dstr string) []model.LabelSet {
|
||||
|
@ -230,25 +229,25 @@ func testTritonSDRefresh(t *testing.T, c SDConfig, dstr string) []model.LabelSet
|
|||
defer s.Close()
|
||||
|
||||
u, err := url.Parse(s.URL)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, u != nil, "")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, u)
|
||||
|
||||
host, strport, err := net.SplitHostPort(u.Host)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, host != "", "")
|
||||
testutil.Assert(t, strport != "", "")
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, host)
|
||||
require.NotEmpty(t, strport)
|
||||
|
||||
port, err := strconv.Atoi(strport)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, port != 0, "")
|
||||
require.NoError(t, err)
|
||||
require.NotZero(t, port)
|
||||
|
||||
td.sdConfig.Port = port
|
||||
|
||||
tgs, err := td.refresh(context.Background())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 1, len(tgs))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(tgs))
|
||||
tg := tgs[0]
|
||||
testutil.Assert(t, tg != nil, "")
|
||||
require.NotNil(t, tg)
|
||||
|
||||
return tg.Targets
|
||||
}
|
||||
|
|
|
@ -577,6 +577,16 @@ role: <string>
|
|||
# tasks and services that don't have published ports.
|
||||
[ port: <int> | default = 80 ]
|
||||
|
||||
# Optional filters to limit the discovery process to a subset of available
|
||||
# resources.
|
||||
# The available filters are listed in the upstream documentation:
|
||||
# Services: https://docs.docker.com/engine/api/v1.40/#operation/ServiceList
|
||||
# Tasks: https://docs.docker.com/engine/api/v1.40/#operation/TaskList
|
||||
# Nodes: https://docs.docker.com/engine/api/v1.40/#operation/NodeList
|
||||
[ filters:
|
||||
[ - name: <string>
|
||||
values: <string>, [...] ]
|
||||
|
||||
# The time after which the droplets are refreshed.
|
||||
[ refresh_interval: <duration> | default = 60s ]
|
||||
|
||||
|
@ -598,6 +608,11 @@ basic_auth:
|
|||
[ bearer_token_file: <filename> ]
|
||||
```
|
||||
|
||||
The [relabeling phase](#relabel_config) is the preferred and more powerful
|
||||
way to filter tasks, services or nodes. For users with thousands of tasks it
|
||||
can be more efficient to use the Swarm API directly which has basic support for
|
||||
filtering nodes (using `filters`).
|
||||
|
||||
See [this example Prometheus configuration file](/documentation/examples/prometheus-dockerswarm.yml)
|
||||
for a detailed example of configuring Prometheus for Docker Swarm.
|
||||
|
||||
|
@ -647,6 +662,7 @@ The following meta labels are available on targets during [relabeling](#relabel_
|
|||
* `__meta_ec2_instance_lifecycle`: the lifecycle of the EC2 instance, set only for 'spot' or 'scheduled' instances, absent otherwise
|
||||
* `__meta_ec2_instance_state`: the state of the EC2 instance
|
||||
* `__meta_ec2_instance_type`: the type of the EC2 instance
|
||||
* `__meta_ec2_ipv6_addresses`: comma seperated list of IPv6 addresses assigned to the instance's network interfaces, if present
|
||||
* `__meta_ec2_owner_id`: the ID of the AWS account that owns the EC2 instance
|
||||
* `__meta_ec2_platform`: the Operating System platform, set to 'windows' on Windows servers, absent otherwise
|
||||
* `__meta_ec2_primary_subnet_id`: the subnet ID of the primary network interface, if available
|
||||
|
@ -1741,20 +1757,28 @@ queue_config:
|
|||
# samples from the WAL. It is recommended to have enough capacity in each
|
||||
# shard to buffer several requests to keep throughput up while processing
|
||||
# occasional slow remote requests.
|
||||
[ capacity: <int> | default = 500 ]
|
||||
[ capacity: <int> | default = 2500 ]
|
||||
# Maximum number of shards, i.e. amount of concurrency.
|
||||
[ max_shards: <int> | default = 1000 ]
|
||||
[ max_shards: <int> | default = 200 ]
|
||||
# Minimum number of shards, i.e. amount of concurrency.
|
||||
[ min_shards: <int> | default = 1 ]
|
||||
# Maximum number of samples per send.
|
||||
[ max_samples_per_send: <int> | default = 100]
|
||||
[ max_samples_per_send: <int> | default = 500]
|
||||
# Maximum time a sample will wait in buffer.
|
||||
[ batch_send_deadline: <duration> | default = 5s ]
|
||||
# Initial retry delay. Gets doubled for every retry.
|
||||
[ min_backoff: <duration> | default = 30ms ]
|
||||
# Maximum retry delay.
|
||||
[ max_backoff: <duration> | default = 100ms ]
|
||||
|
||||
# Configures the sending of series metadata to remote storage.
|
||||
# Metadata configuration is subject to change at any point
|
||||
# or be removed in future releases.
|
||||
metadata_config:
|
||||
# Whether metric metadata is sent to remote storage or not.
|
||||
[ send: <boolean> | default = true ]
|
||||
# How frequently metric metadata is sent to remote storage.
|
||||
[ send_interval: <duration> | default = 1m ]
|
||||
|
||||
```
|
||||
|
||||
There is a list of
|
||||
|
|
|
@ -45,8 +45,10 @@ dashboards, which need to query the same expression repeatedly every time they
|
|||
refresh.
|
||||
|
||||
Recording and alerting rules exist in a rule group. Rules within a group are
|
||||
run sequentially at a regular interval. The names of recording and alerting rules
|
||||
run sequentially at a regular interval. The names of recording rules
|
||||
must be [valid metric names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
|
||||
The names of alerting rules must be
|
||||
[valid label values](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
|
||||
|
||||
The syntax of a rule file is:
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ versions.
|
|||
| match | pattern, text | boolean | [regexp.MatchString](https://golang.org/pkg/regexp/#MatchString) Tests for a unanchored regexp match. |
|
||||
| reReplaceAll | pattern, replacement, text | string | [Regexp.ReplaceAllString](https://golang.org/pkg/regexp/#Regexp.ReplaceAllString) Regexp substitution, unanchored. |
|
||||
| graphLink | expr | string | Returns path to graph view in the [expression browser](https://prometheus.io/docs/visualization/browser/) for the expression. |
|
||||
| tableLink | expr | string | Returns path to tabular ("Console") view in the [expression browser](https://prometheus.io/docs/visualization/browser/) for the expression. |
|
||||
| tableLink | expr | string | Returns path to tabular ("Table") view in the [expression browser](https://prometheus.io/docs/visualization/browser/) for the expression. |
|
||||
|
||||
### Others
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ sort_rank: 1
|
|||
# Getting started
|
||||
|
||||
This guide is a "Hello World"-style tutorial which shows how to install,
|
||||
configure, and use Prometheus in a simple example setup. You will download and run
|
||||
configure, and use a simple Prometheus instance. You will download and run
|
||||
Prometheus locally, configure it to scrape itself and an example application,
|
||||
and then work with queries, rules, and graphs to make use of the collected time
|
||||
then work with queries, rules, and graphs to use collected time
|
||||
series data.
|
||||
|
||||
## Downloading and running Prometheus
|
||||
|
@ -25,12 +25,12 @@ Before starting Prometheus, let's configure it.
|
|||
|
||||
## Configuring Prometheus to monitor itself
|
||||
|
||||
Prometheus collects metrics from monitored targets by scraping metrics HTTP
|
||||
endpoints on these targets. Since Prometheus also exposes data in the same
|
||||
Prometheus collects metrics from _targets_ by scraping metrics HTTP
|
||||
endpoints. Since Prometheus exposes data in the same
|
||||
manner about itself, it can also scrape and monitor its own health.
|
||||
|
||||
While a Prometheus server that collects only data about itself is not very
|
||||
useful in practice, it is a good starting example. Save the following basic
|
||||
useful, it is a good starting example. Save the following basic
|
||||
Prometheus configuration as a file named `prometheus.yml`:
|
||||
|
||||
```yaml
|
||||
|
@ -79,26 +79,26 @@ navigating to its metrics endpoint:
|
|||
|
||||
## Using the expression browser
|
||||
|
||||
Let us try looking at some data that Prometheus has collected about itself. To
|
||||
Let us explore data that Prometheus has collected about itself. To
|
||||
use Prometheus's built-in expression browser, navigate to
|
||||
http://localhost:9090/graph and choose the "Console" view within the "Graph" tab.
|
||||
|
||||
As you can gather from [localhost:9090/metrics](http://localhost:9090/metrics),
|
||||
one metric that Prometheus exports about itself is called
|
||||
one metric that Prometheus exports about itself is named
|
||||
`prometheus_target_interval_length_seconds` (the actual amount of time between
|
||||
target scrapes). Go ahead and enter this into the expression console and then click "Execute":
|
||||
target scrapes). Enter the below into the expression console and then click "Execute":
|
||||
|
||||
```
|
||||
prometheus_target_interval_length_seconds
|
||||
```
|
||||
|
||||
This should return a number of different time series (along with the latest value
|
||||
recorded for each), all with the metric name
|
||||
recorded for each), each with the metric name
|
||||
`prometheus_target_interval_length_seconds`, but with different labels. These
|
||||
labels designate different latency percentiles and target group intervals.
|
||||
|
||||
If we were only interested in the 99th percentile latencies, we could use this
|
||||
query to retrieve that information:
|
||||
If we are interested only in 99th percentile latencies, we could use this
|
||||
query:
|
||||
|
||||
```
|
||||
prometheus_target_interval_length_seconds{quantile="0.99"}
|
||||
|
@ -129,8 +129,7 @@ Experiment with the graph range parameters and other settings.
|
|||
|
||||
## Starting up some sample targets
|
||||
|
||||
Let us make this more interesting and start some example targets for Prometheus
|
||||
to scrape.
|
||||
Let's add additional targets for Prometheus to scrape.
|
||||
|
||||
The Node Exporter is used as an example target, for more information on using it
|
||||
[see these instructions.](https://prometheus.io/docs/guides/node-exporter/)
|
||||
|
@ -151,7 +150,7 @@ http://localhost:8081/metrics, and http://localhost:8082/metrics.
|
|||
## Configure Prometheus to monitor the sample targets
|
||||
|
||||
Now we will configure Prometheus to scrape these new targets. Let's group all
|
||||
three endpoints into one job called `node`. However, imagine that the
|
||||
three endpoints into one job called `node`. We will imagine that the
|
||||
first two endpoints are production targets, while the third one represents a
|
||||
canary instance. To model this in Prometheus, we can add several groups of
|
||||
endpoints to a single job, adding extra labels to each group of targets. In
|
||||
|
@ -185,8 +184,8 @@ about time series that these example endpoints expose, such as `node_cpu_seconds
|
|||
|
||||
Though not a problem in our example, queries that aggregate over thousands of
|
||||
time series can get slow when computed ad-hoc. To make this more efficient,
|
||||
Prometheus allows you to prerecord expressions into completely new persisted
|
||||
time series via configured recording rules. Let's say we are interested in
|
||||
Prometheus can prerecord expressions into new persisted
|
||||
time series via configured _recording rules_. Let's say we are interested in
|
||||
recording the per-second rate of cpu time (`node_cpu_seconds_total`) averaged
|
||||
over all cpus per instance (but preserving the `job`, `instance` and `mode`
|
||||
dimensions) as measured over a window of 5 minutes. We could write this as:
|
||||
|
|
|
@ -5,7 +5,7 @@ sort_rank: 7
|
|||
|
||||
# Management API
|
||||
|
||||
Prometheus provides a set of management API to ease automation and integrations.
|
||||
Prometheus provides a set of management APIs to facilitate automation and integration.
|
||||
|
||||
|
||||
### Health check
|
||||
|
|
|
@ -11,10 +11,10 @@ This document offers guidance on migrating from Prometheus 1.8 to Prometheus 2.0
|
|||
|
||||
## Flags
|
||||
|
||||
The format of the Prometheus command line flags has changed. Instead of a
|
||||
The format of Prometheus command line flags has changed. Instead of a
|
||||
single dash, all flags now use a double dash. Common flags (`--config.file`,
|
||||
`--web.listen-address` and `--web.external-url`) are still the same but beyond
|
||||
that, almost all the storage-related flags have been removed.
|
||||
`--web.listen-address` and `--web.external-url`) remain but
|
||||
almost all storage-related flags have been removed.
|
||||
|
||||
Some notable flags which have been removed:
|
||||
|
||||
|
@ -27,11 +27,11 @@ Some notable flags which have been removed:
|
|||
- `-query.staleness-delta` has been renamed to `--query.lookback-delta`; Prometheus
|
||||
2.0 introduces a new mechanism for handling staleness, see [staleness](querying/basics.md#staleness).
|
||||
|
||||
- `-storage.local.*` Prometheus 2.0 introduces a new storage engine, as such all
|
||||
- `-storage.local.*` Prometheus 2.0 introduces a new storage engine; as such all
|
||||
flags relating to the old engine have been removed. For information on the
|
||||
new engine, see [Storage](#storage).
|
||||
|
||||
- `-storage.remote.*` Prometheus 2.0 has removed the already deprecated remote
|
||||
- `-storage.remote.*` Prometheus 2.0 has removed the deprecated remote
|
||||
storage flags, and will fail to start if they are supplied. To write to
|
||||
InfluxDB, Graphite, or OpenTSDB use the relevant storage adapter.
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ syntax](https://github.com/google/re2/wiki/Syntax).
|
|||
|
||||
Range vector literals work like instant vector literals, except that they
|
||||
select a range of samples back from the current instant. Syntactically, a [time
|
||||
duration](#time_durations) is appended in square brackets (`[]`) at the end of a
|
||||
duration](#time-durations) is appended in square brackets (`[]`) at the end of a
|
||||
vector selector to specify how far back in time values should be fetched for
|
||||
each resulting range vector element.
|
||||
|
||||
|
|
|
@ -9,15 +9,22 @@ Prometheus includes a local on-disk time series database, but also optionally in
|
|||
|
||||
## Local storage
|
||||
|
||||
Prometheus's local time series database stores time series data in a custom format on disk.
|
||||
Prometheus's local time series database stores data in a custom, highly efficient format on local storage.
|
||||
|
||||
### On-disk layout
|
||||
|
||||
Ingested samples are grouped into blocks of two hours. Each two-hour block consists of a directory containing one or more chunk files that contain all time series samples for that window of time, as well as a metadata file and index file (which indexes metric names and labels to time series in the chunk files). When series are deleted via the API, deletion records are stored in separate tombstone files (instead of deleting the data immediately from the chunk files).
|
||||
|
||||
The block for currently incoming samples is kept in memory and not fully persisted yet. It is secured against crashes by a write-ahead log (WAL) that can be replayed when the Prometheus server restarts after a crash. Write-ahead log files are stored in the `wal` directory in 128MB segments. These files contain raw data that has not been compacted yet, so they are significantly larger than regular block files. Prometheus will keep a minimum of 3 write-ahead log files, however high-traffic servers may see more than three WAL files since it needs to keep at least two hours worth of raw data.
|
||||
The current block for incoming samples is kept in memory and is not fully
|
||||
persisted. It is secured against crashes by a write-ahead log (WAL) that can be
|
||||
replayed when the Prometheus server restarts. Write-ahead log files are stored
|
||||
in the `wal` directory in 128MB segments. These files contain raw data that
|
||||
has not yet been compacted; thus they are significantly larger than regular block
|
||||
files. Prometheus will retain a minimum of three write-ahead log files.
|
||||
High-traffic servers may retain more than three WAL files in order to to keep at
|
||||
least two hours of raw data.
|
||||
|
||||
The directory structure of a Prometheus server's data directory will look something like this:
|
||||
A Prometheus server's data directory looks something like this:
|
||||
|
||||
```
|
||||
./data
|
||||
|
@ -46,7 +53,12 @@ The directory structure of a Prometheus server's data directory will look someth
|
|||
```
|
||||
|
||||
|
||||
Note that a limitation of the local storage is that it is not clustered or replicated. Thus, it is not arbitrarily scalable or durable in the face of disk or node outages and should be treated as you would any other kind of single node database. Using RAID for disk availability, [snapshots](querying/api.md#snapshot) for backups, capacity planning, etc, is recommended for improved durability. With proper storage durability and planning, storing years of data in the local storage is possible.
|
||||
Note that a limitation of local storage is that it is not clustered or
|
||||
replicated. Thus, it is not arbitrarily scalable or durable in the face of
|
||||
drive or node outages and should be managed like any other single node
|
||||
database. The use of RAID is suggested for storage availability, and [snapshots](querying/api.md#snapshot)
|
||||
are recommended for backups. With proper
|
||||
architecture, it is possible to retain years of data in local storage.
|
||||
|
||||
Alternatively, external storage may be used via the [remote read/write APIs](https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage). Careful evaluation is required for these systems as they vary greatly in durability, performance, and efficiency.
|
||||
|
||||
|
@ -56,37 +68,46 @@ For further details on file format, see [TSDB format](/tsdb/docs/format/README.m
|
|||
|
||||
The initial two-hour blocks are eventually compacted into longer blocks in the background.
|
||||
|
||||
Compaction will create larger blocks up to 10% of the retention time, or 31 days, whichever is smaller.
|
||||
Compaction will create larger blocks containing data spanning up to 10% of the retention time, or 31 days, whichever is smaller.
|
||||
|
||||
## Operational aspects
|
||||
|
||||
Prometheus has several flags that allow configuring the local storage. The most important ones are:
|
||||
Prometheus has several flags that configure local storage. The most important are:
|
||||
|
||||
* `--storage.tsdb.path`: This determines where Prometheus writes its database. Defaults to `data/`.
|
||||
* `--storage.tsdb.retention.time`: This determines when to remove old data. Defaults to `15d`. Overrides `storage.tsdb.retention` if this flag is set to anything other than default.
|
||||
* `--storage.tsdb.retention.size`: [EXPERIMENTAL] This determines the maximum number of bytes that storage blocks can use. The oldest data will be removed first. Defaults to `0` or disabled. This flag is experimental and can be changed in future releases. Units supported: B, KB, MB, GB, TB, PB, EB. Ex: "512MB"
|
||||
* `--storage.tsdb.retention`: This flag has been deprecated in favour of `storage.tsdb.retention.time`.
|
||||
* `--storage.tsdb.wal-compression`: This flag enables compression of the write-ahead log (WAL). Depending on your data, you can expect the WAL size to be halved with little extra cpu load. This flag was introduced in 2.11.0 and enabled by default in 2.20.0. Note that once enabled, downgrading Prometheus to a version below 2.11.0 will require deleting the WAL.
|
||||
* `--storage.tsdb.path`: Where Prometheus writes its database. Defaults to `data/`.
|
||||
* `--storage.tsdb.retention.time`: When to remove old data. Defaults to `15d`. Overrides `storage.tsdb.retention` if this flag is set to anything other than default.
|
||||
* `--storage.tsdb.retention.size`: [EXPERIMENTAL] The maximum number of bytes of storage blocks to retain. The oldest data will be removed first. Defaults to `0` or disabled. This flag is experimental and may change in future releases. Units supported: B, KB, MB, GB, TB, PB, EB. Ex: "512MB"
|
||||
* `--storage.tsdb.retention`: Deprecated in favor of `storage.tsdb.retention.time`.
|
||||
* `--storage.tsdb.wal-compression`: Enables compression of the write-ahead log (WAL). Depending on your data, you can expect the WAL size to be halved with little extra cpu load. This flag was introduced in 2.11.0 and enabled by default in 2.20.0. Note that once enabled, downgrading Prometheus to a version below 2.11.0 will require deleting the WAL.
|
||||
|
||||
On average, Prometheus uses only around 1-2 bytes per sample. Thus, to plan the capacity of a Prometheus server, you can use the rough formula:
|
||||
Prometheus stores an average of only 1-2 bytes per sample. Thus, to plan the capacity of a Prometheus server, you can use the rough formula:
|
||||
|
||||
```
|
||||
needed_disk_space = retention_time_seconds * ingested_samples_per_second * bytes_per_sample
|
||||
```
|
||||
|
||||
To tune the rate of ingested samples per second, you can either reduce the number of time series you scrape (fewer targets or fewer series per target), or you can increase the scrape interval. However, reducing the number of series is likely more effective, due to compression of samples within a series.
|
||||
To lower the rate of ingested samples, you can either reduce the number of time series you scrape (fewer targets or fewer series per target), or you can increase the scrape interval. However, reducing the number of series is likely more effective, due to compression of samples within a series.
|
||||
|
||||
If your local storage becomes corrupted for whatever reason, your best bet is to shut down Prometheus and remove the entire storage directory. You can try removing individual block directories, or WAL directory, to resolve the problem, this means losing a time window of around two hours worth of data per block directory. Again, Prometheus's local storage is not meant as durable long-term storage.
|
||||
If your local storage becomes corrupted for whatever reason, the best
|
||||
strategy to address the problenm is to shut down Prometheus then remove the
|
||||
entire storage directory. You can also try removing individual block directories,
|
||||
or the WAL directory to resolve the problem. Note that this means losing
|
||||
approximately two hours data per block directory. Again, Prometheus's local
|
||||
storage is not intended to be durable long-term storage; external solutions
|
||||
offer exteded retention and data durability.
|
||||
|
||||
CAUTION: Non-POSIX compliant filesystems are not supported by Prometheus' local storage as unrecoverable corruptions may happen. NFS filesystems (including AWS's EFS) are not supported. NFS could be POSIX-compliant, but most implementations are not. It is strongly recommended to use a local filesystem for reliability.
|
||||
CAUTION: Non-POSIX compliant filesystems are not supported for Prometheus' local storage as unrecoverable corruptions may happen. NFS filesystems (including AWS's EFS) are not supported. NFS could be POSIX-compliant, but most implementations are not. It is strongly recommended to use a local filesystem for reliability.
|
||||
|
||||
If both time and size retention policies are specified, whichever policy triggers first will be used at that instant.
|
||||
If both time and size retention policies are specified, whichever triggers first
|
||||
will be used.
|
||||
|
||||
Expired block cleanup happens on a background schedule. It may take up to two hours to remove expired blocks. Expired blocks must be fully expired before they are cleaned up.
|
||||
Expired block cleanup happens in the background. It may take up to two hours to remove expired blocks. Blocks must be fully expired before they are removed.
|
||||
|
||||
## Remote storage integrations
|
||||
|
||||
Prometheus's local storage is limited by single nodes in its scalability and durability. Instead of trying to solve clustered storage in Prometheus itself, Prometheus has a set of interfaces that allow integrating with remote storage systems.
|
||||
Prometheus's local storage is limited to a single node's scalability and durability.
|
||||
Instead of trying to solve clustered storage in Prometheus itself, Prometheus offers
|
||||
a set of interfaces that allow integrating with remote storage systems.
|
||||
|
||||
### Overview
|
||||
|
||||
|
|
|
@ -29,10 +29,11 @@ import (
|
|||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/prometheus/common/model"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/documentation/examples/custom-sd/adapter"
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
|
|
@ -15,13 +15,14 @@ package adapter
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
|
@ -231,9 +232,9 @@ func TestGenerateTargetGroups(t *testing.T) {
|
|||
func TestWriteOutput(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
tmpfile, err := ioutil.TempFile("", "sd_adapter_test")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer os.Remove(tmpfile.Name())
|
||||
tmpfile.Close()
|
||||
adapter := NewAdapter(ctx, tmpfile.Name(), "test_sd", nil, nil)
|
||||
testutil.Ok(t, adapter.writeOutput())
|
||||
require.NoError(t, adapter.writeOutput())
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ rules:
|
|||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups:
|
||||
- extensions
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- ingresses
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"time"
|
||||
|
||||
influx "github.com/influxdata/influxdb/client/v2"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
)
|
||||
|
||||
|
|
|
@ -29,16 +29,14 @@ import (
|
|||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/golang/snappy"
|
||||
influx "github.com/influxdata/influxdb/client/v2"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/prometheus/common/model"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
influx "github.com/influxdata/influxdb/client/v2"
|
||||
|
||||
"github.com/prometheus/common/promlog"
|
||||
"github.com/prometheus/common/promlog/flag"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/graphite"
|
||||
"github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/influxdb"
|
||||
|
|
|
@ -60,26 +60,6 @@
|
|||
description: '{{ printf "%%.1f" $value }}%% errors while sending alerts from Prometheus %(prometheusName)s to Alertmanager {{$labels.alertmanager}}.' % $._config,
|
||||
},
|
||||
},
|
||||
{
|
||||
alert: 'PrometheusErrorSendingAlertsToAnyAlertmanager',
|
||||
expr: |||
|
||||
min without(alertmanager) (
|
||||
rate(prometheus_notifications_errors_total{%(prometheusSelector)s}[5m])
|
||||
/
|
||||
rate(prometheus_notifications_sent_total{%(prometheusSelector)s}[5m])
|
||||
)
|
||||
* 100
|
||||
> 3
|
||||
||| % $._config,
|
||||
'for': '15m',
|
||||
labels: {
|
||||
severity: 'critical',
|
||||
},
|
||||
annotations: {
|
||||
summary: 'Prometheus encounters more than 3% errors sending alerts to any Alertmanager.',
|
||||
description: '{{ printf "%%.1f" $value }}%% minimum errors while sending alerts from Prometheus %(prometheusName)s to any Alertmanager.' % $._config,
|
||||
},
|
||||
},
|
||||
{
|
||||
alert: 'PrometheusNotConnectedToAlertmanagers',
|
||||
expr: |||
|
||||
|
@ -205,7 +185,7 @@
|
|||
# https://www.robustperception.io/alerting-on-gauges-in-prometheus-2-0 for details.
|
||||
(
|
||||
max_over_time(prometheus_remote_storage_highest_timestamp_in_seconds{%(prometheusSelector)s}[5m])
|
||||
- on(job, instance) group_right
|
||||
- ignoring(remote_name, url) group_right
|
||||
max_over_time(prometheus_remote_storage_queue_highest_sent_timestamp_seconds{%(prometheusSelector)s}[5m])
|
||||
)
|
||||
> 120
|
||||
|
@ -281,6 +261,123 @@
|
|||
description: 'Prometheus %(prometheusName)s has dropped {{ printf "%%.0f" $value }} targets because the number of targets exceeded the configured target_limit.' % $._config,
|
||||
},
|
||||
},
|
||||
] + if $._config.prometheusHAGroupLabels == '' then self.rulesWithoutHA else self.rulesWithHA,
|
||||
rulesWithoutHA:: [
|
||||
{
|
||||
alert: 'PrometheusErrorSendingAlertsToAnyAlertmanager',
|
||||
expr: |||
|
||||
min without (alertmanager) (
|
||||
rate(prometheus_notifications_errors_total{%(prometheusSelector)s}[5m])
|
||||
/
|
||||
rate(prometheus_notifications_sent_total{%(prometheusSelector)s}[5m])
|
||||
)
|
||||
* 100
|
||||
> 3
|
||||
||| % $._config,
|
||||
'for': '15m',
|
||||
labels: {
|
||||
severity: 'critical',
|
||||
},
|
||||
annotations: {
|
||||
summary: 'Prometheus encounters more than 3% errors sending alerts to any Alertmanager.',
|
||||
description: '{{ printf "%%.1f" $value }}%% minimum errors while sending alerts from Prometheus %(prometheusName)s to any Alertmanager.' % $._config,
|
||||
},
|
||||
},
|
||||
],
|
||||
rulesWithHA:: [
|
||||
{
|
||||
alert: 'PrometheusErrorSendingAlertsToAnyAlertmanager',
|
||||
expr: |||
|
||||
min by (%(prometheusHAGroupLabels)s) (
|
||||
rate(prometheus_notifications_errors_total{%(prometheusSelector)s}[5m])
|
||||
/
|
||||
rate(prometheus_notifications_sent_total{%(prometheusSelector)s}[5m])
|
||||
)
|
||||
* 100
|
||||
> 3
|
||||
||| % $._config,
|
||||
'for': '15m',
|
||||
labels: {
|
||||
severity: 'critical',
|
||||
},
|
||||
annotations: {
|
||||
summary: 'Each Prometheus server in an HA group encounters more than 3% errors sending alerts to any Alertmanager.',
|
||||
description: '{{ printf "%%.1f" $value }}%% minimum errors while sending alerts from any Prometheus server in HA group %(prometheusHAGroupName)s to any Alertmanager.' % $._config,
|
||||
},
|
||||
},
|
||||
{
|
||||
alert: 'PrometheusHAGroupNotIngestingSamples',
|
||||
expr: |||
|
||||
max by (%(prometheusHAGroupLabels)s) (
|
||||
rate(prometheus_tsdb_head_samples_appended_total{%(prometheusSelector)s}[5m])
|
||||
and
|
||||
(
|
||||
sum without(scrape_job) (prometheus_target_metadata_cache_entries{%(prometheusSelector)s}) > 0
|
||||
or
|
||||
sum without(rule_group) (prometheus_rule_group_rules{%(prometheusSelector)s}) > 0
|
||||
)
|
||||
)
|
||||
<= 0
|
||||
||| % $._config,
|
||||
'for': '10m',
|
||||
labels: {
|
||||
severity: 'critical',
|
||||
},
|
||||
annotations: {
|
||||
summary: 'A whole Prometheus HA group is not ingesting samples.',
|
||||
description: 'None of the Prometheus instances in HA group %(prometheusHAGroupName)s is ingesting any samples.' % $._config,
|
||||
},
|
||||
},
|
||||
// Both the following critical alerts, PrometheusHAGroupDown and
|
||||
// PrometheusHAGroupCrashlooping, fire if a whole HA group is
|
||||
// unhealthy. It is implied that a generic warning alert is in place
|
||||
// for individual instances being down or crashlooping.
|
||||
{
|
||||
alert: 'PrometheusHAGroupDown',
|
||||
expr: |||
|
||||
(
|
||||
count by (%(prometheusHAGroupLabels)s) (
|
||||
avg_over_time(up{%(prometheusSelector)s}[5m]) < 0.5
|
||||
)
|
||||
/
|
||||
count by (%(prometheusHAGroupLabels)s) (
|
||||
up{%(prometheusSelector)s}
|
||||
)
|
||||
)
|
||||
> 0.5
|
||||
||| % $._config,
|
||||
'for': '5m',
|
||||
labels: {
|
||||
severity: 'critical',
|
||||
},
|
||||
annotations: {
|
||||
summary: 'More than half of the Prometheus instances within the same HA group are down.',
|
||||
description: '{{ $value | humanizePercentage }} of Prometheus instances within the %(prometheusHAGroupName)s HA group have been up for less than half of the last 5m.' % $._config,
|
||||
},
|
||||
},
|
||||
{
|
||||
alert: 'PrometheusHAGroupCrashlooping',
|
||||
expr: |||
|
||||
(
|
||||
count by (%(prometheusHAGroupLabels)s) (
|
||||
changes(process_start_time_seconds{%(prometheusSelector)s}[30m]) > 4
|
||||
)
|
||||
/
|
||||
count by (%(prometheusHAGroupLabels)s) (
|
||||
up{%(prometheusSelector)s}
|
||||
)
|
||||
)
|
||||
> 0.5
|
||||
||| % $._config,
|
||||
'for': '5m',
|
||||
labels: {
|
||||
severity: 'critical',
|
||||
},
|
||||
annotations: {
|
||||
summary: 'More than half of the Prometheus instances within the same HA group are crashlooping.',
|
||||
description: '{{ $value | humanizePercentage }} of Prometheus instances within the %(prometheusHAGroupName)s HA group have restarted at least 5 times in the last 30m.' % $._config,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -5,6 +5,16 @@
|
|||
// servers.
|
||||
prometheusSelector: 'job="prometheus"',
|
||||
|
||||
// prometheusHAGroupLabels is a string with comma-separated labels
|
||||
// that are common labels of instances belonging to the same
|
||||
// high-availability group of Prometheus servers, i.e. identically
|
||||
// configured Prometheus servers. Include not only enough labels
|
||||
// to identify the members of the HA group, but also all common
|
||||
// labels you want to keep for resulting HA-group-level alerts.
|
||||
//
|
||||
// If this is set to an empty string, no HA-related alerts are applied.
|
||||
prometheusHAGroupLabels: '',
|
||||
|
||||
// prometheusName is inserted into annotations to name the Prometheus
|
||||
// instance affected by the alert.
|
||||
prometheusName: '{{$labels.instance}}',
|
||||
|
@ -12,5 +22,10 @@
|
|||
// Operator, you can make use of the configured target labels for
|
||||
// nicer naming:
|
||||
// prometheusNameTemplate: '{{$labels.namespace}}/{{$labels.pod}}'
|
||||
|
||||
// prometheusHAGroupName is inserted into annotations to name an
|
||||
// HA group. All labels used here must also be present in
|
||||
// prometheusHAGroupLabels above.
|
||||
prometheusHAGroupName: '{{$labels.job}}',
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
local g = import 'grafana-builder/grafana.libsonnet';
|
||||
local grafana = import 'grafonnet/grafana.libsonnet';
|
||||
local grafana = import 'github.com/grafana/grafonnet-lib/grafonnet/grafana.libsonnet';
|
||||
local g = import 'github.com/grafana/jsonnet-libs/grafana-builder/grafana.libsonnet';
|
||||
local dashboard = grafana.dashboard;
|
||||
local row = grafana.row;
|
||||
local singlestat = grafana.singlestat;
|
||||
|
|
|
@ -20,5 +20,5 @@
|
|||
"version": "master"
|
||||
}
|
||||
],
|
||||
"legacyImports": true
|
||||
"legacyImports": false
|
||||
}
|
||||
|
|
50
go.mod
50
go.mod
|
@ -3,9 +3,9 @@ module github.com/prometheus/prometheus
|
|||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go v46.4.0+incompatible
|
||||
github.com/Azure/azure-sdk-for-go v48.2.0+incompatible
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
|
||||
github.com/Azure/go-autorest/autorest v0.11.10
|
||||
github.com/Azure/go-autorest/autorest v0.11.11
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.5
|
||||
github.com/Azure/go-autorest/autorest/to v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/autorest/validation v0.2.0 // indirect
|
||||
|
@ -13,33 +13,32 @@ require (
|
|||
github.com/Microsoft/go-winio v0.4.14 // indirect
|
||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
|
||||
github.com/armon/go-metrics v0.3.3 // indirect
|
||||
github.com/aws/aws-sdk-go v1.35.5
|
||||
github.com/aws/aws-sdk-go v1.35.31
|
||||
github.com/cespare/xxhash/v2 v2.1.1
|
||||
github.com/containerd/containerd v1.3.4 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245
|
||||
github.com/digitalocean/godo v1.46.0
|
||||
github.com/digitalocean/godo v1.52.0
|
||||
github.com/docker/distribution v2.7.1+incompatible // indirect
|
||||
github.com/docker/docker v17.12.0-ce-rc1.0.20200706150819-a40b877fbb9e+incompatible
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/edsrzf/mmap-go v1.0.0
|
||||
github.com/go-kit/kit v0.10.0
|
||||
github.com/go-logfmt/logfmt v0.5.0
|
||||
github.com/go-openapi/strfmt v0.19.5
|
||||
github.com/go-openapi/strfmt v0.19.11
|
||||
github.com/go-openapi/validate v0.19.14 // indirect
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/golang/snappy v0.0.2
|
||||
github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7
|
||||
github.com/gophercloud/gophercloud v0.13.0
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.0
|
||||
github.com/google/pprof v0.0.0-20201117184057-ae444373da19
|
||||
github.com/gophercloud/gophercloud v0.14.0
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
github.com/hashicorp/consul/api v1.7.0
|
||||
github.com/hashicorp/go-hclog v0.12.2 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.2.0 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hetznercloud/hcloud-go v1.22.0
|
||||
github.com/hetznercloud/hcloud-go v1.23.1
|
||||
github.com/influxdata/influxdb v1.8.3
|
||||
github.com/json-iterator/go v1.1.10
|
||||
github.com/miekg/dns v1.1.31
|
||||
github.com/mitchellh/mapstructure v1.2.2 // indirect
|
||||
github.com/miekg/dns v1.1.35
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
|
||||
github.com/oklog/run v1.1.0
|
||||
|
@ -49,36 +48,35 @@ require (
|
|||
github.com/opentracing-contrib/go-stdlib v1.0.0
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/prometheus/alertmanager v0.21.0
|
||||
github.com/prometheus/client_golang v1.7.1
|
||||
github.com/prometheus/client_golang v1.8.0
|
||||
github.com/prometheus/client_model v0.2.0
|
||||
github.com/prometheus/common v0.14.0
|
||||
github.com/prometheus/common v0.15.0
|
||||
github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/uber/jaeger-client-go v2.25.0+incompatible
|
||||
github.com/uber/jaeger-lib v2.4.0+incompatible
|
||||
go.mongodb.org/mongo-driver v1.3.2 // indirect
|
||||
go.uber.org/atomic v1.7.0
|
||||
go.uber.org/goleak v1.1.10
|
||||
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
|
||||
golang.org/x/sync v0.0.0-20200930132711-30421366ff76
|
||||
golang.org/x/sys v0.0.0-20201008064518-c1f3e3309c71
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
|
||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
||||
golang.org/x/tools v0.0.0-20201008025239-9df69603baec
|
||||
google.golang.org/api v0.32.0
|
||||
golang.org/x/tools v0.0.0-20201119054027-25dc3e1ccc3c
|
||||
google.golang.org/api v0.35.0
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
||||
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
|
||||
gotest.tools v2.2.0+incompatible // indirect
|
||||
k8s.io/api v0.19.2
|
||||
k8s.io/apimachinery v0.19.2
|
||||
k8s.io/client-go v0.19.2
|
||||
k8s.io/api v0.19.4
|
||||
k8s.io/apimachinery v0.19.4
|
||||
k8s.io/client-go v0.19.4
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/klog/v2 v2.3.0
|
||||
k8s.io/klog/v2 v2.4.0
|
||||
)
|
||||
|
||||
replace (
|
||||
|
|
187
go.sum
187
go.sum
|
@ -11,7 +11,6 @@ cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gc
|
|||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||
cloud.google.com/go v0.56.0 h1:WRz29PgAsVEyPSDHyk+0fpEkwEFyfhHn+JbksT6gIL4=
|
||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8=
|
||||
|
@ -36,16 +35,16 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
|||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/Azure/azure-sdk-for-go v46.4.0+incompatible h1:fCN6Pi+tEiEwFa8RSmtVlFHRXEZ+DJm9gfx/MKqYWw4=
|
||||
github.com/Azure/azure-sdk-for-go v46.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||
github.com/Azure/azure-sdk-for-go v48.2.0+incompatible h1:+t2P1j1r5N6lYgPiiz7ZbEVZFkWjVe9WhHbMm0gg8hw=
|
||||
github.com/Azure/azure-sdk-for-go v48.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
|
||||
github.com/Azure/go-autorest/autorest v0.9.6/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
|
||||
github.com/Azure/go-autorest/autorest v0.11.10 h1:j5sGbX7uj1ieYYkQ3Mpvewd4DCsEQ+ZeJpqnSM9pjnM=
|
||||
github.com/Azure/go-autorest/autorest v0.11.10/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
|
||||
github.com/Azure/go-autorest/autorest v0.11.11 h1:k/wzH9pA3hrtFNsEhJ5SqPEs75W3bzS8VOYA/fJ0j1k=
|
||||
github.com/Azure/go-autorest/autorest v0.11.11/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.5 h1:Y3bBUV4rTuxenJJs41HU3qmqsb+auo+a3Lz+PlJPpL0=
|
||||
|
@ -63,11 +62,9 @@ github.com/Azure/go-autorest/autorest/to v0.3.0 h1:zebkZaadz7+wIQYgC7GXaz3Wb28yK
|
|||
github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA=
|
||||
github.com/Azure/go-autorest/autorest/validation v0.2.0 h1:15vMO4y76dehZSq7pAaOLQxC6dZYsSrj2GQpflyM/L4=
|
||||
github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI=
|
||||
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
|
||||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||
github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8Pcx+3oqrE=
|
||||
github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
|
||||
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
|
||||
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
|
||||
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
|
||||
|
@ -81,7 +78,6 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go
|
|||
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
|
||||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
|
@ -119,10 +115,14 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:l
|
|||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0=
|
||||
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/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
|
||||
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.35.5 h1:doSEOxC0UkirPcle20Rc+1kAhJ4Ip+GSEeZ3nKl7Qlk=
|
||||
github.com/aws/aws-sdk-go v1.35.5/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
|
||||
github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
|
||||
github.com/aws/aws-sdk-go v1.35.31 h1:6tlaYq4Q311qfhft/fIaND33XI27aW3zIdictcHxifE=
|
||||
github.com/aws/aws-sdk-go v1.35.31/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
|
@ -159,17 +159,17 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
|
|||
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=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245 h1:9cOfvEwjQxdwKuNDTQSaMKNRvwKwgZG+U4HrjeRKHso=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/digitalocean/godo v1.46.0 h1:WRbwjATilgz2NE4NGMeSDpeicy9h4xSKNGuRJ/Nq/fA=
|
||||
github.com/digitalocean/godo v1.46.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU=
|
||||
github.com/digitalocean/godo v1.52.0 h1:1QSUC0w5T1wS1d/1uvPtG8GLeD0p/4zhx1Q+Fxtna+k=
|
||||
github.com/digitalocean/godo v1.52.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU=
|
||||
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v17.12.0-ce-rc1.0.20200706150819-a40b877fbb9e+incompatible h1:+mzU0jHyjWpYHiD0StRlsVXkCvecWS2hc55M3OlUJSk=
|
||||
|
@ -205,7 +205,6 @@ github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTg
|
|||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
||||
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
|
@ -235,24 +234,34 @@ github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9sn
|
|||
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/analysis v0.19.14 h1:OPuUe8ApFeu59GeTsZtb0mLWHu5MipU4fDvxNLsG3bw=
|
||||
github.com/go-openapi/analysis v0.19.14/go.mod h1:zN0kY6i38wo2LQOwltVyMk61bqlqOm86n1/Iszo8F8Y=
|
||||
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/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-openapi/errors v0.19.4 h1:fSGwO1tSYHFu70NKaWJt5Qh0qoBRtCm/mXS1yhf+0W0=
|
||||
github.com/go-openapi/errors v0.19.4/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
|
||||
github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
|
||||
github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc=
|
||||
github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
|
||||
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
|
||||
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
|
||||
github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
|
||||
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
||||
github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w=
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
|
||||
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/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=
|
||||
github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
|
||||
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=
|
||||
|
@ -261,11 +270,16 @@ github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5
|
|||
github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk=
|
||||
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/loads v0.19.6 h1:6IAtnx22MNSjPocZZ2sV7EjgF6wW5rDC9r6ZkNxjiN8=
|
||||
github.com/go-openapi/loads v0.19.6/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc=
|
||||
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.24 h1:TqagMVlRAOTwllE/7hNKx6rQ10O6T8ZzeJdMjSTKaD4=
|
||||
github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk=
|
||||
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
|
||||
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=
|
||||
|
@ -274,6 +288,8 @@ github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8
|
|||
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.14 h1:r4fbYFo6N4ZelmSX8G6p+cv/hZRXzcuqQIADGT1iNKM=
|
||||
github.com/go-openapi/spec v0.19.14/go.mod h1:gwrgJS15eCUgjLpMjBJmbZezCsw88LmgeEip0M63doA=
|
||||
github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU=
|
||||
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=
|
||||
|
@ -282,6 +298,8 @@ github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6
|
|||
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.11 h1:0+YvbNh05rmBkgztd6zHp4OCFn7Mtu30bn46NQo2ZRw=
|
||||
github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc=
|
||||
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
|
||||
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=
|
||||
|
@ -290,13 +308,21 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh
|
|||
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/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY=
|
||||
github.com/go-openapi/swag v0.19.12 h1:Bc0bnY2c3AoF7Gc+IMIAQQsD8fLHjHpc19wXvYuayQI=
|
||||
github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M=
|
||||
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/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo=
|
||||
github.com/go-openapi/validate v0.19.8 h1:YFzsdWIDfVuLvIOF+ZmKjVg1MbPJ1QgY9PihMwei1ys=
|
||||
github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4=
|
||||
github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8=
|
||||
github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4=
|
||||
github.com/go-openapi/validate v0.19.14 h1:G/lAG8al3droiEQyYdK0IP71au/V63x4LWF3TFv9n/k=
|
||||
github.com/go-openapi/validate v0.19.14/go.mod h1:PdGrHe0rp6MG3A1SrAY/rIHATqzJEEhohGE1atLkBEQ=
|
||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
|
||||
|
@ -360,8 +386,9 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
|
|||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw=
|
||||
github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
|
@ -372,10 +399,8 @@ github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv
|
|||
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/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.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||
|
@ -393,34 +418,34 @@ github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hf
|
|||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99 h1:Ak8CrdlwwXwAZxzS66vgPt4U8yUZX7JwLvVR58FN5jM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7 h1:qYWTuM6SUNWgtvkhV8oH6GFHCpU+rKQOxPcepM3xKi0=
|
||||
github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201117184057-ae444373da19 h1:iFELRewmQ9CldLrqgr0E6b6ZPfZmMvLyyz6kMsR+c4w=
|
||||
github.com/google/pprof v0.0.0-20201117184057-ae444373da19/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I=
|
||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||
github.com/gophercloud/gophercloud v0.13.0 h1:1XkslZZRm6Ks0bLup+hBNth+KQf+0JA1UeoB7YKw9E8=
|
||||
github.com/gophercloud/gophercloud v0.13.0/go.mod h1:VX0Ibx85B60B5XOrZr6kaNwrmPUzcmMpwxvQ1WQIIWM=
|
||||
github.com/gophercloud/gophercloud v0.14.0 h1:c2Byo+YMxhHlTJ3TPptjQ4dOQ1YknTHDJ/9zClDH+84=
|
||||
github.com/gophercloud/gophercloud v0.14.0/go.mod h1:VX0Ibx85B60B5XOrZr6kaNwrmPUzcmMpwxvQ1WQIIWM=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.0 h1:ntPNC9TD/6l2XDenJZe6T5lSMg95thpV9sGAqHX4WU8=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.0/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
|
||||
github.com/hashicorp/consul/api v1.7.0 h1:tGs8Oep67r8CcA2Ycmb/8BLBcJ70St44mF2X10a/qPg=
|
||||
github.com/hashicorp/consul/api v1.7.0/go.mod h1:1NSuaUUkFaJzMasbfq/11wKYWSR67Xn6r2DXKhuDNFg=
|
||||
|
@ -440,7 +465,6 @@ github.com/hashicorp/go-immutable-radix v1.2.0 h1:l6UW37iCXwZkZoAbEYnptSHVE/cQ5b
|
|||
github.com/hashicorp/go-immutable-radix v1.2.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
|
||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||
|
@ -470,13 +494,14 @@ github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn
|
|||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hashicorp/serf v0.9.3 h1:AVF6JDQQens6nMHT9OGERBvK0f8rPrAGILnsKLr6lzM=
|
||||
github.com/hashicorp/serf v0.9.3/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
|
||||
github.com/hetznercloud/hcloud-go v1.22.0 h1:CC0jwkaBzwP4ObFE0sdJBTvGh5DE9kB/tuDETnRfOik=
|
||||
github.com/hetznercloud/hcloud-go v1.22.0/go.mod h1:xng8lbDUg+xM1dgc0yGHX5EeqbwIq7UYlMWMTx3SQVg=
|
||||
github.com/hetznercloud/hcloud-go v1.23.1 h1:SkYdCa6x458cMSDz5GI18iPz5j2hicACiDP6J/s/bTs=
|
||||
github.com/hetznercloud/hcloud-go v1.23.1/go.mod h1:xng8lbDUg+xM1dgc0yGHX5EeqbwIq7UYlMWMTx3SQVg=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
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/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 h1:UDMh68UUwekSh5iP2OMhRRZJiiBccgV7axzUG8vi56c=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY=
|
||||
|
@ -497,6 +522,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw
|
|||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
|
||||
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=
|
||||
|
@ -525,13 +552,11 @@ github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM52
|
|||
github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg=
|
||||
github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
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 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
|
||||
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/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
|
@ -539,6 +564,8 @@ 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/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
|
||||
|
@ -552,6 +579,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
|
|||
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
|
||||
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
|
||||
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
|
||||
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
|
||||
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
|
@ -573,8 +602,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j
|
|||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
|
||||
github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo=
|
||||
github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs=
|
||||
github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
|
@ -587,8 +616,9 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
|
|||
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/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/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=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
|
@ -611,6 +641,8 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE
|
|||
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
||||
|
@ -638,7 +670,6 @@ github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NH
|
|||
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
|
||||
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
|
@ -653,8 +684,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T
|
|||
github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo=
|
||||
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
|
||||
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||
github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
|
@ -680,6 +711,8 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O
|
|||
github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4=
|
||||
github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA=
|
||||
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||
github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw=
|
||||
github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
|
@ -692,10 +725,11 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
|
|||
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
|
||||
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
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=
|
||||
github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM=
|
||||
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
|
@ -703,6 +737,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
|
|||
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
|
||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4=
|
||||
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
|
@ -714,7 +750,6 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
|||
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/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da h1:p3Vo3i64TCLY7gIfzeQaUJ+kppEO5WQG3cL8iE8tGHU=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e h1:CGjiMQ0wMH4wtNWrlj6kiTbkPt2F3rbYnhGX6TWLfco=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
|
@ -727,7 +762,6 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm
|
|||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk=
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
|
@ -738,16 +772,13 @@ github.com/simonpasquier/klog-gokit/v2 v2.0.1/go.mod h1:VgeTFrwzYYcMH8edEfh3/ai2
|
|||
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/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 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
|
@ -768,8 +799,9 @@ github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
|||
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/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
|
@ -798,14 +830,14 @@ go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL
|
|||
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
go.mongodb.org/mongo-driver v1.1.2/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.2 h1:IYppNjEV/C+/3VPbhHVxQ4t04eVW0cLp0/pNdW++6Ug=
|
||||
go.mongodb.org/mongo-driver v1.3.2/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
|
||||
go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
|
||||
go.mongodb.org/mongo-driver v1.4.3 h1:moga+uhicpVshTyaqY9L23E6QqwcHRUv1sqyOsoyOO8=
|
||||
go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
|
@ -836,7 +868,6 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3
|
|||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE=
|
||||
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
|
@ -873,7 +904,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
|
|||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
|
@ -901,7 +931,6 @@ golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLL
|
|||
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-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
@ -913,20 +942,22 @@ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/
|
|||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
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/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0 h1:wBouT66WTYFXdxfVdz9sVWARVd/2vfGcmI45D2gj45M=
|
||||
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 h1:Mj83v+wSRNEar42a/MQgxk9X42TdEmrOl9i+y8WbxLo=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -934,12 +965,10 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200930132711-30421366ff76 h1:JnxiSYT3Nm0BT2a8CyvYyM6cnrWpidecD1UuSYbhKm0=
|
||||
golang.org/x/sync v0.0.0-20200930132711-30421366ff76/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -991,22 +1020,23 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/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-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201008064518-c1f3e3309c71 h1:ZPX6UakxrJCxWiyGWpXtFY+fp86Esy7xJT/jJCG8bgU=
|
||||
golang.org/x/sys v0.0.0-20201008064518-c1f3e3309c71/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/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=
|
||||
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
@ -1069,18 +1099,16 @@ golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjs
|
|||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200513201620-d5fe73897c97 h1:DAuln/hGp+aJiHpID1Y1hYzMEPP5WLwtZHPb50mN0OE=
|
||||
golang.org/x/tools v0.0.0-20200513201620-d5fe73897c97/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200828161849-5deb26317202/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201008025239-9df69603baec h1:RY2OghEV/7X1MLaecgm1mwFd3sGvUddm5pGVSxQvX0c=
|
||||
golang.org/x/tools v0.0.0-20201008025239-9df69603baec/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
|
||||
golang.org/x/tools v0.0.0-20201119054027-25dc3e1ccc3c h1:EFNvrTleQM8C5s1RJh1h8mJzTEV7BJxtXTP+6qSofJY=
|
||||
golang.org/x/tools v0.0.0-20201119054027-25dc3e1ccc3c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
@ -1106,8 +1134,8 @@ google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/
|
|||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.31.0/go.mod h1:CL+9IBCa2WWU6gRuBWaKqGWLFFwbEUXkfeMkHLQWYWo=
|
||||
google.golang.org/api v0.32.0 h1:Le77IccnTqEa8ryp9wIpX5W3zYm7Gf9LhOp9PHcwFts=
|
||||
google.golang.org/api v0.32.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.35.0 h1:TBCmTTxUrRDA1iTctnK/fIeitxIZ+TQuaf0j29fmCGo=
|
||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
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/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
|
@ -1142,7 +1170,6 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfG
|
|||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 h1:fiNLklpBwWK1mth30Hlwk+fcdBmIALlgF5iy77O37Ig=
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
|
@ -1165,19 +1192,17 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
|
|||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0=
|
||||
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
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/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.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA=
|
||||
|
@ -1188,6 +1213,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
|||
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=
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
|
@ -1210,6 +1237,8 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||
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/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=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
|
@ -1222,12 +1251,12 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/api v0.19.2 h1:q+/krnHWKsL7OBZg/rxnycsl9569Pud76UJ77MvKXms=
|
||||
k8s.io/api v0.19.2/go.mod h1:IQpK0zFQ1xc5iNIQPqzgoOwuFugaYHK4iCknlAQP9nI=
|
||||
k8s.io/apimachinery v0.19.2 h1:5Gy9vQpAGTKHPVOh5c4plE274X8D/6cuEiTO2zve7tc=
|
||||
k8s.io/apimachinery v0.19.2/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
|
||||
k8s.io/client-go v0.19.2 h1:gMJuU3xJZs86L1oQ99R4EViAADUPMHHtS9jFshasHSc=
|
||||
k8s.io/client-go v0.19.2/go.mod h1:S5wPhCqyDNAlzM9CnEdgTGV4OqhsW3jGO1UM1epwfJA=
|
||||
k8s.io/api v0.19.4 h1:I+1I4cgJYuCDgiLNjKx7SLmIbwgj9w7N7Zr5vSIdwpo=
|
||||
k8s.io/api v0.19.4/go.mod h1:SbtJ2aHCItirzdJ36YslycFNzWADYH3tgOhvBEFtZAk=
|
||||
k8s.io/apimachinery v0.19.4 h1:+ZoddM7nbzrDCp0T3SWnyxqf8cbWPT2fkZImoyvHUG0=
|
||||
k8s.io/apimachinery v0.19.4/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
|
||||
k8s.io/client-go v0.19.4 h1:85D3mDNoLF+xqpyE9Dh/OtrJDyJrSRKkHmDXIbEzer8=
|
||||
k8s.io/client-go v0.19.4/go.mod h1:ZrEy7+wj9PjH5VMBCuu/BDlvtUAku0oVFk4MmnW9mWA=
|
||||
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL1egv36TkkJm+bA8AxicmQ=
|
||||
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=
|
||||
|
|
|
@ -32,13 +32,13 @@ import (
|
|||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/atomic"
|
||||
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
config_util "github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/common/version"
|
||||
"go.uber.org/atomic"
|
||||
|
||||
"github.com/prometheus/prometheus/config"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
config_util "github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/atomic"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
|
@ -36,7 +37,6 @@ import (
|
|||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/pkg/relabel"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestPostPath(t *testing.T) {
|
||||
|
@ -65,7 +65,7 @@ func TestPostPath(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
testutil.Equals(t, c.out, postPath(c.in, config.AlertmanagerAPIVersionV1))
|
||||
require.Equal(t, c.out, postPath(c.in, config.AlertmanagerAPIVersionV1))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,10 +80,10 @@ func TestHandlerNextBatch(t *testing.T) {
|
|||
|
||||
expected := append([]*Alert{}, h.queue...)
|
||||
|
||||
testutil.Ok(t, alertsEqual(expected[0:maxBatchSize], h.nextBatch()))
|
||||
testutil.Ok(t, alertsEqual(expected[maxBatchSize:2*maxBatchSize], h.nextBatch()))
|
||||
testutil.Ok(t, alertsEqual(expected[2*maxBatchSize:], h.nextBatch()))
|
||||
testutil.Assert(t, len(h.queue) == 0, "Expected queue to be empty but got %d alerts", len(h.queue))
|
||||
require.NoError(t, alertsEqual(expected[0:maxBatchSize], h.nextBatch()))
|
||||
require.NoError(t, alertsEqual(expected[maxBatchSize:2*maxBatchSize], h.nextBatch()))
|
||||
require.NoError(t, alertsEqual(expected[2*maxBatchSize:], h.nextBatch()))
|
||||
require.Equal(t, 0, len(h.queue), "Expected queue to be empty but got %d alerts", len(h.queue))
|
||||
}
|
||||
|
||||
func alertsEqual(a, b []*Alert) error {
|
||||
|
@ -188,20 +188,20 @@ func TestHandlerSendAll(t *testing.T) {
|
|||
t.Helper()
|
||||
select {
|
||||
case err := <-errc:
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
testutil.Assert(t, h.sendAll(h.queue...), "all sends failed unexpectedly")
|
||||
require.True(t, h.sendAll(h.queue...), "all sends failed unexpectedly")
|
||||
checkNoErr()
|
||||
|
||||
status1.Store(int32(http.StatusNotFound))
|
||||
testutil.Assert(t, h.sendAll(h.queue...), "all sends failed unexpectedly")
|
||||
require.True(t, h.sendAll(h.queue...), "all sends failed unexpectedly")
|
||||
checkNoErr()
|
||||
|
||||
status2.Store(int32(http.StatusInternalServerError))
|
||||
testutil.Assert(t, !h.sendAll(h.queue...), "all sends succeeded unexpectedly")
|
||||
require.False(t, h.sendAll(h.queue...), "all sends succeeded unexpectedly")
|
||||
checkNoErr()
|
||||
}
|
||||
|
||||
|
@ -215,11 +215,11 @@ func TestCustomDo(t *testing.T) {
|
|||
received = true
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
testutil.Equals(t, testBody, string(body))
|
||||
require.Equal(t, testBody, string(body))
|
||||
|
||||
testutil.Equals(t, testURL, req.URL.String())
|
||||
require.Equal(t, testURL, req.URL.String())
|
||||
|
||||
return &http.Response{
|
||||
Body: ioutil.NopCloser(bytes.NewBuffer(nil)),
|
||||
|
@ -229,7 +229,7 @@ func TestCustomDo(t *testing.T) {
|
|||
|
||||
h.sendOne(context.Background(), nil, testURL, []byte(testBody))
|
||||
|
||||
testutil.Assert(t, received, "Expected to receive an alert, but didn't")
|
||||
require.True(t, received, "Expected to receive an alert, but didn't")
|
||||
}
|
||||
|
||||
func TestExternalLabels(t *testing.T) {
|
||||
|
@ -263,7 +263,7 @@ func TestExternalLabels(t *testing.T) {
|
|||
{Labels: labels.FromStrings("alertname", "externalrelabelthis", "a", "c")},
|
||||
}
|
||||
|
||||
testutil.Ok(t, alertsEqual(expected, h.queue))
|
||||
require.NoError(t, alertsEqual(expected, h.queue))
|
||||
}
|
||||
|
||||
func TestHandlerRelabel(t *testing.T) {
|
||||
|
@ -299,7 +299,7 @@ func TestHandlerRelabel(t *testing.T) {
|
|||
{Labels: labels.FromStrings("alertname", "renamed")},
|
||||
}
|
||||
|
||||
testutil.Ok(t, alertsEqual(expected, h.queue))
|
||||
require.NoError(t, alertsEqual(expected, h.queue))
|
||||
}
|
||||
|
||||
func TestHandlerQueuing(t *testing.T) {
|
||||
|
@ -375,7 +375,7 @@ func TestHandlerQueuing(t *testing.T) {
|
|||
case <-called:
|
||||
expectedc <- expected
|
||||
case err := <-errc:
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
return
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatalf("Alerts were not pushed")
|
||||
|
@ -408,7 +408,7 @@ func TestHandlerQueuing(t *testing.T) {
|
|||
expectedc <- alerts[:maxBatchSize]
|
||||
select {
|
||||
case err := <-errc:
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatalf("Alerts were not pushed")
|
||||
}
|
||||
|
@ -435,10 +435,10 @@ func TestLabelSetNotReused(t *testing.T) {
|
|||
tg := makeInputTargetGroup()
|
||||
_, _, err := alertmanagerFromGroup(tg, &config.AlertmanagerConfig{})
|
||||
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Target modified during alertmanager extraction
|
||||
testutil.Equals(t, tg, makeInputTargetGroup())
|
||||
require.Equal(t, tg, makeInputTargetGroup())
|
||||
}
|
||||
|
||||
func TestReload(t *testing.T) {
|
||||
|
@ -469,7 +469,7 @@ alerting:
|
|||
if err := yaml.UnmarshalStrict([]byte(s), cfg); err != nil {
|
||||
t.Fatalf("Unable to load YAML config: %s", err)
|
||||
}
|
||||
testutil.Equals(t, 1, len(cfg.AlertingConfig.AlertmanagerConfigs))
|
||||
require.Equal(t, 1, len(cfg.AlertingConfig.AlertmanagerConfigs))
|
||||
|
||||
if err := n.ApplyConfig(cfg); err != nil {
|
||||
t.Fatalf("Error Applying the config:%v", err)
|
||||
|
@ -486,7 +486,7 @@ alerting:
|
|||
n.reload(tgs)
|
||||
res := n.Alertmanagers()[0].String()
|
||||
|
||||
testutil.Equals(t, tt.out, res)
|
||||
require.Equal(t, tt.out, res)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ alerting:
|
|||
if err := yaml.UnmarshalStrict([]byte(s), cfg); err != nil {
|
||||
t.Fatalf("Unable to load YAML config: %s", err)
|
||||
}
|
||||
testutil.Equals(t, 1, len(cfg.AlertingConfig.AlertmanagerConfigs))
|
||||
require.Equal(t, 1, len(cfg.AlertingConfig.AlertmanagerConfigs))
|
||||
|
||||
if err := n.ApplyConfig(cfg); err != nil {
|
||||
t.Fatalf("Error Applying the config:%v", err)
|
||||
|
@ -541,7 +541,7 @@ alerting:
|
|||
n.reload(tgs)
|
||||
res := n.DroppedAlertmanagers()[0].String()
|
||||
|
||||
testutil.Equals(t, res, tt.out)
|
||||
require.Equal(t, res, tt.out)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,5 +561,5 @@ func makeInputTargetGroup() *targetgroup.Group {
|
|||
}
|
||||
|
||||
func TestLabelsToOpenAPILabelSet(t *testing.T) {
|
||||
testutil.Equals(t, models.LabelSet{"aaa": "111", "bbb": "222"}, labelsToOpenAPILabelSet(labels.Labels{{Name: "aaa", Value: "111"}, {Name: "bbb", Value: "222"}}))
|
||||
require.Equal(t, models.LabelSet{"aaa": "111", "bbb": "222"}, labelsToOpenAPILabelSet(labels.Labels{{Name: "aaa", Value: "111"}, {Name: "bbb", Value: "222"}}))
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestLabels_String(t *testing.T) {
|
||||
|
@ -50,7 +50,7 @@ func TestLabels_String(t *testing.T) {
|
|||
}
|
||||
for _, c := range cases {
|
||||
str := c.lables.String()
|
||||
testutil.Equals(t, c.expected, str)
|
||||
require.Equal(t, c.expected, str)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ func TestLabels_MatchLabels(t *testing.T) {
|
|||
|
||||
for i, test := range tests {
|
||||
got := labels.MatchLabels(test.on, test.providedNames...)
|
||||
testutil.Equals(t, test.expected, got, "unexpected labelset for test case %d", i)
|
||||
require.Equal(t, test.expected, got, "unexpected labelset for test case %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,8 +206,8 @@ func TestLabels_HasDuplicateLabelNames(t *testing.T) {
|
|||
|
||||
for i, c := range cases {
|
||||
l, d := c.Input.HasDuplicateLabelNames()
|
||||
testutil.Equals(t, c.Duplicate, d, "test %d: incorrect duplicate bool", i)
|
||||
testutil.Equals(t, c.LabelName, l, "test %d: incorrect label name", i)
|
||||
require.Equal(t, c.Duplicate, d, "test %d: incorrect duplicate bool", i)
|
||||
require.Equal(t, c.LabelName, l, "test %d: incorrect label name", i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ func TestLabels_WithoutEmpty(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run("", func(t *testing.T) {
|
||||
testutil.Equals(t, test.expected, test.input.WithoutEmpty())
|
||||
require.Equal(t, test.expected, test.input.WithoutEmpty())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ func TestLabels_Equal(t *testing.T) {
|
|||
|
||||
for i, test := range tests {
|
||||
got := Equal(labels, test.compared)
|
||||
testutil.Equals(t, test.expected, got, "unexpected comparison result for test case %d", i)
|
||||
require.Equal(t, test.expected, got, "unexpected comparison result for test case %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,12 +385,9 @@ func TestLabels_FromStrings(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
testutil.Equals(t, expected, labels, "unexpected labelset")
|
||||
require.Equal(t, expected, labels, "unexpected labelset")
|
||||
|
||||
defer func() { recover() }()
|
||||
FromStrings("aaa", "111", "bbb")
|
||||
|
||||
testutil.Assert(t, false, "did not panic as expected")
|
||||
require.Panics(t, func() { FromStrings("aaa", "111", "bbb") })
|
||||
}
|
||||
|
||||
func TestLabels_Compare(t *testing.T) {
|
||||
|
@ -508,7 +505,7 @@ func TestLabels_Compare(t *testing.T) {
|
|||
|
||||
for i, test := range tests {
|
||||
got := Compare(labels, test.compared)
|
||||
testutil.Equals(t, test.expected, got, "unexpected comparison result for test case %d", i)
|
||||
require.Equal(t, test.expected, got, "unexpected comparison result for test case %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,34 +537,34 @@ func TestLabels_Has(t *testing.T) {
|
|||
|
||||
for i, test := range tests {
|
||||
got := labelsSet.Has(test.input)
|
||||
testutil.Equals(t, test.expected, got, "unexpected comparison result for test case %d", i)
|
||||
require.Equal(t, test.expected, got, "unexpected comparison result for test case %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLabels_Get(t *testing.T) {
|
||||
testutil.Equals(t, "", Labels{{"aaa", "111"}, {"bbb", "222"}}.Get("foo"))
|
||||
testutil.Equals(t, "111", Labels{{"aaa", "111"}, {"bbb", "222"}}.Get("aaa"))
|
||||
require.Equal(t, "", Labels{{"aaa", "111"}, {"bbb", "222"}}.Get("foo"))
|
||||
require.Equal(t, "111", Labels{{"aaa", "111"}, {"bbb", "222"}}.Get("aaa"))
|
||||
}
|
||||
|
||||
func TestLabels_Copy(t *testing.T) {
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Copy())
|
||||
require.Equal(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Copy())
|
||||
}
|
||||
|
||||
func TestLabels_Map(t *testing.T) {
|
||||
testutil.Equals(t, map[string]string{"aaa": "111", "bbb": "222"}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Map())
|
||||
require.Equal(t, map[string]string{"aaa": "111", "bbb": "222"}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Map())
|
||||
}
|
||||
|
||||
func TestLabels_WithLabels(t *testing.T) {
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {"ccc", "333"}}.WithLabels("aaa", "bbb"))
|
||||
require.Equal(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {"ccc", "333"}}.WithLabels("aaa", "bbb"))
|
||||
}
|
||||
|
||||
func TestLabels_WithoutLabels(t *testing.T) {
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {"ccc", "333"}}.WithoutLabels("bbb", "ccc"))
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {MetricName, "333"}}.WithoutLabels("bbb"))
|
||||
require.Equal(t, Labels{{"aaa", "111"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {"ccc", "333"}}.WithoutLabels("bbb", "ccc"))
|
||||
require.Equal(t, Labels{{"aaa", "111"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {MetricName, "333"}}.WithoutLabels("bbb"))
|
||||
}
|
||||
|
||||
func TestBulider_NewBulider(t *testing.T) {
|
||||
testutil.Equals(
|
||||
require.Equal(
|
||||
t,
|
||||
&Builder{
|
||||
base: Labels{{"aaa", "111"}},
|
||||
|
@ -579,7 +576,7 @@ func TestBulider_NewBulider(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBuilder_Del(t *testing.T) {
|
||||
testutil.Equals(
|
||||
require.Equal(
|
||||
t,
|
||||
&Builder{
|
||||
del: []string{"bbb"},
|
||||
|
@ -593,7 +590,7 @@ func TestBuilder_Del(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBuilder_Set(t *testing.T) {
|
||||
testutil.Equals(
|
||||
require.Equal(
|
||||
t,
|
||||
&Builder{
|
||||
base: Labels{{"aaa", "111"}},
|
||||
|
@ -607,7 +604,7 @@ func TestBuilder_Set(t *testing.T) {
|
|||
}).Set("bbb", "222"),
|
||||
)
|
||||
|
||||
testutil.Equals(
|
||||
require.Equal(
|
||||
t,
|
||||
&Builder{
|
||||
base: Labels{{"aaa", "111"}},
|
||||
|
@ -623,7 +620,7 @@ func TestBuilder_Set(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBuilder_Labels(t *testing.T) {
|
||||
testutil.Equals(
|
||||
require.Equal(
|
||||
t,
|
||||
Labels{{"aaa", "111"}, {"ccc", "333"}, {"ddd", "444"}},
|
||||
(&Builder{
|
||||
|
@ -639,9 +636,9 @@ func TestLabels_Hash(t *testing.T) {
|
|||
{Name: "foo", Value: "bar"},
|
||||
{Name: "baz", Value: "qux"},
|
||||
}
|
||||
testutil.Equals(t, lbls.Hash(), lbls.Hash())
|
||||
testutil.Assert(t, lbls.Hash() != Labels{lbls[1], lbls[0]}.Hash(), "unordered labels match.")
|
||||
testutil.Assert(t, lbls.Hash() != Labels{lbls[0]}.Hash(), "different labels match.")
|
||||
require.Equal(t, lbls.Hash(), lbls.Hash())
|
||||
require.NotEqual(t, lbls.Hash(), Labels{lbls[1], lbls[0]}.Hash(), "unordered labels match.")
|
||||
require.NotEqual(t, lbls.Hash(), Labels{lbls[0]}.Hash(), "different labels match.")
|
||||
}
|
||||
|
||||
var benchmarkLabelsResult uint64
|
||||
|
|
|
@ -16,12 +16,12 @@ package labels
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func mustNewMatcher(t *testing.T, mType MatchType, value string) *Matcher {
|
||||
m, err := NewMatcher(mType, "", value)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
return m
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ func TestMatcher(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
testutil.Equals(t, test.matcher.Matches(test.value), test.match)
|
||||
require.Equal(t, test.matcher.Matches(test.value), test.match)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ func TestInverse(t *testing.T) {
|
|||
|
||||
for _, test := range tests {
|
||||
result, err := test.matcher.Inverse()
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, test.expected.Type, result.Type)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, test.expected.Type, result.Type)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"regexp/syntax"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNewFastRegexMatcher(t *testing.T) {
|
||||
|
@ -54,8 +54,8 @@ func TestNewFastRegexMatcher(t *testing.T) {
|
|||
|
||||
for _, c := range cases {
|
||||
m, err := NewFastRegexMatcher(c.regex)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, c.expected, m.MatchString(c.value))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, c.expected, m.MatchString(c.value))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,11 +88,11 @@ func TestOptimizeConcatRegex(t *testing.T) {
|
|||
|
||||
for _, c := range cases {
|
||||
parsed, err := syntax.Parse(c.regex, syntax.Perl)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
prefix, suffix, contains := optimizeConcatRegex(parsed)
|
||||
testutil.Equals(t, c.prefix, prefix)
|
||||
testutil.Equals(t, c.suffix, suffix)
|
||||
testutil.Equals(t, c.contains, contains)
|
||||
require.Equal(t, c.prefix, prefix)
|
||||
require.Equal(t, c.suffix, suffix)
|
||||
require.Equal(t, c.contains, contains)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type counter int
|
||||
|
@ -35,13 +35,13 @@ func TestDedupe(t *testing.T) {
|
|||
// Log 10 times quickly, ensure they are deduped.
|
||||
for i := 0; i < 10; i++ {
|
||||
err := d.Log("msg", "hello")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
testutil.Equals(t, 1, int(c))
|
||||
require.Equal(t, 1, int(c))
|
||||
|
||||
// Wait, then log again, make sure it is logged.
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
err := d.Log("msg", "hello")
|
||||
testutil.Ok(t, err)
|
||||
testutil.Equals(t, 2, int(c))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, int(c))
|
||||
}
|
||||
|
|
|
@ -20,71 +20,71 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestJSONFileLogger_basic(t *testing.T) {
|
||||
f, err := ioutil.TempFile("", "logging")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
testutil.Ok(t, f.Close())
|
||||
testutil.Ok(t, os.Remove(f.Name()))
|
||||
require.NoError(t, f.Close())
|
||||
require.NoError(t, os.Remove(f.Name()))
|
||||
}()
|
||||
|
||||
l, err := NewJSONFileLogger(f.Name())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, l != nil, "logger can't be nil")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, l, "logger can't be nil")
|
||||
|
||||
err = l.Log("test", "yes")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
r := make([]byte, 1024)
|
||||
_, err = f.Read(r)
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
result, err := regexp.Match(`^{"test":"yes","ts":"[^"]+"}\n`, r)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, result, "unexpected content: %s", r)
|
||||
require.NoError(t, err)
|
||||
require.True(t, result, "unexpected content: %s", r)
|
||||
|
||||
err = l.Close()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = l.file.Close()
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Assert(t, strings.HasSuffix(err.Error(), os.ErrClosed.Error()), "file not closed")
|
||||
require.Error(t, err)
|
||||
require.True(t, strings.HasSuffix(err.Error(), os.ErrClosed.Error()), "file not closed")
|
||||
}
|
||||
|
||||
func TestJSONFileLogger_parallel(t *testing.T) {
|
||||
f, err := ioutil.TempFile("", "logging")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
testutil.Ok(t, f.Close())
|
||||
testutil.Ok(t, os.Remove(f.Name()))
|
||||
require.NoError(t, f.Close())
|
||||
require.NoError(t, os.Remove(f.Name()))
|
||||
}()
|
||||
|
||||
l, err := NewJSONFileLogger(f.Name())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, l != nil, "logger can't be nil")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, l, "logger can't be nil")
|
||||
|
||||
err = l.Log("test", "yes")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
l2, err := NewJSONFileLogger(f.Name())
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, l != nil, "logger can't be nil")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, l, "logger can't be nil")
|
||||
|
||||
err = l2.Log("test", "yes")
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = l.Close()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = l.file.Close()
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Assert(t, strings.HasSuffix(err.Error(), os.ErrClosed.Error()), "file not closed")
|
||||
require.Error(t, err)
|
||||
require.True(t, strings.HasSuffix(err.Error(), os.ErrClosed.Error()), "file not closed")
|
||||
|
||||
err = l2.Close()
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = l2.file.Close()
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Assert(t, strings.HasSuffix(err.Error(), os.ErrClosed.Error()), "file not closed")
|
||||
require.Error(t, err)
|
||||
require.True(t, strings.HasSuffix(err.Error(), os.ErrClosed.Error()), "file not closed")
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ package pool
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func makeFunc(size int) interface{} {
|
||||
|
@ -44,7 +44,7 @@ func TestPool(t *testing.T) {
|
|||
}
|
||||
for _, c := range cases {
|
||||
ret := testPool.Get(c.size)
|
||||
testutil.Equals(t, c.expectedCap, cap(ret.([]int)))
|
||||
require.Equal(t, c.expectedCap, cap(ret.([]int)))
|
||||
testPool.Put(ret)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestRelabel(t *testing.T) {
|
||||
|
@ -414,7 +414,7 @@ func TestRelabel(t *testing.T) {
|
|||
|
||||
for _, test := range tests {
|
||||
res := Process(test.input, test.relabel...)
|
||||
testutil.Equals(t, test.output, res)
|
||||
require.Equal(t, test.output, res)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ func TestTargetLabelValidity(t *testing.T) {
|
|||
{"foo${bar}foo", true},
|
||||
}
|
||||
for _, test := range tests {
|
||||
testutil.Assert(t, relabelTarget.Match([]byte(test.str)) == test.valid,
|
||||
require.Equal(t, test.valid, relabelTarget.Match([]byte(test.str)),
|
||||
"Expected %q to be %v", test.str, test.valid)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParseFileSuccess(t *testing.T) {
|
||||
|
@ -163,9 +163,9 @@ groups:
|
|||
|
||||
for _, tst := range tests {
|
||||
rgs, errs := Parse([]byte(tst.ruleString))
|
||||
testutil.Assert(t, rgs != nil, "Rule parsing, rule=\n"+tst.ruleString)
|
||||
require.NotNil(t, rgs, "Rule parsing, rule=\n"+tst.ruleString)
|
||||
passed := (tst.shouldPass && len(errs) == 0) || (!tst.shouldPass && len(errs) > 0)
|
||||
testutil.Assert(t, passed, "Rule validation failed, rule=\n"+tst.ruleString)
|
||||
require.True(t, passed, "Rule validation failed, rule=\n"+tst.ruleString)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -85,12 +85,12 @@ const (
|
|||
type MetricType string
|
||||
|
||||
const (
|
||||
MetricTypeCounter = "counter"
|
||||
MetricTypeGauge = "gauge"
|
||||
MetricTypeHistogram = "histogram"
|
||||
MetricTypeGaugeHistogram = "gaugehistogram"
|
||||
MetricTypeSummary = "summary"
|
||||
MetricTypeInfo = "info"
|
||||
MetricTypeStateset = "stateset"
|
||||
MetricTypeUnknown = "unknown"
|
||||
MetricTypeCounter = MetricType("counter")
|
||||
MetricTypeGauge = MetricType("gauge")
|
||||
MetricTypeHistogram = MetricType("histogram")
|
||||
MetricTypeGaugeHistogram = MetricType("gaugehistogram")
|
||||
MetricTypeSummary = MetricType("summary")
|
||||
MetricTypeInfo = MetricType("info")
|
||||
MetricTypeStateset = MetricType("stateset")
|
||||
MetricTypeUnknown = MetricType("unknown")
|
||||
)
|
||||
|
|
|
@ -17,9 +17,10 @@ import (
|
|||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/pkg/exemplar"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestOpenMetricsParse(t *testing.T) {
|
||||
|
@ -220,7 +221,7 @@ foo_total 17.0 1520879607.789 # {xx="yy"} 5`
|
|||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
switch et {
|
||||
case EntrySeries:
|
||||
|
@ -230,40 +231,40 @@ foo_total 17.0 1520879607.789 # {xx="yy"} 5`
|
|||
p.Metric(&res)
|
||||
found := p.Exemplar(&e)
|
||||
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].t, ts)
|
||||
testutil.Equals(t, exp[i].v, v)
|
||||
testutil.Equals(t, exp[i].lset, res)
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].t, ts)
|
||||
require.Equal(t, exp[i].v, v)
|
||||
require.Equal(t, exp[i].lset, res)
|
||||
if exp[i].e == nil {
|
||||
testutil.Equals(t, false, found)
|
||||
require.Equal(t, false, found)
|
||||
} else {
|
||||
testutil.Equals(t, true, found)
|
||||
testutil.Equals(t, *exp[i].e, e)
|
||||
require.Equal(t, true, found)
|
||||
require.Equal(t, *exp[i].e, e)
|
||||
}
|
||||
res = res[:0]
|
||||
|
||||
case EntryType:
|
||||
m, typ := p.Type()
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].typ, typ)
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].typ, typ)
|
||||
|
||||
case EntryHelp:
|
||||
m, h := p.Help()
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].help, string(h))
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].help, string(h))
|
||||
|
||||
case EntryUnit:
|
||||
m, u := p.Unit()
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].unit, string(u))
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].unit, string(u))
|
||||
|
||||
case EntryComment:
|
||||
testutil.Equals(t, exp[i].comment, string(p.Comment()))
|
||||
require.Equal(t, exp[i].comment, string(p.Comment()))
|
||||
}
|
||||
|
||||
i++
|
||||
}
|
||||
testutil.Equals(t, len(exp), i)
|
||||
require.Equal(t, len(exp), i)
|
||||
}
|
||||
|
||||
func TestOpenMetricsParseErrors(t *testing.T) {
|
||||
|
@ -510,7 +511,7 @@ func TestOpenMetricsParseErrors(t *testing.T) {
|
|||
for err == nil {
|
||||
_, err = p.Next()
|
||||
}
|
||||
testutil.Equals(t, c.err, err.Error(), "test %d: %s", i, c.input)
|
||||
require.Equal(t, c.err, err.Error(), "test %d: %s", i, c.input)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,10 +578,10 @@ func TestOMNullByteHandling(t *testing.T) {
|
|||
}
|
||||
|
||||
if c.err == "" {
|
||||
testutil.Equals(t, io.EOF, err, "test %d", i)
|
||||
require.Equal(t, io.EOF, err, "test %d", i)
|
||||
continue
|
||||
}
|
||||
|
||||
testutil.Equals(t, c.err, err.Error(), "test %d", i)
|
||||
require.Equal(t, c.err, err.Error(), "test %d", i)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,9 @@ import (
|
|||
|
||||
"github.com/prometheus/common/expfmt"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestPromParse(t *testing.T) {
|
||||
|
@ -179,7 +180,7 @@ testmetric{label="\"bar\""} 1`
|
|||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
testutil.Ok(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
switch et {
|
||||
case EntrySeries:
|
||||
|
@ -187,29 +188,29 @@ testmetric{label="\"bar\""} 1`
|
|||
|
||||
p.Metric(&res)
|
||||
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].t, ts)
|
||||
testutil.Equals(t, exp[i].v, v)
|
||||
testutil.Equals(t, exp[i].lset, res)
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].t, ts)
|
||||
require.Equal(t, exp[i].v, v)
|
||||
require.Equal(t, exp[i].lset, res)
|
||||
res = res[:0]
|
||||
|
||||
case EntryType:
|
||||
m, typ := p.Type()
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].typ, typ)
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].typ, typ)
|
||||
|
||||
case EntryHelp:
|
||||
m, h := p.Help()
|
||||
testutil.Equals(t, exp[i].m, string(m))
|
||||
testutil.Equals(t, exp[i].help, string(h))
|
||||
require.Equal(t, exp[i].m, string(m))
|
||||
require.Equal(t, exp[i].help, string(h))
|
||||
|
||||
case EntryComment:
|
||||
testutil.Equals(t, exp[i].comment, string(p.Comment()))
|
||||
require.Equal(t, exp[i].comment, string(p.Comment()))
|
||||
}
|
||||
|
||||
i++
|
||||
}
|
||||
testutil.Equals(t, len(exp), i)
|
||||
require.Equal(t, len(exp), i)
|
||||
}
|
||||
|
||||
func TestPromParseErrors(t *testing.T) {
|
||||
|
@ -277,8 +278,8 @@ func TestPromParseErrors(t *testing.T) {
|
|||
for err == nil {
|
||||
_, err = p.Next()
|
||||
}
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Equals(t, c.err, err.Error(), "test %d", i)
|
||||
require.Error(t, err)
|
||||
require.Equal(t, c.err, err.Error(), "test %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,12 +330,12 @@ func TestPromNullByteHandling(t *testing.T) {
|
|||
}
|
||||
|
||||
if c.err == "" {
|
||||
testutil.Equals(t, io.EOF, err, "test %d", i)
|
||||
require.Equal(t, io.EOF, err, "test %d", i)
|
||||
continue
|
||||
}
|
||||
|
||||
testutil.NotOk(t, err)
|
||||
testutil.Equals(t, c.err, err.Error(), "test %d", i)
|
||||
require.Error(t, err)
|
||||
require.Equal(t, c.err, err.Error(), "test %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,11 +350,11 @@ func BenchmarkParse(b *testing.B) {
|
|||
} {
|
||||
for _, fn := range []string{"promtestdata.txt", "promtestdata.nometa.txt"} {
|
||||
f, err := os.Open(fn)
|
||||
testutil.Ok(b, err)
|
||||
require.NoError(b, err)
|
||||
defer f.Close()
|
||||
|
||||
buf, err := ioutil.ReadAll(f)
|
||||
testutil.Ok(b, err)
|
||||
require.NoError(b, err)
|
||||
|
||||
b.Run(parserName+"/no-decode-metric/"+fn, func(b *testing.B) {
|
||||
total := 0
|
||||
|
@ -483,18 +484,18 @@ func BenchmarkGzip(b *testing.B) {
|
|||
for _, fn := range []string{"promtestdata.txt", "promtestdata.nometa.txt"} {
|
||||
b.Run(fn, func(b *testing.B) {
|
||||
f, err := os.Open(fn)
|
||||
testutil.Ok(b, err)
|
||||
require.NoError(b, err)
|
||||
defer f.Close()
|
||||
|
||||
var buf bytes.Buffer
|
||||
gw := gzip.NewWriter(&buf)
|
||||
|
||||
n, err := io.Copy(gw, f)
|
||||
testutil.Ok(b, err)
|
||||
testutil.Ok(b, gw.Close())
|
||||
require.NoError(b, err)
|
||||
require.NoError(b, gw.Close())
|
||||
|
||||
gbuf, err := ioutil.ReadAll(&buf)
|
||||
testutil.Ok(b, err)
|
||||
require.NoError(b, err)
|
||||
|
||||
k := b.N / promtestdataSampleCount
|
||||
|
||||
|
@ -506,11 +507,11 @@ func BenchmarkGzip(b *testing.B) {
|
|||
|
||||
for i := 0; i < k; i++ {
|
||||
gr, err := gzip.NewReader(bytes.NewReader(gbuf))
|
||||
testutil.Ok(b, err)
|
||||
require.NoError(b, err)
|
||||
|
||||
d, err := ioutil.ReadAll(gr)
|
||||
testutil.Ok(b, err)
|
||||
testutil.Ok(b, gr.Close())
|
||||
require.NoError(b, err)
|
||||
require.NoError(b, gr.Close())
|
||||
|
||||
total += len(d)
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue