to build image with the generated dependencies to copy and vendor on demand.
+# --target=app to build actual application image.
+
+# For the lack of the other official Google nodejs image, we use serverless project
+# images to build the Prometheus frontent (https://cloud.google.com/docs/buildpacks/base-images).
+ARG IMAGE_BUILD_NODEJS=us-central1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/nodejs22:latest@sha256:9e88442205b4c956ca4996c2be626db6ef412043182cdd620e741d0d5e14b6a6
+ARG IMAGE_BUILD_GO=google-go.pkg.dev/golang:1.26.4@sha256:3444149d0a7e3f7cfb9c2db65f0f75676fe6ad04de3ce72674efb120c08dd1c1
+ARG IMAGE_BASE_DEBUG=gcr.io/distroless/base-nossl-debian12:debug@sha256:2b89aea887933b8595f62c3d7e05a2718a0594e21e506952ce55b68b537f4fb6
+ARG IMAGE_BASE=gke.gcr.io/gke-distroless/libc:gke_distroless_20260601.00_p0@sha256:1b74f92a381c5269d5018b08ce0464cfcb310b6b9b6d98767ba3300838483fc4
+
+FROM ${IMAGE_BUILD_GO} AS gobase
+WORKDIR /workspace
+# Verify early if we have all we need.
+RUN go version
+
+FROM ${IMAGE_BUILD_NODEJS} AS nodebase
+WORKDIR /workspace
+# Changed to root,as normally it's underprivileged www-data user.
+# For building stages it's fine to do it as root and have less complex scripts.
+USER root
+# Go, make, git, bzip2 are needed in Prometheus vendor and build steps, take Go
+# from the gobase, rest from apt.
+COPY --from=gobase /usr/local/go /usr/local/
+ENV PATH="/usr/local/go/bin:${PATH}"
+ENV UV_USE_IO_URING=0
+ENV UV_THREADPOOL_SIZE=1
+RUN apt-get update && apt-get -y install bzip2 make git
+RUN corepack enable pnpm
+RUN pnpm config set child-concurrency 1
+# Verify early if we have all we need.
+RUN npm version
+RUN pnpm --version
+RUN make -v
+RUN git --version
+RUN bzip2 --version
+RUN go version
+
+# --target=vendor
+FROM gobase AS govendor
+COPY . ./
+ENV GOWORK=off
+RUN go mod vendor
+
+FROM nodebase AS nodevendor
+COPY . ./
+# On the nodebase image, the NODE_ENV is set to production, causing npm install
+# to omit devDependencies. That would be normally preferred (much less packages
+# vendored, avoiding security vuln. for deps used for tests), but Prometheus uses
+# some devDependencies for normal build at the moment too e.g. @lezer/generator
+# (custom build script), rollup, tsc (TypeScript) and probably more.
+# Installing those manually later on is prone to errors, especially across
+# different Prometheus versions.
+# TODO(bwplotka): Consider moving those deps in upstream to non-dev lists.
+ENV NODE_ENV="development"
+RUN (cd web/ui && pnpm install) || [ -d web/ui/node_modules/vite ]
+RUN (cd web/ui/react-app && pnpm install) || [ -d web/ui/react-app/node_modules/react ]
+
+FROM scratch AS vendor
+COPY --from=govendor /workspace/vendor vendor
+COPY --from=nodevendor /workspace/web/ui/node_modules web/ui/node_modules
+COPY --from=nodevendor /workspace/web/ui/mantine-ui/node_modules web/ui/mantine-ui/node_modules
+COPY --from=nodevendor /workspace/web/ui/module/codemirror-promql/node_modules web/ui/module/codemirror-promql/node_modules
+COPY --from=nodevendor /workspace/web/ui/react-app/node_modules web/ui/react-app/node_modules
+
+# --target=app
+# Compile the UI assets.
+FROM nodevendor AS assets
+RUN (make ui-build) || ( [ -d web/ui/static/react-app ] && [ -d web/ui/static/mantine-ui ] )
+RUN scripts/compress_assets.sh
+
+# Build the actual Go binary.
+FROM gobase AS buildbase
+ARG TARGETARCH
+ARG TARGETOS
+ARG BUILDARCH
+COPY --from=assets /workspace ./
+COPY --from=govendor /workspace/vendor vendor
+ENV GOEXPERIMENT=boringcrypto
+ENV CGO_ENABLED=1
+ENV GOFIPS140=off
+ENV GOTOOLCHAIN=local
+ENV GOWORK=off
+ENV GOARCH=${TARGETARCH}
+ENV GOOS=${TARGETOS}
+RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
+ apt install -y --no-install-recommends \
+ gcc-aarch64-linux-gnu libc6-dev-arm64-cross; \
+ CC=aarch64-linux-gnu-gcc; \
+ fi && \
+ go build \
+ -tags builtinassets -mod=vendor \
+ -ldflags="-X github.com/prometheus/common/version.Version=$(cat VERSION) \
+ -X github.com/prometheus/common/version.BuildDate=$(date --iso-8601=seconds)" \
+ ./cmd/prometheus && \
+ go build \
+ -mod=vendor \
+ -ldflags="-X github.com/prometheus/common/version.Version=$(cat VERSION) \
+ -X github.com/prometheus/common/version.BuildDate=$(date --iso-8601=seconds)" \
+ ./cmd/promtool
+
+# Configure distroless base image like the upstream Prometheus image.
+# Since the directory and symlink setup needs shell access, we need yet another
+# intermediate stage.
+FROM ${IMAGE_BASE_DEBUG} AS appbase
+
+COPY documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml
+RUN ["/busybox/sh", "-c", "mkdir -p /prometheus"]
+
+FROM ${IMAGE_BASE} AS app
+
+COPY --from=buildbase /workspace/prometheus /bin/prometheus
+COPY --from=buildbase /workspace/promtool /bin/promtool
+COPY --from=appbase --chown=nobody:nobody /etc/prometheus /etc/prometheus
+COPY --from=appbase --chown=nobody:nobody /prometheus /prometheus
+COPY LICENSE /LICENSE
+COPY NOTICE /NOTICE
+
+USER nobody
+EXPOSE 9090
+VOLUME [ "/prometheus" ]
+ENTRYPOINT [ "/bin/prometheus" ]
+CMD [ "--config.file=/etc/prometheus/prometheus.yml", \
+ "--storage.tsdb.path=/prometheus" ]
diff --git a/Makefile b/Makefile
index d1033a2a58..9d7bf06938 100644
--- a/Makefile
+++ b/Makefile
@@ -211,7 +211,7 @@ update-features-testdata:
@echo ">> updating features testdata"
@$(GO) test ./cmd/prometheus -run TestFeaturesAPI -update-features
-GO_SUBMODULE_DIRS := documentation/examples/remote_storage internal/tools web/ui/mantine-ui/src/promql/tools compliance
+GO_SUBMODULE_DIRS := internal/tools web/ui/mantine-ui/src/promql/tools compliance
.PHONY: update-all-go-deps
update-all-go-deps: update-go-deps
diff --git a/README.md b/README.md
index 9f644d57dc..ec31405941 100644
--- a/README.md
+++ b/README.md
@@ -1,228 +1,10 @@
-
- 
Prometheus
-
+## Google Cloud Managed Service for Prometheus (GMP) Fork
-Visit prometheus.io for the full documentation,
-examples and guides.
+> NOTICE: This repository is a fork of [github.com/prometheus/prometheus](https://github.com/prometheus/prometheus) that includes support for GMP.
+>
+> We actively work on ensuring vanilla Prometheus can work with GMP; this fork will
+> be significantly reduced. Notably, the custom GCM export will be removed.
-
+For GMP specific documentation and to get started, go to [g.co/cloud/managedprometheus](https://g.co/cloud/managedprometheus).
-[](https://github.com/prometheus/prometheus/actions/workflows/ci.yml)
-[][quay]
-[][hub]
-[](https://goreportcard.com/report/github.com/prometheus/prometheus)
-[](https://bestpractices.coreinfrastructure.org/projects/486)
-[](https://github.com/prometheus/prometheus/actions/workflows/govulncheck.yml)
-[](https://securityscorecards.dev/viewer/?uri=github.com/prometheus/prometheus)
-[](https://clomonitor.io/projects/cncf/prometheus)
-[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:prometheus)
-
-
-
-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 when specified conditions are observed.
-
-The features that distinguish Prometheus from other metrics and monitoring systems are:
-
-* 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**
-* 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
-
-
-
-## Install
-
-There are various ways to install Prometheus.
-
-### Precompiled binaries
-
-Precompiled binaries for released versions are available in the
-[*download* section](https://prometheus.io/download/)
-on [prometheus.io](https://prometheus.io). Using the latest production release binary
-is the recommended way to install Prometheus.
-See the [Installing](https://prometheus.io/docs/introduction/install/)
-chapter in the documentation for all the details.
-
-### Docker images
-
-Docker images are available on [Quay.io](https://quay.io/repository/prometheus/prometheus) or [Docker Hub](https://hub.docker.com/r/prom/prometheus/).
-
-You can launch a Prometheus container for trying it out with
-
-```bash
-docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
-```
-
-Prometheus will now be reachable at .
-
-### Building from source
-
-To build Prometheus from source code, you need:
-
-* Go: Version specified in [go.mod](./go.mod) or greater.
-* NodeJS: Version specified in [.nvmrc](./web/ui/.nvmrc) or greater.
-* npm: Version 10 or greater (check with `npm --version` and [here](https://www.npmjs.com/)).
-
-Start by cloning the repository:
-
-```bash
-git clone https://github.com/prometheus/prometheus.git
-cd prometheus
-```
-
-You can use the `go` tool to build and install the `prometheus`
-and `promtool` binaries into your `GOPATH`:
-
-```bash
-go install github.com/prometheus/prometheus/cmd/...
-prometheus --config.file=your_config.yml
-```
-
-*However*, when using `go install` to build Prometheus, Prometheus will expect to be able to
-read its web assets from local filesystem directories under `web/ui/static`. In order for
-these assets to be found, you will have to run Prometheus from the root of the cloned
-repository. Note also that this directory does not include the React UI unless it has been
-built explicitly using `make assets` or `make build`.
-
-An example of the above configuration file can be found [here.](https://github.com/prometheus/prometheus/blob/main/documentation/examples/prometheus.yml)
-
-You can also build using `make build`, which will compile in the web assets so that
-Prometheus can be run from anywhere:
-
-```bash
-make build
-./prometheus --config.file=your_config.yml
-```
-
-The Makefile provides several targets:
-
-* *build*: build the `prometheus` and `promtool` binaries (includes building and compiling in web assets)
-* *test*: run the tests
-* *test-short*: run the short tests
-* *format*: format the source code
-* *vet*: check the source code for common errors
-* *assets*: build the React UI
-
-### Service discovery plugins
-
-Prometheus is bundled with many service discovery plugins. You can customize
-which service discoveries are included in your build using Go build tags.
-
-To exclude service discoveries when building with `make build`, add the desired
-tags to the `.promu.yml` file under `build.tags.all`:
-
-```yaml
-build:
- tags:
- all:
- - netgo
- - builtinassets
- - remove_all_sd # Exclude all optional SDs
- - enable_kubernetes_sd # Re-enable only kubernetes
-```
-
-Then run `make build` as usual. Alternatively, when using `go build` directly:
-
-```bash
-go build -tags "remove_all_sd,enable_kubernetes_sd" ./cmd/prometheus
-```
-
-Available build tags:
-* `remove_all_sd` - Exclude all optional service discoveries (keeps file_sd, static_sd, and http_sd)
-* `enable__sd` - Re-enable a specific SD when using `remove_all_sd`
-
-If you add out-of-tree plugins, which we do not endorse at the moment,
-additional steps might be needed to adjust the `go.mod` and `go.sum` files. As
-always, be extra careful when loading third party code.
-
-### Building the Docker image
-
-You can build a docker image locally with the following commands:
-
-```bash
-make promu
-promu crossbuild -p linux/amd64
-make common-docker-amd64
-```
-
-The `make docker` target is intended only for use in our CI system and will not
-produce a fully working image when run locally.
-
-## Using Prometheus as a Go Library
-
-Within the Prometheus project, repositories such as [prometheus/common](https://github.com/prometheus/common) and
-[prometheus/client-golang](https://github.com/prometheus/client-golang) are designed as re-usable libraries.
-
-The [prometheus/prometheus](https://github.com/prometheus/prometheus) repository builds a stand-alone program and is not
-designed for use as a library. We are aware that people do use parts as such,
-and we do not put any deliberate inconvenience in the way, but we want you to be
-aware that no care has been taken to make it work well as a library. For instance,
-you may encounter errors that only surface when used as a library.
-
-### Remote Write
-
-We are publishing our Remote Write protobuf independently at
-[buf.build](https://buf.build/prometheus/prometheus/assets).
-
-You can use that as a library:
-
-```shell
-go get buf.build/gen/go/prometheus/prometheus/protocolbuffers/go@latest
-```
-
-This is experimental.
-
-### Prometheus code base
-
-In order to comply with [go mod](https://go.dev/ref/mod#versions) rules,
-Prometheus release number do not exactly match Go module releases.
-
-For the
-Prometheus v3.y.z releases, we are publishing equivalent v0.3y.z tags. The y in v0.3y.z is always padded to two digits, with a leading zero if needed.
-
-Therefore, a user that would want to use Prometheus v3.0.0 as a library could do:
-
-```shell
-go get github.com/prometheus/prometheus@v0.300.0
-```
-
-For the
-Prometheus v2.y.z releases, we published the equivalent v0.y.z tags.
-
-Therefore, a user that would want to use Prometheus v2.35.0 as a library could do:
-
-```shell
-go get github.com/prometheus/prometheus@v0.35.0
-```
-
-This solution makes it clear that we might break our internal Go APIs between
-minor user-facing releases, as [breaking changes are allowed in major version
-zero](https://semver.org/#spec-item-4).
-
-## React UI Development
-
-For more information on building, running, and developing on the React-based UI, see the React app's [README.md](web/ui/README.md).
-
-## More information
-
-* Godoc documentation is available via [pkg.go.dev](https://pkg.go.dev/github.com/prometheus/prometheus). Due to peculiarities of Go Modules, v3.y.z will be displayed as v0.3y.z (the y in v0.3y.z is always padded to two digits, with a leading zero if needed), while v2.y.z will be displayed as v0.y.z.
-* See the [Community page](https://prometheus.io/community) for how to reach the Prometheus developers and users on various communication channels.
-
-## Contributing
-
-Refer to [CONTRIBUTING.md](https://github.com/prometheus/prometheus/blob/main/CONTRIBUTING.md)
-
-## License
-
-Apache License 2.0, see [LICENSE](https://github.com/prometheus/prometheus/blob/main/LICENSE).
-
-[hub]: https://hub.docker.com/r/prom/prometheus/
-[quay]: https://quay.io/repository/prometheus/prometheus
+Otherwise, refer to https://github.com/prometheus/prometheus documentation.
diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go
index 6795c6bb4c..56418325bf 100644
--- a/cmd/prometheus/main.go
+++ b/cmd/prometheus/main.go
@@ -36,23 +36,30 @@ import (
"strings"
"sync"
"syscall"
+ "testing"
"time"
"github.com/KimMachineGun/automemlimit/memlimit"
"github.com/alecthomas/kingpin/v2"
"github.com/alecthomas/units"
+ gokitlog "github.com/go-kit/log"
"github.com/grafana/regexp"
"github.com/mwitkow/go-conntrack"
"github.com/oklog/run"
+ "github.com/oklog/ulid"
remoteapi "github.com/prometheus/client_golang/exp/api/remote"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version"
+ common_config "github.com/prometheus/common/config"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
promslogflag "github.com/prometheus/common/promslog/flag"
"github.com/prometheus/common/version"
toolkit_web "github.com/prometheus/exporter-toolkit/web"
+ "github.com/prometheus/prometheus/google/export"
+ gcm_export "github.com/prometheus/prometheus/google/export/setup"
+ "github.com/prometheus/prometheus/google/secrets"
"go.uber.org/atomic"
"go.uber.org/automaxprocs/maxprocs"
"k8s.io/client-go/rest"
@@ -128,6 +135,36 @@ func (klogv1Writer) Write(p []byte) (n int, err error) {
return len(p), nil
}
+type slogToGoKitAdapter struct {
+ logger *slog.Logger
+}
+
+func (a slogToGoKitAdapter) Log(keyvals ...any) error {
+ var msg string
+ var args []any
+ for i := 0; i < len(keyvals); i += 2 {
+ key, _ := keyvals[i].(string)
+ var val any
+ if i+1 < len(keyvals) {
+ val = keyvals[i+1]
+ }
+ if key == "msg" {
+ msg, _ = val.(string)
+ } else {
+ args = append(args, key, val)
+ }
+ }
+ a.logger.Info(msg, args...)
+ return nil
+}
+
+func toGoKitLog(logger *slog.Logger) gokitlog.Logger {
+ if logger == nil {
+ return gokitlog.NewNopLogger()
+ }
+ return slogToGoKitAdapter{logger: logger}
+}
+
var (
appName = "prometheus"
@@ -216,6 +253,7 @@ type flagConfig struct {
enablePerStepStats bool
enableConcurrentRuleEval bool
useStartTimestamps bool
+ enableKubeSecretProvider bool
prometheusURL string
corsRegexString string
@@ -312,6 +350,11 @@ func (c *flagConfig) setFeatureListOptions(logger *slog.Logger) error {
case "promql-binop-fill-modifiers":
c.parserOpts.EnableBinopFillModifiers = true
logger.Info("Experimental PromQL binary operator fill modifiers enabled.")
+ case "google-kubernetes-secret-provider":
+ c.enableKubeSecretProvider = true
+ logger.Info("Experimental (Google) Kubernetes secret provider enabled.")
+ case "":
+ continue
case "old-ui":
c.web.UseOldUI = true
logger.Info("Serving previous version of the Prometheus web UI.")
@@ -642,8 +685,11 @@ func main() {
a.Flag("agent", "Run Prometheus in 'Agent mode'.").BoolVar(&agentMode)
promslogflag.AddFlags(a, &cfg.promslogConfig)
-
a.Flag("write-documentation", "Generate command line documentation. Internal use.").Hidden().Action(func(*kingpin.ParseContext) error {
+ // Set defaults to empty to ensure this command is deterministic.
+ a.GetFlag("export.label.project-id").Default("")
+ a.GetFlag("export.label.cluster").Default("")
+ a.GetFlag("export.label.location").Default("")
if err := documentcli.GenerateMarkdown(a.Model(), os.Stdout); err != nil {
os.Exit(1)
return err
@@ -652,7 +698,26 @@ func main() {
return nil
}).Bool()
- _, err := a.Parse(os.Args[1:])
+ // GMP fork flags.
+ var deleteDataOnStart bool
+ a.Flag("gmp.storage.delete-data-on-start", "[GMP fork experimental flag] If true, all the storage related data (e.g. blocks, lock file, WAL, head chunks) in the --storage.tsdb.path or --storage.agent.path (depending on the mode) will be deleted, right before opening the DB. As a result, all previously collected samples will be uncoverably dropped. Use it in setups where the availability is more important than the persistence between restarts, as replaying data can take time and resources. This flag is especially useful on Kubernetes with ephemeral storage (for consistency between pod vs container restart), remote write use cases that prioritize live data and when you want to auto-recover from the OOM crashloops without changing memory limits for Prometheus (see https://github.com/prometheus/prometheus/issues/13939).").
+ Default("false").BoolVar(&deleteDataOnStart)
+
+ opts := gcm_export.Opts{
+ ExporterOpts: export.ExporterOpts{
+ UserAgentProduct: fmt.Sprintf("prometheus/%s", version.Version),
+ Disable: testing.Testing(),
+ },
+ }
+ opts.SetupFlags(a)
+
+ extraArgs, err := gcm_export.ExtraArgs()
+ if err != nil {
+ fmt.Fprintln(os.Stderr, fmt.Errorf("Error parsing commandline arguments: %w", err))
+ a.Usage(os.Args[1:])
+ os.Exit(2)
+ }
+ _, err = a.Parse(append(os.Args[1:], extraArgs...))
if err != nil {
fmt.Fprintf(os.Stderr, "Error parsing command line arguments: %s\n", err)
a.Usage(os.Args[1:])
@@ -711,6 +776,16 @@ func main() {
localStoragePath = cfg.agentStoragePath
}
+ // NOTE(bwplotka): This opt-in functionality exists in our fork, relevant
+ // discussion in the upstream is here: https://github.com/prometheus/prometheus/issues/13939
+ if deleteDataOnStart {
+ logger.Info("The --gmp.storage.delete-data-on-start flag was set, deleting relevant storage files in the storage path", "path", localStoragePath)
+ if err := deleteStorageData(agentMode, localStoragePath); err != nil {
+ fmt.Fprintln(os.Stderr, fmt.Errorf("failed to delete storage data as requested: %w", err))
+ os.Exit(1)
+ }
+ }
+
cfg.web.ExternalURL, err = computeExternalURL(cfg.prometheusURL, cfg.web.ListenAddresses[0])
if err != nil {
fmt.Fprintln(os.Stderr, fmt.Errorf("parse external URL %q: %w", cfg.prometheusURL, err))
@@ -921,6 +996,7 @@ func main() {
var (
ctxWeb, cancelWeb = context.WithCancel(context.Background())
ctxRule = context.Background()
+ ctxSecrets = context.Background()
notifierManager = notifier.NewManager(&cfg.notifier, cfgFile.GlobalConfig.MetricNameValidationScheme, logger.With("component", "notifier"))
@@ -971,6 +1047,21 @@ func main() {
os.Exit(1)
}
+ var secretManager *secrets.Manager
+ if cfg.enableKubeSecretProvider {
+ manager := secrets.NewManager(
+ ctxSecrets,
+ prometheus.DefaultRegisterer,
+ secrets.ProviderOptions{
+ Logger: gokitlog.With(toGoKitLog(logger), "component", "secret manager"),
+ },
+ )
+ secretManager = &manager
+ defer secretManager.Close(prometheus.DefaultRegisterer)
+
+ cfg.scrape.HTTPClientOptions = append(cfg.scrape.HTTPClientOptions, common_config.WithSecretManager(secretManager))
+ }
+
var (
tracingManager = tracing.NewManager(logger)
@@ -1144,6 +1235,20 @@ func main() {
}
return discoveryManagerScrape.ApplyConfig(c)
},
+ }, {
+ name: "secret",
+ reloader: func(cfg *config.Config) error {
+ if secretManager == nil {
+ if len(cfg.SecretConfigs) > 0 {
+ return errors.New("secret providers are disabled")
+ }
+ return nil
+ }
+ kConfig := secrets.WatchSPConfig{
+ ClientConfig: cfg.ClientConfig,
+ }
+ return secretManager.ApplyConfig(&kConfig, cfg.SecretConfigs)
+ },
}, {
name: "notify",
reloader: notifierManager.ApplyConfig,
@@ -1185,6 +1290,12 @@ func main() {
}, {
name: "tracing",
reloader: tracingManager.ApplyConfig,
+ }, {
+ name: "gcm_export",
+ reloader: func(cfg *config.Config) error {
+ // Call in closure to not call Global() before it's initialized below.
+ return gcm_export.Global().ApplyConfig(cfg)
+ },
},
}
@@ -1250,6 +1361,29 @@ func main() {
},
)
}
+ {
+ exporterLogger := gokitlog.With(toGoKitLog(logger), "component", "gcm_exporter")
+ ctx, cancel := context.WithCancel(context.Background())
+ exporter, err := opts.NewExporter(ctx, exporterLogger, prometheus.DefaultRegisterer)
+ if err != nil {
+ logger.Error("Unable to init Google Cloud Monitoring exporter", "err", err)
+ os.Exit(2)
+ }
+
+ if err := gcm_export.SetGlobal(exporter); err != nil {
+ logger.Error("Unable to set Google Cloud Monitoring exporter", "err", err)
+ os.Exit(2)
+ }
+
+ g.Add(
+ func() error {
+ return gcm_export.Global().Run()
+ },
+ func(err error) {
+ cancel()
+ },
+ )
+ }
{
// Scrape discovery manager.
g.Add(
@@ -1733,7 +1867,7 @@ func updateGoGC(conf *config.Config, logger *slog.Logger) {
func startsOrEndsWithQuote(s string) bool {
return strings.HasPrefix(s, "\"") || strings.HasPrefix(s, "'") ||
- strings.HasSuffix(s, "\"") || strings.HasSuffix(s, "'")
+ strings.HasSuffix(s, "\"") || strings.HasSuffix(s, "'")
}
// compileCORSRegexString compiles given string and adds anchors.
@@ -2247,3 +2381,38 @@ func exludeBlocksPendingUpload(logger *slog.Logger, uploadMetaPath string) tsdb.
return !slices.Contains(uploadMeta.Uploaded, meta.ULID.String())
}
}
+
+func deleteStorageData(agentMode bool, dataPath string) error {
+ if agentMode {
+ for _, f := range []string{"wal", "lock"} {
+ if err := os.RemoveAll(filepath.Join(dataPath, f)); err != nil {
+ return err
+ }
+ }
+ return nil
+ }
+
+ files, err := os.ReadDir(dataPath)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return fmt.Errorf("can't read dir %v: %w", dataPath, err)
+ }
+ for _, f := range files {
+ switch f.Name() {
+ case "wal", "lock", "chunks_head":
+ if err := os.RemoveAll(filepath.Join(dataPath, f.Name())); err != nil {
+ return err
+ }
+ continue
+ }
+ if _, err := ulid.Parse(f.Name()); err == nil {
+ // It's a TSDB block, remove.
+ if err := os.RemoveAll(filepath.Join(dataPath, f.Name())); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
diff --git a/cmd/prometheus/main_test.go b/cmd/prometheus/main_test.go
index 216bb882c8..4cb7b53791 100644
--- a/cmd/prometheus/main_test.go
+++ b/cmd/prometheus/main_test.go
@@ -138,7 +138,7 @@ func TestFailedStartupExitCode(t *testing.T) {
fakeInputFile := "fake-input-file"
expectedExitStatus := 2
- prom := exec.Command(promPath, "-test.main", "--web.listen-address=0.0.0.0:0", "--config.file="+fakeInputFile)
+ prom := exec.Command(promPath, "-test.main", "--web.listen-address=0.0.0.0:0", "--config.file="+fakeInputFile, "--export.debug.disable-auth")
err := prom.Run()
require.Error(t, err)
@@ -289,7 +289,7 @@ func TestWALSegmentSizeBounds(t *testing.T) {
} {
t.Run(tc.size, func(t *testing.T) {
t.Parallel()
- prom := exec.Command(promPath, "-test.main", "--storage.tsdb.wal-segment-size="+tc.size, "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig, "--storage.tsdb.path="+filepath.Join(t.TempDir(), "data"))
+ prom := exec.Command(promPath, "-test.main", "--storage.tsdb.wal-segment-size="+tc.size, "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig, "--storage.tsdb.path="+filepath.Join(t.TempDir(), "data"), "--export.debug.disable-auth")
// Log stderr in case of failure.
stderr, err := prom.StderrPipe()
@@ -353,7 +353,7 @@ func TestMaxBlockChunkSegmentSizeBounds(t *testing.T) {
} {
t.Run(tc.size, func(t *testing.T) {
t.Parallel()
- prom := exec.Command(promPath, "-test.main", "--storage.tsdb.max-block-chunk-segment-size="+tc.size, "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig, "--storage.tsdb.path="+filepath.Join(t.TempDir(), "data"))
+ prom := exec.Command(promPath, "-test.main", "--storage.tsdb.max-block-chunk-segment-size="+tc.size, "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig, "--storage.tsdb.path="+filepath.Join(t.TempDir(), "data"), "--export.debug.disable-auth")
// Log stderr in case of failure.
stderr, err := prom.StderrPipe()
@@ -560,10 +560,75 @@ func getCurrentGaugeValuesFor(t *testing.T, reg prometheus.Gatherer, metricNames
return res
}
+func TestDeleteStorageDataOnStart(t *testing.T) {
+ for _, agentMode := range []bool{false, true} {
+ t.Run(fmt.Sprintf("%v", agentMode), func(t *testing.T) {
+ t.Run("empty", func(t *testing.T) {
+ dir := t.TempDir()
+
+ require.NoError(t, deleteStorageData(agentMode, dir))
+ requireEmptyDir(t, dir)
+ })
+ t.Run("partial data", func(t *testing.T) {
+ dir := t.TempDir()
+
+ if !agentMode {
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "chunks_head"), os.ModePerm))
+ }
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "wal"), os.ModePerm))
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "wal", "checkpoint.00000003"), os.ModePerm))
+
+ require.NoError(t, deleteStorageData(agentMode, dir))
+ requireEmptyDir(t, dir)
+ })
+ t.Run("full data", func(t *testing.T) {
+ dir := t.TempDir()
+
+ if !agentMode {
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "chunks_head"), os.ModePerm))
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "01HTHFTV0ZK2KQ85DXQK9TGA7Z"), os.ModePerm))
+
+ }
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "wal"), os.ModePerm))
+ require.NoError(t, os.Mkdir(filepath.Join(dir, "wal", "checkpoint.00000003"), os.ModePerm))
+ require.NoError(t, os.WriteFile(filepath.Join(dir, "lock"), []byte{1}, os.ModePerm))
+
+ require.NoError(t, deleteStorageData(agentMode, dir))
+ requireEmptyDir(t, dir)
+ })
+ })
+ }
+}
+
+func requireEmptyDir(t *testing.T, dir string) {
+ t.Helper()
+ files, err := os.ReadDir(dir)
+ require.NoError(t, err)
+ require.Empty(t, files, "%v contains unexpected files", dir)
+}
+
+func TestAgentDeleteDataOnStart(t *testing.T) {
+ prom := exec.Command(promPath, "-test.main", "--enable-feature=agent", "--web.listen-address=0.0.0.0:0", "--config.file="+agentConfig, "--export.debug.disable-auth")
+ require.NoError(t, prom.Start())
+
+ actualExitStatus := 0
+ done := make(chan error, 1)
+
+ go func() { done <- prom.Wait() }()
+ select {
+ case err := <-done:
+ t.Logf("prometheus agent should be still running: %v", err)
+ actualExitStatus = prom.ProcessState.ExitCode()
+ case <-time.After(startupTime):
+ prom.Process.Kill()
+ }
+ require.Equal(t, 0, actualExitStatus)
+}
+
func TestAgentSuccessfulStartup(t *testing.T) {
t.Parallel()
- prom := exec.Command(promPath, "-test.main", "--agent", "--web.listen-address=0.0.0.0:0", "--config.file="+agentConfig)
+ prom := exec.Command(promPath, "-test.main", "--agent", "--web.listen-address=0.0.0.0:0", "--config.file="+agentConfig, "--export.debug.disable-auth")
require.NoError(t, prom.Start())
actualExitStatus := 0
@@ -583,7 +648,7 @@ func TestAgentSuccessfulStartup(t *testing.T) {
func TestAgentFailedStartupWithServerFlag(t *testing.T) {
t.Parallel()
- prom := exec.Command(promPath, "-test.main", "--agent", "--storage.tsdb.path=.", "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig)
+ prom := exec.Command(promPath, "-test.main", "--agent", "--storage.tsdb.path=.", "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig, "--export.debug.disable-auth")
output := bytes.Buffer{}
prom.Stderr = &output
@@ -612,7 +677,7 @@ func TestAgentFailedStartupWithServerFlag(t *testing.T) {
func TestAgentFailedStartupWithInvalidConfig(t *testing.T) {
t.Parallel()
- prom := exec.Command(promPath, "-test.main", "--agent", "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig)
+ prom := exec.Command(promPath, "-test.main", "--agent", "--web.listen-address=0.0.0.0:0", "--config.file="+promConfig, "--export.debug.disable-auth")
require.NoError(t, prom.Start())
actualExitStatus := 0
@@ -649,7 +714,7 @@ func TestModeSpecificFlags(t *testing.T) {
for _, tc := range testcases {
t.Run(fmt.Sprintf("%s mode with option %s", tc.mode, tc.arg), func(t *testing.T) {
t.Parallel()
- args := []string{"-test.main", tc.arg, t.TempDir(), "--web.listen-address=0.0.0.0:0"}
+ args := []string{"-test.main", tc.arg, t.TempDir(), "--web.listen-address=0.0.0.0:0", "--export.debug.disable-auth"}
if tc.mode == "agent" {
args = append(args, "--agent", "--config.file="+agentConfig)
@@ -704,6 +769,8 @@ func TestModeSpecificFlags(t *testing.T) {
}
func TestDocumentation(t *testing.T) {
+ t.Skip("google: We don't maintain docs in our fork, so nothing to regenerate and test.")
+
if runtime.GOOS == "windows" {
t.SkipNow()
}
@@ -1211,6 +1278,8 @@ remote_write:
// TestFeatureFlagsDocumented ensures the --enable-feature help text in main.go
// and the documented flags in docs/feature_flags.md list the same set of flags.
func TestFeatureFlagsDocumented(t *testing.T) {
+ t.Skip("google: We don't maintain docs in our fork, so nothing to regenerate and test.")
+
if runtime.GOOS == "windows" {
t.SkipNow()
}
diff --git a/cmd/prometheus/main_unix_test.go b/cmd/prometheus/main_unix_test.go
index ea130b3bf9..e8cb97c061 100644
--- a/cmd/prometheus/main_unix_test.go
+++ b/cmd/prometheus/main_unix_test.go
@@ -38,7 +38,7 @@ func TestStartupInterrupt(t *testing.T) {
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
- prom := exec.Command(promPath, "-test.main", "--config.file="+promConfig, "--storage.tsdb.path="+t.TempDir(), "--web.listen-address=0.0.0.0"+port)
+ prom := exec.Command(promPath, "-test.main", "--config.file="+promConfig, "--storage.tsdb.path="+t.TempDir(), "--web.listen-address=0.0.0.0"+port, "--export.debug.disable-auth")
err := prom.Start()
require.NoError(t, err)
diff --git a/cmd/prometheus/query_log_test.go b/cmd/prometheus/query_log_test.go
index b3fd5e1bdb..918f751d43 100644
--- a/cmd/prometheus/query_log_test.go
+++ b/cmd/prometheus/query_log_test.go
@@ -87,8 +87,14 @@ func (p *queryLogTest) setQueryLog(t *testing.T, queryLogFile string) {
require.NoError(t, err)
_, err = p.configFile.Seek(0, 0)
require.NoError(t, err)
+ commonGlobal := `
+ # GMP requires settings project_id and location labels.
+ external_labels:
+ project_id: example-project
+ location: us-central-1
+`
if queryLogFile != "" {
- _, err = fmt.Fprintf(p.configFile, "global:\n query_log_file: %s\n", queryLogFile)
+ _, err = fmt.Fprintf(p.configFile, "global:\n query_log_file: %s\n%s", queryLogFile, commonGlobal)
require.NoError(t, err)
}
_, err = p.configFile.Write([]byte(p.configuration()))
@@ -298,6 +304,7 @@ func (p *queryLogTest) run(t *testing.T) {
"--web.enable-lifecycle",
fmt.Sprintf("--web.listen-address=%s:%d", p.host, p.port),
"--storage.tsdb.path=" + dir,
+ "--export.debug.disable-auth",
}, p.params()...)
prom := exec.Command(promPath, params...)
diff --git a/cmd/promtool/main_test.go b/cmd/promtool/main_test.go
index e42ca69441..a0f4694a3b 100644
--- a/cmd/promtool/main_test.go
+++ b/cmd/promtool/main_test.go
@@ -603,6 +603,8 @@ func TestExitCodes(t *testing.T) {
}
func TestDocumentation(t *testing.T) {
+ t.Skip("google: We don't maintain docs in our fork, so nothing to regenerate and test.")
+
if runtime.GOOS == "windows" {
t.SkipNow()
}
diff --git a/config/config.go b/config/config.go
index cdf914b891..cf8a3350be 100644
--- a/config/config.go
+++ b/config/config.go
@@ -33,6 +33,8 @@ import (
"github.com/prometheus/common/config"
"github.com/prometheus/common/model"
"github.com/prometheus/otlptranslator"
+ gcm_exportconfig "github.com/prometheus/prometheus/google/config"
+ gcm_secrets "github.com/prometheus/prometheus/google/secrets"
"github.com/prometheus/sigv4"
"go.yaml.in/yaml/v2"
@@ -299,10 +301,16 @@ type Config struct {
StorageConfig StorageConfig `yaml:"storage,omitempty"`
TracingConfig TracingConfig `yaml:"tracing,omitempty"`
+ // Secret management:
+ gcm_secrets.ClientConfig `yaml:"kubernetes_sp_config,omitempty"`
+ SecretConfigs []gcm_secrets.SecretConfig `yaml:"kubernetes_secrets,omitempty"`
+
RemoteWriteConfigs []*RemoteWriteConfig `yaml:"remote_write,omitempty"`
RemoteReadConfigs []*RemoteReadConfig `yaml:"remote_read,omitempty"`
OTLPConfig OTLPConfig `yaml:"otlp,omitempty"`
+ GoogleCloud gcm_exportconfig.GoogleCloudConfig `yaml:"google_cloud,omitempty"`
+
loaded bool // Certain methods require configuration to use Load validation.
}
diff --git a/docs/command-line/index.md b/docs/command-line/index.md
deleted file mode 100644
index 53786fbb20..0000000000
--- a/docs/command-line/index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Command Line
-sort_rank: 9
----
diff --git a/docs/command-line/prometheus.md b/docs/command-line/prometheus.md
deleted file mode 100644
index 5ec738e768..0000000000
--- a/docs/command-line/prometheus.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-title: prometheus
----
-
-The Prometheus monitoring server
-
-
-## Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| -h, --help | Show context-sensitive help (also try --help-long and --help-man). | |
-| --version | Show application version. | |
-| --config.file | Prometheus configuration file path. | `prometheus.yml` |
-| --config.auto-reload | Enable automatic configuration file reloading. See also --config.auto-reload-interval. | `false` |
-| --config.auto-reload-interval | Specifies the interval for checking and automatically reloading the Prometheus configuration file upon detecting changes. Only used when --config.auto-reload is set. | `30s` |
-| --web.listen-address ... | Address to listen on for UI, API, and telemetry. Can be repeated. | `0.0.0.0:9090` |
-| --auto-gomaxprocs | Automatically set GOMAXPROCS to match Linux container CPU quota | `true` |
-| --auto-gomemlimit | Automatically set GOMEMLIMIT to match Linux container or system memory limit | `true` |
-| --auto-gomemlimit.ratio | The ratio of reserved GOMEMLIMIT memory to the detected maximum container or system memory | `0.9` |
-| --web.config.file | [EXPERIMENTAL] Path to configuration file that can enable TLS or authentication. | |
-| --web.read-timeout | Maximum duration before timing out read of the request, and closing idle connections. | `5m` |
-| --web.max-connections | Maximum number of simultaneous connections across all listeners. | `512` |
-| --web.max-notifications-subscribers | Limits the maximum number of subscribers that can concurrently receive live notifications. If the limit is reached, new subscription requests will be denied until existing connections close. | `16` |
-| --web.external-url | The URL under which Prometheus is externally reachable (for example, if Prometheus is served via a reverse proxy). Used for generating relative and absolute links back to Prometheus itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically. | |
-| --web.route-prefix | Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url. | |
-| --web.user-assets | Path to static asset directory, available at /user. | |
-| --web.enable-lifecycle | Enable shutdown and reload via HTTP request. | `false` |
-| --web.enable-admin-api | Enable API endpoints for admin control actions. | `false` |
-| --web.enable-remote-write-receiver | Enable API endpoint accepting remote write requests. | `false` |
-| --web.remote-write-receiver.accepted-protobuf-messages | List of the remote write protobuf messages to accept when receiving the remote writes. Supported values: prometheus.WriteRequest, io.prometheus.write.v2.Request | `prometheus.WriteRequest` |
-| --web.enable-otlp-receiver | Enable API endpoint accepting OTLP write requests. | `false` |
-| --web.console.templates | Path to the console template directory, available at /consoles. | `consoles` |
-| --web.console.libraries | Path to the console library directory. | `console_libraries` |
-| --web.page-title | Document title of Prometheus instance. | `Prometheus Time Series Collection and Processing Server` |
-| --web.cors.origin | Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1\|domain2)\.com' | `.*` |
-| --storage.tsdb.path | Base path for metrics storage. Use with server mode only. | `data/` |
-| --storage.tsdb.retention.time | [DEPRECATED] How long to retain samples in storage. If neither this flag nor "storage.tsdb.retention.size" is set, the retention time defaults to 15d. Units Supported: y, w, d, h, m, s, ms. This flag has been deprecated, use the storage.tsdb.retention.time field in the config file instead. Use with server mode only. | |
-| --storage.tsdb.retention.size | [DEPRECATED] Maximum number of bytes that can be stored for blocks. A unit is required, supported units: B, KB, MB, GB, TB, PB, EB. Ex: "512MB". Based on powers-of-2, so 1KB is 1024B. This flag has been deprecated, use the storage.tsdb.retention.size field in the config file instead. Use with server mode only. | |
-| --storage.tsdb.no-lockfile | Do not create lockfile in data directory. Use with server mode only. | `false` |
-| --storage.tsdb.head-chunks-write-queue-size | Size of the queue through which head chunks are written to the disk to be m-mapped, 0 disables the queue completely. Experimental. Use with server mode only. | `0` |
-| --storage.tsdb.delay-compact-file.path | Path to a JSON file with uploaded TSDB blocks e.g. Thanos shipper meta file. If set TSDB will only compact 1 level blocks that are marked as uploaded in that file, improving external storage integrations e.g. with Thanos sidecar. 1+ level compactions won't be delayed. Use with server mode only. | |
-| --storage.agent.path | Base path for metrics storage. Use with agent mode only. | `data-agent/` |
-| --storage.agent.wal-compression | Compress the agent WAL. If false, the --storage.agent.wal-compression-type flag is ignored. Use with agent mode only. | `true` |
-| --storage.agent.retention.min-time | Minimum age samples may be before being considered for deletion when the WAL is truncated Use with agent mode only. | `5m` |
-| --storage.agent.retention.max-time | Maximum age samples may be before being forcibly deleted when the WAL is truncated Use with agent mode only. | `4h` |
-| --storage.agent.checkpoint-from-in-memory-series | Use only in-memory series data when building a checkpoint. Use with agent mode only. | `false` |
-| --storage.agent.checkpoint-batch-size | Size of a single WAL log entry chunk to be flushed. Has no effect without --storage.agent.checkpoint-from-in-memory-series flag. Use with agent mode only. | `1000` |
-| --storage.agent.no-lockfile | Do not create lockfile in data directory. Use with agent mode only. | `false` |
-| --storage.remote.flush-deadline | How long to wait flushing sample on shutdown or config reload. | `1m` |
-| --storage.remote.read-sample-limit | Maximum overall number of samples to return via the remote read interface, in a single query. 0 means no limit. This limit is ignored for streamed response types. Use with server mode only. | `5e7` |
-| --storage.remote.read-concurrent-limit | Maximum number of concurrent remote read calls. 0 means no limit. Use with server mode only. | `10` |
-| --storage.remote.read-max-bytes-in-frame | Maximum number of bytes in a single frame for streaming remote read response types before marshalling. Note that client might have limit on frame size as well. 1MB as recommended by protobuf by default. Use with server mode only. | `1048576` |
-| --web.search.max-limit | Hard upper bound on the "limit" query parameter accepted by the experimental search API (--enable-feature=search-api). Requests with a higher limit are rejected with HTTP 400. 0 disables the cap. Use with server mode only. | `10000` |
-| --rules.alert.for-outage-tolerance | Max time to tolerate prometheus outage for restoring "for" state of alert. Use with server mode only. | `1h` |
-| --rules.alert.for-grace-period | Minimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period. Use with server mode only. | `10m` |
-| --rules.alert.resend-delay | Minimum amount of time to wait before resending an alert to Alertmanager. Use with server mode only. | `1m` |
-| --rules.max-concurrent-evals | Global concurrency limit for independent rules that can run concurrently. When set, "query.max-concurrency" may need to be adjusted accordingly. Use with server mode only. | `4` |
-| --alertmanager.notification-queue-capacity | The capacity of the queue for pending Alertmanager notifications. Use with server mode only. | `10000` |
-| --alertmanager.notification-batch-size | The maximum number of notifications per batch to send to the Alertmanager. Use with server mode only. | `256` |
-| --alertmanager.drain-notification-queue-on-shutdown | Send any outstanding Alertmanager notifications when shutting down. If false, any outstanding Alertmanager notifications will be dropped when shutting down. Use with server mode only. | `true` |
-| --query.lookback-delta | The maximum lookback duration for retrieving metrics during expression evaluations and federation. Use with server mode only. | `5m` |
-| --query.timeout | Maximum time a query may take before being aborted. Use with server mode only. | `2m` |
-| --query.max-concurrency | Maximum number of queries executed concurrently. Use with server mode only. | `20` |
-| --query.max-samples | Maximum number of samples a single query can load into memory. Note that queries will fail if they try to load more samples than this into memory, so this also limits the number of samples a query can return. Use with server mode only. | `50000000` |
-| --enable-feature ... | Comma separated feature names to enable. Valid options: concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, extra-scrape-metrics, memory-snapshot-on-shutdown, metadata-wal-records, old-ui, otlp-deltatocumulative, otlp-native-delta-ingestion, promql-binop-fill-modifiers, promql-delayed-name-removal, promql-duration-expr, promql-experimental-functions, promql-extended-range-selectors, promql-per-step-stats, search-api, st-storage, st-synthesis, type-and-unit-labels, use-start-timestamps, use-uncached-io, xor2-encoding. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details. | |
-| --agent | Run Prometheus in 'Agent mode'. | |
-| --log.level | Only log messages with the given severity or above. One of: [debug, info, warn, error] | `info` |
-| --log.format | Output format of log messages. One of: [logfmt, json] | `logfmt` |
-
-
diff --git a/docs/command-line/promtool.md b/docs/command-line/promtool.md
deleted file mode 100644
index 06c6f87874..0000000000
--- a/docs/command-line/promtool.md
+++ /dev/null
@@ -1,774 +0,0 @@
----
-title: promtool
----
-
-Tooling for the Prometheus monitoring system.
-
-
-## Flags
-
-| Flag | Description |
-| --- | --- |
-| -h, --help | Show context-sensitive help (also try --help-long and --help-man). |
-| --version | Show application version. |
-| --experimental | Enable experimental commands. |
-| --enable-feature ... | Comma separated feature names to enable. Valid options: promql-experimental-functions, promql-delayed-name-removal, promql-duration-expr, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details |
-
-
-
-
-## Commands
-
-| Command | Description |
-| --- | --- |
-| help | Show help. |
-| check | Check the resources for validity. |
-| query | Run query against a Prometheus server. |
-| debug | Fetch debug information. |
-| push | Push to a Prometheus server. |
-| test | Unit testing. |
-| tsdb | Run tsdb commands. |
-| promql | PromQL formatting and editing. Requires the --experimental flag. |
-
-
-
-
-### `promtool help`
-
-Show help.
-
-
-
-#### Arguments
-
-| Argument | Description |
-| --- | --- |
-| command | Show help on command. |
-
-
-
-
-### `promtool check`
-
-Check the resources for validity.
-
-
-
-#### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --query.lookback-delta | The server's maximum query lookback duration. | `5m` |
-
-
-
-
-##### `promtool check service-discovery`
-
-Perform service discovery for the given job name and report the results, including relabeling.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --timeout | The time to wait for discovery results. | `30s` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| config-file | The prometheus config file. | Yes |
-| job | The job to run service discovery for. | Yes |
-
-
-
-
-##### `promtool check config`
-
-Check if the config files are valid or not.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --syntax-only | Only check the config file syntax, ignoring file and content validation referenced in the config | |
-| --lint | Linting checks to apply to the rules/scrape configs specified in the config. Available options are: all, duplicate-rules, none, too-long-scrape-interval. Use --lint=none to disable linting | `duplicate-rules` |
-| --lint-fatal | Make lint errors exit with exit code 3. | `false` |
-| --ignore-unknown-fields | Ignore unknown fields in the rule groups read by the config files. This is useful when you want to extend rule files with custom metadata. Ensure that those fields are removed before loading them into the Prometheus server as it performs strict checks by default. | `false` |
-| --agent | Check config file for Prometheus in Agent mode. | |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| config-files | The config files to check. | Yes |
-
-
-
-
-##### `promtool check web-config`
-
-Check if the web config files are valid or not.
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| web-config-files | The config files to check. | Yes |
-
-
-
-
-##### `promtool check healthy`
-
-Check if the Prometheus server is healthy.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --http.config.file | HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool | |
-| --url | The URL for the Prometheus server. | `http://localhost:9090` |
-
-
-
-
-##### `promtool check ready`
-
-Check if the Prometheus server is ready.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --http.config.file | HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool | |
-| --url | The URL for the Prometheus server. | `http://localhost:9090` |
-
-
-
-
-##### `promtool check rules`
-
-Check if the rule files are valid or not.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --lint | Linting checks to apply. Available options are: all, duplicate-rules, none. Use --lint=none to disable linting | `duplicate-rules` |
-| --lint-fatal | Make lint errors exit with exit code 3. | `false` |
-| --ignore-unknown-fields | Ignore unknown fields in the rule files. This is useful when you want to extend rule files with custom metadata. Ensure that those fields are removed before loading them into the Prometheus server as it performs strict checks by default. | `false` |
-
-
-
-
-###### Arguments
-
-| Argument | Description |
-| --- | --- |
-| rule-files | The rule files to check, default is read from standard input. |
-
-
-
-
-##### `promtool check metrics`
-
-Pass Prometheus metrics over stdin to lint them for consistency and correctness, and optionally perform cardinality analysis.
-
-examples:
-
-$ cat metrics.prom | promtool check metrics
-
-$ curl -s http://localhost:9090/metrics | promtool check metrics `--extended`
-
-$ curl -s http://localhost:9100/metrics | promtool check metrics `--extended` `--lint`=none
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --extended | Print extended information related to the cardinality of the metrics. | |
-| --lint | Linting checks to apply for metrics. Available options are: all, none. Use --lint=none to disable metrics linting. | `all` |
-
-
-
-
-### `promtool query`
-
-Run query against a Prometheus server.
-
-
-
-#### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| -o, --format | Output format of the query. | `promql` |
-| --http.config.file | HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool | |
-
-
-
-
-##### `promtool query instant`
-
-Run instant query.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| --time | Query evaluation time (RFC3339 or Unix timestamp). |
-| --header | Extra headers to send to server. |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to query. | Yes |
-| expr | PromQL query expression. | Yes |
-
-
-
-
-##### `promtool query range`
-
-Run range query.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| --header | Extra headers to send to server. |
-| --start | Query range start time (RFC3339 or Unix timestamp). |
-| --end | Query range end time (RFC3339 or Unix timestamp). |
-| --step | Query step size (duration). |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to query. | Yes |
-| expr | PromQL query expression. | Yes |
-
-
-
-
-##### `promtool query series`
-
-Run series query.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| --match ... | Series selector. Can be specified multiple times. |
-| --start | Start time (RFC3339 or Unix timestamp). |
-| --end | End time (RFC3339 or Unix timestamp). |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to query. | Yes |
-
-
-
-
-##### `promtool query labels`
-
-Run labels query.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| --start | Start time (RFC3339 or Unix timestamp). |
-| --end | End time (RFC3339 or Unix timestamp). |
-| --match ... | Series selector. Can be specified multiple times. |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to query. | Yes |
-| name | Label name to provide label values for. | Yes |
-
-
-
-
-##### `promtool query analyze`
-
-Run queries against your Prometheus to analyze the usage pattern of certain metrics.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --server | Prometheus server to query. | |
-| --type | Type of metric: histogram. | |
-| --duration | Time frame to analyze. | `1h` |
-| --time | Query time (RFC3339 or Unix timestamp), defaults to now. | |
-| --match ... | Series selector. Can be specified multiple times. | |
-
-
-
-
-### `promtool debug`
-
-Fetch debug information.
-
-
-
-##### `promtool debug pprof`
-
-Fetch profiling debug information.
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to get pprof files from. | Yes |
-
-
-
-
-##### `promtool debug metrics`
-
-Fetch metrics debug information.
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to get metrics from. | Yes |
-
-
-
-
-##### `promtool debug all`
-
-Fetch all debug information.
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| server | Prometheus server to get all debug information from. | Yes |
-
-
-
-
-### `promtool push`
-
-Push to a Prometheus server.
-
-
-
-#### Flags
-
-| Flag | Description |
-| --- | --- |
-| --http.config.file | HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool |
-
-
-
-
-##### `promtool push metrics`
-
-Push metrics to a prometheus remote write (for testing purpose only).
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --label | Label to attach to metrics. Can be specified multiple times. | `job=promtool` |
-| --timeout | The time to wait for pushing metrics. | `30s` |
-| --header | Prometheus remote write header. | |
-| --protobuf_message | Protobuf message to use when writing (prometheus.WriteRequest or io.prometheus.write.v2.Request). | `prometheus.WriteRequest` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| remote-write-url | Prometheus remote write url to push metrics. | Yes |
-| metric-files | The metric files to push, default is read from standard input. | |
-
-
-
-
-### `promtool test`
-
-Unit testing.
-
-
-
-#### Flags
-
-| Flag | Description |
-| --- | --- |
-| --junit | File path to store JUnit XML test results. |
-
-
-
-
-##### `promtool test rules`
-
-Unit tests for rules.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --run ... | If set, will only run test groups whose names match the regular expression. Can be specified multiple times. | |
-| --debug | Enable unit test debugging. | `false` |
-| --diff | [Experimental] Print colored differential output between expected & received output. | `false` |
-| --ignore-unknown-fields | Ignore unknown fields in the test files. This is useful when you want to extend rule files with custom metadata. Ensure that those fields are removed before loading them into the Prometheus server as it performs strict checks by default. | `false` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| test-rule-file | The unit test file. | Yes |
-
-
-
-
-### `promtool tsdb`
-
-Run tsdb commands.
-
-
-
-##### `promtool tsdb bench`
-
-Run benchmarks.
-
-
-
-##### `promtool tsdb bench write`
-
-Run a write performance benchmark.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --out | Set the output path. | `benchout` |
-| --metrics | Number of metrics to read. | `10000` |
-| --scrapes | Number of scrapes to simulate. | `3000` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Default |
-| --- | --- | --- |
-| file | Input file with samples data, default is (../../tsdb/testdata/20kseries.json). | `../../tsdb/testdata/20kseries.json` |
-
-
-
-
-##### `promtool tsdb analyze`
-
-Analyze churn, label pair cardinality and compaction efficiency.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --limit | How many items to show in each list. | `20` |
-| --extended | Run extended analysis. | |
-| --match | Series selector to analyze. Only 1 set of matchers is supported now. | |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Default |
-| --- | --- | --- |
-| db path | Database path (default is data/). | `data/` |
-| block id | Block to analyze (default is the last block). | |
-
-
-
-
-##### `promtool tsdb list`
-
-List tsdb blocks.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| -r, --human-readable | Print human readable values. |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Default |
-| --- | --- | --- |
-| db path | Database path (default is data/). | `data/` |
-
-
-
-
-##### `promtool tsdb dump`
-
-Dump data (series+samples or optionally just series) from a TSDB.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --sandbox-dir-root | Root directory where a sandbox directory will be created, this sandbox is used in case WAL replay generates chunks (default is the database path). The sandbox is cleaned up at the end. | |
-| --min-time | Minimum timestamp to dump, in milliseconds since the Unix epoch. | `-9223372036854775808` |
-| --max-time | Maximum timestamp to dump, in milliseconds since the Unix epoch. | `9223372036854775807` |
-| --match ... | Series selector. Can be specified multiple times. | `{__name__=~'(?s:.*)'}` |
-| --format | Output format of the dump (prom (default) or seriesjson). | `prom` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Default |
-| --- | --- | --- |
-| db path | Database path (default is data/). | `data/` |
-
-
-
-
-##### `promtool tsdb dump-openmetrics`
-
-[Experimental] Dump samples from a TSDB into OpenMetrics text format, excluding native histograms and staleness markers, which are not representable in OpenMetrics.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --sandbox-dir-root | Root directory where a sandbox directory will be created, this sandbox is used in case WAL replay generates chunks (default is the database path). The sandbox is cleaned up at the end. | |
-| --min-time | Minimum timestamp to dump, in milliseconds since the Unix epoch. | `-9223372036854775808` |
-| --max-time | Maximum timestamp to dump, in milliseconds since the Unix epoch. | `9223372036854775807` |
-| --match ... | Series selector. Can be specified multiple times. | `{__name__=~'(?s:.*)'}` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Default |
-| --- | --- | --- |
-| db path | Database path (default is data/). | `data/` |
-
-
-
-
-##### `promtool tsdb create-blocks-from`
-
-[Experimental] Import samples from input and produce TSDB blocks. Please refer to the storage docs for more details.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| -r, --human-readable | Print human readable values. |
-| -q, --quiet | Do not print created blocks. |
-
-
-
-
-##### `promtool tsdb create-blocks-from openmetrics`
-
-Import samples from OpenMetrics input and produce TSDB blocks. Please refer to the storage docs for more details.
-
-
-
-###### Flags
-
-| Flag | Description |
-| --- | --- |
-| --label | Label to attach to metrics. Can be specified multiple times. Example --label=label_name=label_value |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Default | Required |
-| --- | --- | --- | --- |
-| input file | OpenMetrics file to read samples from. | | Yes |
-| output directory | Output directory for generated blocks. | `data/` | |
-
-
-
-
-##### `promtool tsdb create-blocks-from rules`
-
-Create blocks of data for new recording rules.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| --http.config.file | HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool | |
-| --url | The URL for the Prometheus API with the data where the rule will be backfilled from. | `http://localhost:9090` |
-| --start | The time to start backfilling the new rule from. Must be a RFC3339 formatted date or Unix timestamp. Required. | |
-| --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 hours ago. Must be a RFC3339 formatted date or Unix timestamp. | |
-| --output-dir | Output directory for generated blocks. | `data/` |
-| --eval-interval | How frequently to evaluate rules when backfilling if a value is not set in the recording rule files. | `60s` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| 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. | Yes |
-
-
-
-
-### `promtool promql`
-
-PromQL formatting and editing. Requires the `--experimental` flag.
-
-
-
-##### `promtool promql format`
-
-Format PromQL query to pretty printed form.
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| query | PromQL query. | Yes |
-
-
-
-
-##### `promtool promql label-matchers`
-
-Edit label matchers contained within an existing PromQL query.
-
-
-
-##### `promtool promql label-matchers set`
-
-Set a label matcher in the query.
-
-
-
-###### Flags
-
-| Flag | Description | Default |
-| --- | --- | --- |
-| -t, --type | Type of the label matcher to set. | `=` |
-
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| query | PromQL query. | Yes |
-| name | Name of the label matcher to set. | Yes |
-| value | Value of the label matcher to set. | Yes |
-
-
-
-
-##### `promtool promql label-matchers delete`
-
-Delete a label from the query.
-
-
-
-###### Arguments
-
-| Argument | Description | Required |
-| --- | --- | --- |
-| query | PromQL query. | Yes |
-| name | Name of the label to delete. | Yes |
-
-
diff --git a/docs/configuration/alerting_rules.md b/docs/configuration/alerting_rules.md
deleted file mode 100644
index faffad56f2..0000000000
--- a/docs/configuration/alerting_rules.md
+++ /dev/null
@@ -1,117 +0,0 @@
----
-title: Alerting rules
-sort_rank: 3
----
-
-Alerting rules allow you to define alert conditions based on Prometheus
-expression language expressions and to send notifications about firing alerts
-to an external service. Whenever the alert expression results in one or more
-vector elements at a given point in time, the alert counts as active for these
-elements' label sets.
-
-## Defining alerting rules
-
-Alerting rules are configured in Prometheus in the same way as [recording
-rules](recording_rules.md).
-
-An example rules file with an alert would be:
-
-```yaml
-groups:
-- name: example
- labels:
- team: myteam
- rules:
- - alert: HighRequestLatency
- expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
- for: 10m
- keep_firing_for: 5m
- labels:
- severity: page
- annotations:
- summary: High request latency
-```
-
-The optional `for` clause causes Prometheus to wait for a certain duration
-between first encountering a new expression output vector element and counting
-an alert as firing for this element. In this case, Prometheus will check that
-the alert continues to be active during each evaluation for 10 minutes before
-firing the alert. Elements that are active, but not firing yet, are in the pending state.
-Alerting rules without the `for` clause will become active on the first evaluation.
-
-There is also an optional `keep_firing_for` clause that tells Prometheus to keep
-this alert firing for the specified duration after the firing condition was last met.
-This can be used to prevent situations such as flapping alerts, false resolutions
-due to lack of data loss, etc. Alerting rules without the `keep_firing_for` clause
-will deactivate on the first evaluation where the condition is not met (assuming
-any optional `for` duration described above has been satisfied).
-
-The `labels` clause allows specifying a set of additional labels to be attached
-to the alert. Any existing conflicting labels will be overwritten. The label
-values can be templated.
-
-The `annotations` clause specifies a set of informational labels that can be used to store longer additional information such as alert descriptions or runbook links. The annotation values can be templated.
-
-### Templating
-
-Label and annotation values can be templated using [console
-templates](https://prometheus.io/docs/visualization/consoles). The `$labels`
-variable holds the label key/value pairs of an alert instance. The configured
-external labels can be accessed via the `$externalLabels` variable. The
-`$value` variable holds the evaluated value of an alert instance.
-
- # To insert a firing element's label values:
- {{ $labels. }}
- # To insert the numeric expression value of the firing element:
- {{ $value }}
-
-Examples:
-
-```yaml
-groups:
-- name: example
- rules:
-
- # Alert for any instance that is unreachable for >5 minutes.
- - alert: InstanceDown
- expr: up == 0
- for: 5m
- labels:
- severity: page
- annotations:
- summary: "Instance {{ $labels.instance }} down"
- description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
-
- # Alert for any instance that has a median request latency >1s.
- - alert: APIHighRequestLatency
- expr: api_http_request_latencies_second{quantile="0.5"} > 1
- for: 10m
- annotations:
- summary: "High request latency on {{ $labels.instance }}"
- description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)"
-```
-
-## Inspecting alerts during runtime
-
-To manually inspect which alerts are active (pending or firing), navigate to
-the "Alerts" tab of your Prometheus instance. This will show you the exact
-label sets for which each defined alert is currently active.
-
-For pending and firing alerts, Prometheus also stores synthetic time series of
-the form `ALERTS{alertname="", alertstate="", }`.
-The sample value is set to `1` as long as the alert is in the indicated active
-(pending or firing) state, and the series is marked stale when this is no
-longer the case.
-
-## Sending alert notifications
-
-Prometheus's alerting rules are good at figuring what is broken *right now*, but
-they are not a fully-fledged notification solution. Another layer is needed to
-add summarization, notification rate limiting, silencing and alert dependencies
-on top of the simple alert definitions. In Prometheus's ecosystem, the
-[Alertmanager](https://prometheus.io/docs/alerting/alertmanager/) takes on this
-role. Thus, Prometheus may be configured to periodically send information about
-alert states to an Alertmanager instance, which then takes care of dispatching
-the right notifications.
-Prometheus can be [configured](configuration.md) to automatically discover available
-Alertmanager instances through its service discovery integrations.
diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md
deleted file mode 100644
index 19a1bdbca5..0000000000
--- a/docs/configuration/configuration.md
+++ /dev/null
@@ -1,4100 +0,0 @@
----
-title: Configuration
-sort_rank: 1
----
-
-Prometheus is configured via command-line flags and a configuration file. While
-the command-line flags configure immutable system parameters (such as storage
-locations, amount of data to keep on disk and in memory, etc.), the
-configuration file defines everything related to scraping [jobs and their
-instances](https://prometheus.io/docs/concepts/jobs_instances/), as well as
-which [rule files to load](recording_rules.md#configuring-rules).
-
-To view all available command-line flags, run `./prometheus -h`.
-
-Prometheus can reload its configuration at runtime. If the new configuration
-is not well-formed, the changes will not be applied.
-A configuration reload is triggered by sending a `SIGHUP` to the Prometheus process or
-sending a HTTP POST request to the `/-/reload` endpoint (when the `--web.enable-lifecycle` flag is enabled).
-This will also reload any configured rule files.
-
-## Configuration file
-
-To specify which configuration file to load, use the `--config.file` flag.
-
-The file is written in [YAML format](https://en.wikipedia.org/wiki/YAML),
-defined by the scheme described below.
-Brackets indicate that a parameter is optional. For non-list parameters the
-value is set to the specified default.
-
-Generic placeholders are defined as follows:
-
-* ``: a boolean that can take the values `true` or `false`
-* ``: a duration matching the regular expression `((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)`, e.g. `1d`, `1h30m`, `5m`, `10s`
-* ``: a valid path in the current working directory
-* ``: a floating-point number
-* ``: a valid string consisting of a hostname or IP followed by an optional port number
-* ``: an integer value
-* ``: a string matching the regular expression `[a-zA-Z_][a-zA-Z0-9_]*`. Any other unsupported character in the source label should be converted to an underscore. For example, the label `app.kubernetes.io/name` should be written as `app_kubernetes_io_name`.
-* ``: a string of unicode characters
-* ``: a valid URL path
-* ``: a string that can take the values `http` or `https`
-* ``: a regular string that is a secret, such as a password
-* ``: a regular string
-* ``: a size in bytes, e.g. `512MB`. A unit is required. Supported units: B, KB, MB, GB, TB, PB, EB.
-* ``: a string which is template-expanded before usage
-
-The other placeholders are specified separately.
-
-A valid example file can be found [here](/config/testdata/conf.good.yml).
-
-The global configuration specifies parameters that are valid in all other configuration
-contexts. They also serve as defaults for other configuration sections.
-
-```yaml
-global:
- # How frequently to scrape targets by default.
- [ scrape_interval: | default = 1m ]
-
- # How long until a scrape request times out.
- # It cannot be greater than the scrape interval.
- [ scrape_timeout: | default = 10s ]
-
- # The protocols to negotiate during a scrape with the client.
- # Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
- # OpenMetricsText1.0.0, PrometheusText0.0.4, PrometheusText1.0.0.
- # If left unset both here and in an individual scrape config, the
- # negotiation order used in that scrape config depends on the effective
- # value of scrape_native_histograms for that scrape config.
- # If scrape_native_histograms is false, the order is
- # [ OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText1.0.0, PrometheusText0.0.4 ].
- # If scrape_native_histograms is true, the order is
- # [ PrometheusProto, OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText1.0.0, PrometheusText0.0.4 ].
- [ scrape_protocols: [, ...] ]
-
- # How frequently to evaluate rules.
- [ evaluation_interval: | default = 1m ]
-
- # Offset the rule evaluation timestamp of this particular group by the
- # specified duration into the past to ensure the underlying metrics have
- # been received. Metric availability delays are more likely to occur when
- # Prometheus is running as a remote write target, but can also occur when
- # there's anomalies with scraping.
- [ rule_query_offset: | default = 0s ]
-
- # The labels to add to any time series or alerts when communicating with
- # external systems (federation, remote storage, Alertmanager).
- # Environment variable references `${var}` or `$var` are replaced according
- # to the values of the current environment variables.
- # References to undefined variables are replaced by the empty string.
- # The `$` character can be escaped by using `$$`.
- external_labels:
- [ : ... ]
-
- # File to which PromQL queries are logged.
- # Reloading the configuration will reopen the file.
- [ query_log_file: ]
-
- # File to which scrape failures are logged.
- # Reloading the configuration will reopen the file.
- [ scrape_failure_log_file: ]
-
- # An uncompressed response body larger than this many bytes will cause the
- # scrape to fail. 0 means no limit. Example: 100MB.
- # This is an experimental feature, this behaviour could
- # change or be removed in the future.
- [ body_size_limit: | default = 0 ]
-
- # Per-scrape limit on the number of scraped samples that will be accepted.
- # If more than this number of samples are present after metric relabeling
- # the entire scrape will be treated as failed. 0 means no limit.
- [ sample_limit: | default = 0 ]
-
- # Limit on the number of labels that will be accepted per sample. If more
- # than this number of labels are present on any sample post metric-relabeling,
- # the entire scrape will be treated as failed. 0 means no limit.
- [ label_limit: | default = 0 ]
-
- # Limit on the length (in bytes) of each individual label name. If any label
- # name in a scrape is longer than this number post metric-relabeling, the
- # entire scrape will be treated as failed. Note that label names are UTF-8
- # encoded, and characters can take up to 4 bytes. 0 means no limit.
- [ label_name_length_limit: | default = 0 ]
-
- # Limit on the length (in bytes) of each individual label value. If any label
- # value in a scrape is longer than this number post metric-relabeling, the
- # entire scrape will be treated as failed. Note that label values are UTF-8
- # encoded, and characters can take up to 4 bytes. 0 means no limit.
- [ label_value_length_limit: | default = 0 ]
-
- # Limit per scrape config on number of unique targets that will be
- # accepted. If more than this number of targets are present after target
- # relabeling, Prometheus will mark the targets as failed without scraping them.
- # 0 means no limit. This is an experimental feature, this behaviour could
- # change in the future.
- [ target_limit: | default = 0 ]
-
- # Limit per scrape config on the number of targets dropped by relabeling
- # that will be kept in memory. 0 means no limit.
- [ keep_dropped_targets: | default = 0 ]
-
- # Specifies the validation scheme for metric and label names. Either blank or
- # "utf8" for full UTF-8 support, or "legacy" for letters, numbers, colons,
- # and underscores.
- [ metric_name_validation_scheme: | default "utf8" ]
-
- # If true, native histograms exposed by a target are recognized during
- # scraping and ingested as such. If false, any native parts of histograms
- # are ignored and only the classic parts are recognized (possibly as
- # a classic histogram with only the +Inf buckets if no explicit classic
- # buckets are part of the histogram).
- [ scrape_native_histograms: | default = false ]
-
- # Specifies whether to convert scraped classic histograms into native
- # histograms with custom buckets.
- [ convert_classic_histograms_to_nhcb: | default = false ]
-
- # Specifies whether to additionally scrape the classic parts of a histogram,
- # even if it is also exposed with native parts or it is converted into a
- # native histogram with custom buckets.
- [ always_scrape_classic_histograms: | default = false ]
-
- # When enabled, Prometheus stores additional time series for each scrape:
- # scrape_timeout_seconds, scrape_sample_limit, and scrape_body_size_bytes.
- # These metrics help monitor how close targets are to their configured limits.
- # This option can be overridden per scrape config.
- [ extra_scrape_metrics: | default = false ]
-
- # The following explains the various combinations of the last three options
- # in various exposition cases.
- #
- # CASE 1: A histogram is solely exposed as a classic histogram. (Note that
- # this also applies if the used scrape protocol (also see the
- # scrape_protocols setting) does not support native histograms.) In this
- # case, the scrape_native_histograms setting has no effect. If
- # convert_classic_histograms_to_nhcb is false, the histogram is ingested as
- # a classic histograms. If convert_classic_histograms_to_nhcb is true, the
- # histograms is converted to an NHCB. In this case,
- # always_scrape_classic_histograms determines whether it is also ingested
- # as a classic histograms or not.
- #
- # CASE 2: A histogram is solely exposed as a native histogram, i.e. it has
- # no classic buckets except the optional +Inf bucket but it is marked as a
- # native histogram (by some "native parts", at the very least by a no-op
- # span). If scrape_native_histograms is false, this case is handled like case
- # 1, but the resulting classic histogram or NHCB only has a sole bucket, the
- # +Inf bucket. If scrape_native_histograms is true, however, the histogram is
- # recognized as a pure native histogram and ingested as such. There will be
- # no classic histogram ingested, no matter what
- # always_scrape_classic_histograms is set to, and there will be no
- # conversion to an NHCB, no matter what convert_classic_histograms_to_nhcb
- # is set to.
- #
- # CASE 3: A histogram is exposed as both a native and a classic histogram,
- # i.e. it has "native parts" (at the very least a no-op span) and it has at
- # least one classic bucket that is not the +Inf bucket. If
- # scrape_native_histograms is false, this case is handled like case 1. The
- # native parts are ignored, and there will be either a classic histogram, an
- # NHCB, or both. If scrape_native_histograms is true, the histogram is
- # ingested as a native histogram. There will be no NHCB, no matter what
- # convert_classic_histograms_to_nhcb is set to (it would collide with the
- # actual native histogram). However, there will be a classic histogram if (and
- # only if) always_scrape_classic_histograms is set to true.
-
-runtime:
- # Configure the Go garbage collector GOGC parameter
- # See: https://tip.golang.org/doc/gc-guide#GOGC
- # Lowering this number increases CPU usage.
- [ gogc: | default = 75 ]
-
-# Rule files specifies a list of globs. Rules and alerts are read from
-# all matching files.
-rule_files:
- [ - ... ]
-
-# Scrape config files specifies a list of globs. Scrape configs are read from
-# all matching files and appended to the list of scrape configs.
-scrape_config_files:
- [ - ... ]
-
-# A list of scrape configurations.
-scrape_configs:
- [ - ... ]
-
-# Alerting specifies settings related to the Alertmanager.
-alerting:
- alert_relabel_configs:
- [ - ... ]
- alertmanagers:
- [ - ... ]
-
-# Settings related to the remote write feature.
-remote_write:
- [ - ... ]
-
-# Settings related to the OTLP receiver feature.
-# See https://prometheus.io/docs/guides/opentelemetry/ for best practices.
-otlp:
- # Promote specific list of resource attributes to labels.
- # It cannot be configured simultaneously with 'promote_all_resource_attributes: true'.
- [ promote_resource_attributes: [, ...] | default = [ ] ]
- # Promoting all resource attributes to labels, except for the ones configured with 'ignore_resource_attributes'.
- # Be aware that changes in attributes received by the OTLP endpoint may result in time series churn and lead to high memory usage by the Prometheus server.
- # It cannot be set to 'true' simultaneously with 'promote_resource_attributes'.
- [ promote_all_resource_attributes: | default = false ]
- # Which resource attributes to ignore, can only be set when 'promote_all_resource_attributes' is true.
- [ ignore_resource_attributes: [, ...] | default = [] ]
- # Configures translation of OTLP metrics when received through the OTLP metrics
- # endpoint. Available values:
- # - "UnderscoreEscapingWithSuffixes" refers to commonly agreed normalization used
- # by OpenTelemetry in https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus
- # - "NoUTF8EscapingWithSuffixes" is a mode that relies on UTF-8 support in Prometheus.
- # It preserves all special characters like dots, but still adds required metric name suffixes
- # for units and _total, as UnderscoreEscapingWithSuffixes does.
- # - "UnderscoreEscapingWithoutSuffixes" translates metric name characters that
- # are not alphanumerics/underscores/colons to underscores, and label name
- # characters that are not alphanumerics/underscores to underscores, but
- # unlike UnderscoreEscapingWithSuffixes it does not append any suffixes to
- # the names.
- # - (EXPERIMENTAL) "NoTranslation" is a mode that relies on UTF-8 support in Prometheus.
- # It preserves all special character like dots and won't append special suffixes for metric
- # unit and type.
- #
- # WARNING: The "NoTranslation" setting has significant known risks and limitations (see https://prometheus.io/docs/practices/naming/
- # for details):
- # * Impaired UX when using PromQL in plain YAML (e.g. alerts, rules, dashboard, autoscaling configuration).
- # * Series collisions which in the best case may result in OOO errors, in the worst case a silently malformed
- # time series. For instance, you may end up in situation of ingesting `foo.bar` series with unit
- # `seconds` and a separate series `foo.bar` with unit `milliseconds`.
- [ translation_strategy: | default = "UnderscoreEscapingWithSuffixes" ]
- # Enables adding "service.name", "service.namespace" and "service.instance.id"
- # resource attributes to the "target_info" metric, on top of converting
- # them into the "instance" and "job" labels.
- [ keep_identifying_resource_attributes: | default = false ]
- # Configures optional translation of OTLP explicit bucket histograms into native histograms with custom buckets.
- [ convert_histograms_to_nhcb: | default = false ]
- # Enables promotion of OTel scope metadata (i.e. name, version, schema URL, and attributes) to metric labels.
- # This is disabled by default for backwards compatibility, but according to OTel spec, scope metadata _should_ be identifying, i.e. translated to metric labels.
- [ promote_scope_metadata: | default = false ]
- # Controls whether to enable prepending of 'key_' to labels starting with '_'.
- # Reserved labels starting with '__' are not modified.
- # This is only relevant when translation_strategy uses underscore escaping
- # (e.g., "UnderscoreEscapingWithSuffixes" or "UnderscoreEscapingWithoutSuffixes").
- [ label_name_underscore_sanitization: | default = true ]
- # Enables preserving of multiple consecutive underscores in label names when
- # translation_strategy uses underscore escaping. When true (default), multiple
- # consecutive underscores are preserved during label name sanitization.
- [ label_name_preserve_multiple_underscores: | default = true ]
-
-# Settings related to the remote read feature.
-remote_read:
- [ - ... ]
-
-# Storage related settings that are runtime reloadable.
-storage:
- [ tsdb: ]
- [ exemplars: ]
-
-# Configures exporting traces.
-tracing:
- [ ]
-```
-
-### ``
-
-A `scrape_config` section specifies a set of targets and parameters describing how
-to scrape them. In the general case, one scrape configuration specifies a single
-job. In advanced configurations, this may change.
-
-Targets may be statically configured via the `static_configs` parameter or
-dynamically discovered using one of the supported service-discovery mechanisms.
-
-Additionally, `relabel_configs` allow advanced modifications to any
-target and its labels before scraping.
-
-```yaml
-# The job name assigned to scraped metrics by default.
-job_name:
-
-# How frequently to scrape targets from this job.
-[ scrape_interval: | default = ]
-
-# Per-scrape timeout when scraping this job.
-# It cannot be greater than the scrape interval.
-[ scrape_timeout: | default = ]
-
-# The protocols to negotiate during a scrape with the client.
-# Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
-# OpenMetricsText1.0.0, PrometheusText0.0.4, PrometheusText1.0.0.
-# If not set in the global config, the default value depends on the
-# setting of scrape_native_histograms. If false, it is
-# [ OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText1.0.0, PrometheusText0.0.4 ].
-# If true, it is
-# [ PrometheusProto, OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText1.0.0, PrometheusText0.0.4 ].
-[ scrape_protocols: [, ...] | default = ]
-
-# Fallback protocol to use if a scrape returns blank, unparsable, or otherwise
-# invalid Content-Type.
-# Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
-# OpenMetricsText1.0.0, PrometheusText0.0.4, PrometheusText1.0.0.
-[ fallback_scrape_protocol: ]
-
-# The HTTP resource path on which to fetch metrics from targets.
-[ metrics_path: | default = /metrics ]
-
-# honor_labels controls how Prometheus handles conflicts between labels that are
-# already present in scraped data and labels that Prometheus would attach
-# server-side ("job" and "instance" labels, manually configured target
-# labels, and labels generated by service discovery implementations).
-#
-# If honor_labels is set to "true", label conflicts are resolved by keeping label
-# values from the scraped data and ignoring the conflicting server-side labels.
-#
-# If honor_labels is set to "false", label conflicts are resolved by renaming
-# conflicting labels in the scraped data to "exported_" (for
-# example "exported_instance", "exported_job") and then attaching server-side
-# labels.
-#
-# Setting honor_labels to "true" is useful for use cases such as federation and
-# scraping the Pushgateway, where all labels specified in the target should be
-# preserved.
-#
-# Note that any globally configured "external_labels" are unaffected by this
-# setting. In communication with external systems, they are always applied only
-# when a time series does not have a given label yet and are ignored otherwise.
-[ honor_labels: | default = false ]
-
-# honor_timestamps controls whether Prometheus respects the timestamps present
-# in scraped data.
-#
-# If honor_timestamps is set to "true", the timestamps of the metrics exposed
-# by the target will be used.
-#
-# If honor_timestamps is set to "false", the timestamps of the metrics exposed
-# by the target will be ignored.
-[ honor_timestamps: | default = true ]
-
-# track_timestamps_staleness controls whether Prometheus tracks staleness of
-# the metrics that have an explicit timestamps present in scraped data.
-#
-# If track_timestamps_staleness is set to "true", a staleness marker will be
-# inserted in the TSDB when a metric is no longer present or the target
-# is down.
-[ track_timestamps_staleness: | default = false ]
-
-# Configures the protocol scheme used for requests.
-[ scheme: | default = http ]
-
-# Optional HTTP URL parameters.
-params:
- [ : [, ...] ]
-
-# If enable_compression is set to "false", Prometheus will request uncompressed
-# response from the scraped target.
-[ enable_compression: | default = true ]
-
-# File to which scrape failures are logged.
-# Reloading the configuration will reopen the file.
-[ scrape_failure_log_file: ]
-
-# HTTP client settings, including authentication methods (such as basic auth and
-# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
-[ ]
-
-# List of AWS service discovery configurations.
-aws_sd_configs:
- [ - ... ]
-
-# List of Azure service discovery configurations.
-azure_sd_configs:
- [ - ... ]
-
-# List of Consul service discovery configurations.
-consul_sd_configs:
- [ - ... ]
-
-# List of DigitalOcean service discovery configurations.
-digitalocean_sd_configs:
- [ - ... ]
-
-# List of Docker service discovery configurations.
-docker_sd_configs:
- [ - ... ]
-
-# List of Docker Swarm service discovery configurations.
-dockerswarm_sd_configs:
- [ - ... ]
-
-# List of DNS service discovery configurations.
-dns_sd_configs:
- [ - ... ]
-
-# List of EC2 service discovery configurations.
-ec2_sd_configs:
- [ - ... ]
-
-# List of Eureka service discovery configurations.
-eureka_sd_configs:
- [ - ... ]
-
-# List of file service discovery configurations.
-file_sd_configs:
- [ - ... ]
-
-# List of GCE service discovery configurations.
-gce_sd_configs:
- [ - ... ]
-
-# List of Hetzner service discovery configurations.
-hetzner_sd_configs:
- [ - ... ]
-
-# List of HTTP service discovery configurations.
-http_sd_configs:
- [ - ... ]
-
-
-# List of IONOS service discovery configurations.
-ionos_sd_configs:
- [ - ... ]
-
-# List of Kubernetes service discovery configurations.
-kubernetes_sd_configs:
- [ - ... ]
-
-# List of Kuma service discovery configurations.
-kuma_sd_configs:
- [ - ... ]
-
-# List of Lightsail service discovery configurations.
-lightsail_sd_configs:
- [ - ... ]
-
-# List of Linode service discovery configurations.
-linode_sd_configs:
- [ - ... ]
-
-# List of Marathon service discovery configurations.
-marathon_sd_configs:
- [ - ... ]
-
-# List of AirBnB's Nerve service discovery configurations.
-nerve_sd_configs:
- [ - ... ]
-
-# List of Nomad service discovery configurations.
-nomad_sd_configs:
- [ - ... ]
-
-# List of OpenStack service discovery configurations.
-openstack_sd_configs:
- [ - ... ]
-
-# List of Outscale service discovery configurations.
-outscale_sd_configs:
- [ - ... ]
-
-# List of OVHcloud service discovery configurations.
-ovhcloud_sd_configs:
- [ - ... ]
-
-# List of PuppetDB service discovery configurations.
-puppetdb_sd_configs:
- [ - ... ]
-
-# List of Scaleway service discovery configurations.
-scaleway_sd_configs:
- [ - ... ]
-
-# List of Zookeeper Serverset service discovery configurations.
-serverset_sd_configs:
- [ - ... ]
-
-# List of STACKIT service discovery configurations.
-stackit_sd_configs:
- [ - ... ]
-
-# List of Triton service discovery configurations.
-triton_sd_configs:
- [ - ... ]
-
-# List of Uyuni service discovery configurations.
-uyuni_sd_configs:
- [ - ... ]
-
-# List of labeled statically configured targets for this job.
-static_configs:
- [ - ... ]
-
-# List of target relabel configurations.
-relabel_configs:
- [ - ... ]
-
-# List of metric relabel configurations.
-metric_relabel_configs:
- [ - ... ]
-
-# An uncompressed response body larger than this many bytes will cause the
-# scrape to fail. 0 means no limit. Example: 100MB.
-# This is an experimental feature, this behaviour could
-# change or be removed in the future.
-[ body_size_limit: | default = 0 ]
-
-# Per-scrape limit on the number of scraped samples that will be accepted.
-# If more than this number of samples are present after metric relabeling
-# the entire scrape will be treated as failed. 0 means no limit.
-[ sample_limit: | default = 0 ]
-
-# Limit on the number of labels that will be accepted per sample. If more
-# than this number of labels are present on any sample post metric-relabeling,
-# the entire scrape will be treated as failed. 0 means no limit.
-[ label_limit: | default = 0 ]
-
-# Limit on the length (in bytes) of each individual label name. If any label
-# name in a scrape is longer than this number post metric-relabeling, the
-# entire scrape will be treated as failed. Note that label names are UTF-8
-# encoded, and characters can take up to 4 bytes. 0 means no limit.
-[ label_name_length_limit: | default = 0 ]
-
-# Limit on the length (in bytes) of each individual label value. If any label
-# value in a scrape is longer than this number post metric-relabeling, the
-# entire scrape will be treated as failed. Note that label values are UTF-8
-# encoded, and characters can take up to 4 bytes. 0 means no limit.
-[ label_value_length_limit: | default = 0 ]
-
-# Limit per scrape config on number of unique targets that will be
-# accepted. If more than this number of targets are present after target
-# relabeling, Prometheus will mark the targets as failed without scraping them.
-# 0 means no limit. This is an experimental feature, this behaviour could
-# change in the future.
-[ target_limit: | default = 0 ]
-
-# Limit per scrape config on the number of targets dropped by relabeling
-# that will be kept in memory. 0 means no limit.
-[ keep_dropped_targets: | default = 0 ]
-
-# Specifies the validation scheme for metric and label names. Either blank or
-# "utf8" for full UTF-8 support, or "legacy" for letters, numbers, colons, and
-# underscores.
-[ metric_name_validation_scheme: | default "utf8" ]
-
-# Specifies the character escaping scheme that will be requested when scraping
-# for metric and label names that do not conform to the legacy Prometheus
-# character set. Available options are:
-# * `allow-utf-8`: Full UTF-8 support, no escaping needed.
-# * `underscores`: Escape all legacy-invalid characters to underscores.
-# * `dots`: Escapes dots to `_dot_`, underscores to `__`, and all other
-# legacy-invalid characters to underscores.
-# * `values`: Prepend the name with `U__` and replace all invalid
-# characters with their unicode value, surrounded by underscores. Single
-# underscores are replaced with double underscores.
-# e.g. "U__my_2e_dotted_2e_name".
-# If this value is left blank, Prometheus will default to `allow-utf-8` if the
-# validation scheme for the current scrape config is set to utf8, or
-# `underscores` if the validation scheme is set to `legacy`.
-[ metric_name_escaping_scheme: | default "allow-utf-8" ]
-
-# Limit on total number of positive and negative buckets allowed in a single
-# native histogram. The resolution of a histogram with more buckets will be
-# reduced until the number of buckets is within the limit. If the limit cannot
-# be reached, the scrape will fail.
-# 0 means no limit.
-[ native_histogram_bucket_limit: | default = 0 ]
-
-# Lower limit for the growth factor of one bucket to the next in each native
-# histogram. The resolution of a histogram with a lower growth factor will be
-# reduced as much as possible until it is within the limit.
-# To set an upper limit for the schema (equivalent to "scale" in OTel's
-# exponential histograms), use the following factor limits:
-#
-# +----------------------------+----------------------------+
-# | growth factor | resulting schema AKA scale |
-# +----------------------------+----------------------------+
-# | 65536 | -4 |
-# +----------------------------+----------------------------+
-# | 256 | -3 |
-# +----------------------------+----------------------------+
-# | 16 | -2 |
-# +----------------------------+----------------------------+
-# | 4 | -1 |
-# +----------------------------+----------------------------+
-# | 2 | 0 |
-# +----------------------------+----------------------------+
-# | 1.4 | 1 |
-# +----------------------------+----------------------------+
-# | 1.1 | 2 |
-# +----------------------------+----------------------------+
-# | 1.09 | 3 |
-# +----------------------------+----------------------------+
-# | 1.04 | 4 |
-# +----------------------------+----------------------------+
-# | 1.02 | 5 |
-# +----------------------------+----------------------------+
-# | 1.01 | 6 |
-# +----------------------------+----------------------------+
-# | 1.005 | 7 |
-# +----------------------------+----------------------------+
-# | 1.002 | 8 |
-# +----------------------------+----------------------------+
-#
-# 0 results in the smallest supported factor (which is currently ~1.0027 or
-# schema 8, but might change in the future).
-[ native_histogram_min_bucket_factor: | default = 0 ]
-
-# If true, native histograms exposed by a target are recognized during
-# scraping and ingested as such. If false, any native parts of histograms
-# are ignored and only the classic parts are recognized (possibly as
-# a classic histogram with only the +Inf buckets if no explicit classic
-# buckets are part of the histogram).
-[ scrape_native_histograms: | default = ]
-
-# Specifies whether to convert classic histograms into native histograms with
-# custom buckets.
-[ convert_classic_histograms_to_nhcb: | default = ]
-
-# Specifies whether to additionally scrape the classic parts of a histogram,
-# even if it is also exposed with native parts or it is converted into a
-# native histogram with custom buckets.
-[ always_scrape_classic_histograms: | default = ]
-
-# When enabled, Prometheus stores additional time series for this scrape job:
-# scrape_timeout_seconds, scrape_sample_limit, and scrape_body_size_bytes.
-# These metrics help monitor how close targets are to their configured limits.
-# If not set, inherits the value from the global configuration.
-[ extra_scrape_metrics: | default = ]
-
-# See global configuration above for further explanations of how the last three
-# options combine their effects.
-
-```
-
-Where `` must be unique across all scrape configurations.
-
-### ``
-
-A `http_config` allows configuring HTTP requests.
-
-```yaml
-# Sets the `Authorization` header on every request with the
-# configured username and password.
-# username and username_file are mutually exclusive.
-# password and password_file are mutually exclusive.
-basic_auth:
- [ username: ]
- [ username_file: ]
- [ password: ]
- [ password_file: ]
-
-# Sets the `Authorization` header on every request with
-# the configured credentials.
-authorization:
- # Sets the authentication type of the request.
- [ type: | default: Bearer ]
- # Sets the credentials of the request. It is mutually exclusive with
- # `credentials_file`.
- [ credentials: ]
- # Sets the credentials of the request with the credentials read from the
- # configured file. It is mutually exclusive with `credentials`.
- [ credentials_file: ]
-
-# Optional OAuth 2.0 configuration.
-# Cannot be used at the same time as basic_auth or authorization.
-oauth2:
- [ ]
-
-# Configure whether requests follow HTTP 3xx redirects.
-[ follow_redirects: | default = true ]
-
-# Whether to enable HTTP2.
-[ enable_http2: | default: true ]
-
-# Configures the request's TLS settings.
-tls_config:
- [ ]
-
-# Optional proxy URL.
-[ proxy_url: ]
-# Comma-separated string that can contain IPs, CIDR notation, domain names
-# that should be excluded from proxying. IP and domain names can
-# contain port numbers.
-[ no_proxy: ]
-# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
-[ proxy_from_environment: | default: false ]
-# Specifies headers to send to proxies during CONNECT requests.
-[ proxy_connect_header:
- [ : [, ...] ] ]
-
-# Custom HTTP headers to be sent along with each request.
-# Headers that are set by Prometheus itself can't be overwritten.
-http_headers:
- # Header name.
- [ :
- # Header values.
- [ values: [, ...] ]
- # Headers values. Hidden in configuration page.
- [ secrets: [, ...] ]
- # Files to read header values from.
- [ files: [, ...] ] ]
-```
-
-### ``
-
-A `tls_config` allows configuring TLS connections.
-
-```yaml
-# CA certificate to validate API server certificate with. At most one of ca and ca_file is allowed.
-[ ca: ]
-[ ca_file: ]
-
-# Certificate and key for client cert authentication to the server.
-# At most one of cert and cert_file is allowed.
-# At most one of key and key_file is allowed.
-[ cert: ]
-[ cert_file: ]
-[ key: ]
-[ key_file: ]
-
-# ServerName extension to indicate the name of the server.
-# https://tools.ietf.org/html/rfc4366#section-3.1
-[ server_name: ]
-
-# Disable validation of the server certificate.
-[ insecure_skip_verify: ]
-
-# Minimum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
-# 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
-# If unset, Prometheus will use Go default minimum version, which is TLS 1.2.
-# See MinVersion in https://pkg.go.dev/crypto/tls#Config.
-[ min_version: ]
-# Maximum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
-# 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
-# If unset, Prometheus will use Go default maximum version, which is TLS 1.3.
-# See MaxVersion in https://pkg.go.dev/crypto/tls#Config.
-[ max_version: ]
-```
-
-### ``
-
-OAuth 2.0 authentication using the client credentials or password grant type.
-Prometheus fetches an access token from the specified endpoint with
-the given client access and credentials.
-
-```yaml
-client_id:
-
-# OAuth2 grant type to use. It can be one of
-# "client_credentials" or "urn:ietf:params:oauth:grant-type:jwt-bearer" (RFC 7523).
-# Default value is "client_credentials"
-[ grant_type: ]
-
-# Client secret to provide to authorization server. Only used if
-# GrantType is set empty or set to "client_credentials".
-[ client_secret: ]
-
-# Read the client secret from a file.
-# It is mutually exclusive with `client_secret`.
-[ client_secret_file: ]
-
-# Secret key to sign JWT with. Only used if
-# GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer".
-[ client_certificate_key: ]
-
-# Read the secret key from a file.
-# It is mutually exclusive with `client_certificate_key`.
-[ client_certificate_key_file: ]
-
-# JWT kid value to include in the JWT header. Only used if
-# GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer".
-[ client_certificate_key_id: ]
-
-# Signature algorithm used to sign JWT token. Only used if
-# GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer".
-# Default value is RS256 and valid values RS256, RS384, RS512
-[ signature_algorithm: ]
-
-# OAuth client identifier used when communicating with
-# the configured OAuth provider. Default value is client_id. Only used if
-# GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer".
-[ iss: ]
-
-# Intended audience of the request. If empty, the value
-# of TokenURL is used as the intended audience. Only used if
-# GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer".
-[ audience: ]
-
-# Map of claims to be added to the JWT token. Only used if
-# GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer".
-claims:
- [ : ... ]
-
-# Scopes for the token request.
-scopes:
- [ - ... ]
-
-# The URL to fetch the token from.
-token_url:
-
-# Optional parameters to append to the token URL.
-# To set 'password' grant type, add it to params:
-# endpoint_params:
-# grant_type: 'password'
-# username: 'username@example.com'
-# password: 'strongpassword'
-endpoint_params:
- [ : ... ]
-
-# Configures the token request's TLS settings.
-tls_config:
- [ ]
-
-# Optional proxy URL.
-[ proxy_url: ]
-# Comma-separated string that can contain IPs, CIDR notation, domain names
-# that should be excluded from proxying. IP and domain names can
-# contain port numbers.
-[ no_proxy: ]
-# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
-[ proxy_from_environment: | default: false ]
-# Specifies headers to send to proxies during CONNECT requests.
-[ proxy_connect_header:
- [ : [, ...] ] ]
-
-# Custom HTTP headers to be sent along with each request.
-# Headers that are set by Prometheus itself can't be overwritten.
-http_headers:
- # Header name.
- [ :
- # Header values.
- [ values: [, ...] ]
- # Headers values. Hidden in configuration page.
- [ secrets: [, ...] ]
- # Files to read header values from.
- [ files: [, ...] ] ]
-```
-
-### ``
-
-AWS SD configurations allow retrieving scrape targets from AWS services.
-This is a unified service discovery that supports multiple AWS service types through the `role` parameter.
-
-One of the following `role` types can be configured to discover targets:
-
-#### `ec2`
-
-The `ec2` role discovers targets from AWS EC2 instances. The private IP address is used by default, but may be changed to
-the public IP address with relabeling.
-
-The IAM credentials used must have the `ec2:DescribeInstances` permission to
-discover scrape targets, and may optionally have the
-`ec2:DescribeAvailabilityZones` permission if you want the availability zone ID
-available as a label (see below).
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-* `__meta_ec2_ami`: the EC2 Amazon Machine Image
-* `__meta_ec2_architecture`: the architecture of the instance
-* `__meta_ec2_availability_zone`: the availability zone in which the instance is running
-* `__meta_ec2_availability_zone_id`: the [availability zone ID](https://docs.aws.amazon.com/ram/latest/userguide/working-with-az-ids.html) in which the instance is running (requires `ec2:DescribeAvailabilityZones`)
-* `__meta_ec2_instance_id`: the EC2 instance ID
-* `__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 separated 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_default_ipv6_address`: the first primary IPv6 address found if present, otherwise first non-primary IPv6 address, if present
-* `__meta_ec2_primary_ipv6_addresses`: comma separated list of the Primary IPv6 addresses of the instance, if present. The list is ordered based on the position of each corresponding network interface in the attachment order.
-* `__meta_ec2_primary_subnet_id`: the subnet ID of the primary network interface, if available
-* `__meta_ec2_private_dns_name`: the private DNS name of the instance, if available
-* `__meta_ec2_private_ip`: the private IP address of the instance, if present
-* `__meta_ec2_public_dns_name`: the public DNS name of the instance, if available
-* `__meta_ec2_public_ip`: the public IP address of the instance, if available
-* `__meta_ec2_region`: the region of the instance
-* `__meta_ec2_subnet_id`: comma separated list of subnets IDs in which the instance is running, if available
-* `__meta_ec2_tag_`: each tag value of the instance
-* `__meta_ec2_vpc_id`: the ID of the VPC in which the instance is running, if available
-
-#### `lightsail`
-
-The `lightsail` role discovers targets from [AWS Lightsail](https://aws.amazon.com/lightsail/)
-instances. The private IP address is used by default, but may be changed to
-the public IP address with relabeling.
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-* `__meta_lightsail_availability_zone`: the availability zone in which the instance is running
-* `__meta_lightsail_blueprint_id`: the Lightsail blueprint ID
-* `__meta_lightsail_bundle_id`: the Lightsail bundle ID
-* `__meta_lightsail_instance_name`: the name of the Lightsail instance
-* `__meta_lightsail_instance_state`: the state of the Lightsail instance
-* `__meta_lightsail_instance_support_code`: the support code of the Lightsail instance
-* `__meta_lightsail_ipv6_addresses`: comma separated list of IPv6 addresses assigned to the instance's network interfaces, if present
-* `__meta_lightsail_private_ip`: the private IP address of the instance
-* `__meta_lightsail_public_ip`: the public IP address of the instance, if available
-* `__meta_lightsail_region`: the region of the instance
-* `__meta_lightsail_tag_`: each tag value of the instance
-
-#### `ecs`
-
-The `ecs` role discovers targets from AWS ECS containers.
-
-ECS service discovery supports all ECS networking modes:
-- **awsvpc mode** (Fargate and EC2 with ENI): Uses the task's private IP address from its elastic network interface
-- **bridge mode** (EC2): Uses the EC2 host instance's private IP address
-- **host mode** (EC2): Uses the EC2 host instance's private IP address
-
-The private IP address is used by default, but may be changed to the public IP address with relabeling.
-
-The IAM credentials used must have the following permissions to discover scrape targets:
-
-- `ecs:ListClusters`
-- `ecs:DescribeClusters`
-- `ecs:ListServices`
-- `ecs:DescribeServices`
-- `ecs:ListTasks`
-- `ecs:DescribeTasks`
-- `ecs:DescribeContainerInstances` (required for EC2 launch type tasks)
-- `ec2:DescribeInstances` (required for EC2 launch type tasks)
-- `ec2:DescribeNetworkInterfaces` (required to get public IP for awsvpc mode tasks)
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-* `__meta_ecs_cluster`: the name of the ECS cluster
-* `__meta_ecs_cluster_arn`: the ARN of the ECS cluster
-* `__meta_ecs_service`: the name of the ECS service
-* `__meta_ecs_service_arn`: the ARN of the ECS service
-* `__meta_ecs_service_status`: the status of the ECS service
-* `__meta_ecs_task_group`: the ECS task group (typically service:service-name)
-* `__meta_ecs_task_arn`: the ARN of the ECS task
-* `__meta_ecs_task_definition`: the ARN of the ECS task definition
-* `__meta_ecs_ip_address`: the private IP address of the task
-* `__meta_ecs_launch_type`: the launch type of the task (EC2 or Fargate)
-* `__meta_ecs_desired_status`: the desired status of the task
-* `__meta_ecs_last_status`: the last known status of the task
-* `__meta_ecs_health_status`: the health status of the task
-* `__meta_ecs_platform_family`: the platform family (e.g., Linux, Windows)
-* `__meta_ecs_platform_version`: the platform version
-* `__meta_ecs_subnet_id`: the subnet ID where the task is running
-* `__meta_ecs_availability_zone`: the availability zone where the task is running
-* `__meta_ecs_region`: the AWS region
-* `__meta_ecs_public_ip`: the public IP address (from ENI for awsvpc mode, from EC2 instance for bridge/host mode), if available
-* `__meta_ecs_network_mode`: the network mode of the task (awsvpc or bridge)
-* `__meta_ecs_container_instance_arn`: the ARN of the container instance (EC2 launch type only)
-* `__meta_ecs_ec2_instance_id`: the EC2 instance ID (EC2 launch type only)
-* `__meta_ecs_ec2_instance_type`: the EC2 instance type (EC2 launch type only)
-* `__meta_ecs_ec2_instance_private_ip`: the private IP address of the EC2 instance (EC2 launch type only)
-* `__meta_ecs_ec2_instance_public_ip`: the public IP address of the EC2 instance, if available (EC2 launch type only)
-* `__meta_ecs_tag_cluster_`: each cluster tag value, keyed by tag name
-* `__meta_ecs_tag_service_`: each service tag value, keyed by tag name
-* `__meta_ecs_tag_task_`: each task tag value, keyed by tag name
-* `__meta_ecs_tag_ec2_`: each EC2 instance tag value, keyed by tag name (EC2 launch type only)
-
-#### `msk`
-
-The `msk` role discovers targets from AWS MSK (Managed Streaming for Apache Kafka) provisioned clusters.
-
-**Important**: This service discovery only works with **provisioned clusters**. Serverless clusters are not supported as they do not expose individual broker nodes.
-
-Discovery includes:
-- **Broker nodes**: Kafka broker instances (supports both ZooKeeper-based and KRaft-based clusters)
-- **KRaft Controller nodes**: Controller instances (KRaft-based clusters only)
-
-Note: ZooKeeper nodes are not discoverable via the MSK API. For monitoring, MSK provides:
-- **JMX Exporter**: Available on both broker and KRaft controller nodes (when enabled)
-- **Node Exporter**: Available on broker nodes only (when enabled)
-
-The IAM credentials used must have the following permissions to discover
-scrape targets:
-
-- `kafka:DescribeClusterV2`
-- `kafka:ListClustersV2`
-- `kafka:ListNodes`
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-* `__meta_msk_cluster_name`: the name of the MSK cluster
-* `__meta_msk_cluster_arn`: the ARN of the MSK cluster
-* `__meta_msk_cluster_state`: the state of the MSK cluster (e.g., ACTIVE, CREATING, DELETING)
-* `__meta_msk_cluster_type`: the type of the MSK cluster (e.g., PROVISIONED, SERVERLESS)
-* `__meta_msk_cluster_version`: the current version of the MSK cluster
-* `__meta_msk_cluster_kafka_version`: the Kafka version running on the cluster
-* `__meta_msk_cluster_jmx_exporter_enabled`: whether JMX exporter is enabled on the cluster
-* `__meta_msk_cluster_configuration_arn`: the ARN of the MSK configuration
-* `__meta_msk_cluster_configuration_revision`: the revision of the MSK configuration
-* `__meta_msk_cluster_tag_`: each cluster tag value, keyed by tag name
-* `__meta_msk_node_type`: the type of the node (BROKER or CONTROLLER)
-* `__meta_msk_node_arn`: the ARN of the node
-* `__meta_msk_node_added_time`: the time the node was added to the cluster
-* `__meta_msk_node_instance_type`: the instance type of the node
-* `__meta_msk_node_attached_eni`: the ID of the attached ENI
-* `__meta_msk_broker_id`: the broker ID (broker nodes only)
-* `__meta_msk_broker_endpoint_index`: the index of the broker endpoint (broker nodes only)
-* `__meta_msk_broker_client_subnet`: the client subnet of the broker (broker nodes only)
-* `__meta_msk_broker_client_vpc_ip`: the VPC IP address of the broker (broker nodes only)
-* `__meta_msk_broker_node_exporter_enabled`: whether node exporter is enabled on brokers (broker nodes only)
-* `__meta_msk_controller_endpoint_index`: the index of the controller endpoint (controller nodes only)
-
-#### `elasticache`
-
-The `elasticache` role discovers targets from AWS ElastiCache for both serverless caches and cache clusters.
-
-**Important**: For cache clusters, one target is created per cache node. Each target includes the cluster-level labels (ARN, status, tags, etc.) and node-specific labels (node ID, endpoint, availability zone, etc.). The `__address__` label is set to the individual node's endpoint address and port.
-
-For serverless caches, one target is created per serverless cache, with the `__address__` label set to the serverless cache endpoint.
-
-The IAM credentials used must have the following permissions to discover scrape targets:
-
-- `elasticache:DescribeServerlessCaches`
-- `elasticache:DescribeCacheClusters`
-- `elasticache:ListTagsForResource`
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-**Common labels (available on all targets):**
-
-* `__meta_elasticache_deployment_option`: the deployment option - either `serverless` for serverless caches or `node` for cache cluster nodes
-
-**Serverless Cache labels:**
-
-* `__meta_elasticache_serverless_cache_arn`: the ARN of the serverless cache
-* `__meta_elasticache_serverless_cache_name`: the name of the serverless cache
-* `__meta_elasticache_serverless_cache_status`: the status of the serverless cache
-* `__meta_elasticache_serverless_cache_engine`: the cache engine (redis or valkey)
-* `__meta_elasticache_serverless_cache_full_engine_version`: the full engine version
-* `__meta_elasticache_serverless_cache_major_engine_version`: the major engine version
-* `__meta_elasticache_serverless_cache_description`: the description of the serverless cache
-* `__meta_elasticache_serverless_cache_create_time`: the creation time in RFC3339 format
-* `__meta_elasticache_serverless_cache_snapshot_retention_limit`: the snapshot retention limit in days
-* `__meta_elasticache_serverless_cache_daily_snapshot_time`: the daily snapshot time
-* `__meta_elasticache_serverless_cache_user_group_id`: the user group ID
-* `__meta_elasticache_serverless_cache_kms_key_id`: the KMS key ID for encryption at rest
-* `__meta_elasticache_serverless_cache_endpoint_address`: the endpoint address
-* `__meta_elasticache_serverless_cache_endpoint_port`: the endpoint port
-* `__meta_elasticache_serverless_cache_reader_endpoint_address`: the reader endpoint address
-* `__meta_elasticache_serverless_cache_reader_endpoint_port`: the reader endpoint port
-* `__meta_elasticache_serverless_cache_security_group_id_`: security group IDs (indexed)
-* `__meta_elasticache_serverless_cache_subnet_id_`: subnet IDs (indexed)
-* `__meta_elasticache_serverless_cache_cache_usage_limit_data_storage_maximum`: maximum data storage in the specified unit
-* `__meta_elasticache_serverless_cache_cache_usage_limit_data_storage_minimum`: minimum data storage in the specified unit
-* `__meta_elasticache_serverless_cache_cache_usage_limit_data_storage_unit`: unit for data storage (e.g., GB)
-* `__meta_elasticache_serverless_cache_cache_usage_limit_ecpu_per_second_maximum`: maximum ECPU per second
-* `__meta_elasticache_serverless_cache_cache_usage_limit_ecpu_per_second_minimum`: minimum ECPU per second
-* `__meta_elasticache_serverless_cache_tag_`: each serverless cache tag value, keyed by tag name
-
-**Cache Cluster labels:**
-
-* `__meta_elasticache_cache_cluster_arn`: the ARN of the cache cluster
-* `__meta_elasticache_cache_cluster_cache_cluster_id`: the cache cluster ID
-* `__meta_elasticache_cache_cluster_cache_cluster_status`: the status of the cache cluster
-* `__meta_elasticache_cache_cluster_engine`: the cache engine (redis or memcached)
-* `__meta_elasticache_cache_cluster_engine_version`: the engine version
-* `__meta_elasticache_cache_cluster_cache_node_type`: the cache node type (e.g., cache.t3.micro)
-* `__meta_elasticache_cache_cluster_num_cache_nodes`: the number of cache nodes
-* `__meta_elasticache_cache_cluster_cache_cluster_create_time`: the creation time in RFC3339 format
-* `__meta_elasticache_cache_cluster_at_rest_encryption_enabled`: whether encryption at rest is enabled
-* `__meta_elasticache_cache_cluster_transit_encryption_enabled`: whether encryption in transit is enabled
-* `__meta_elasticache_cache_cluster_transit_encryption_mode`: the transit encryption mode
-* `__meta_elasticache_cache_cluster_auth_token_enabled`: whether auth token is enabled
-* `__meta_elasticache_cache_cluster_auth_token_last_modified`: the last modification time of auth token
-* `__meta_elasticache_cache_cluster_auto_minor_version_upgrade`: whether auto minor version upgrade is enabled
-* `__meta_elasticache_cache_cluster_cache_parameter_group`: the cache parameter group name
-* `__meta_elasticache_cache_cluster_cache_subnet_group_name`: the cache subnet group name
-* `__meta_elasticache_cache_cluster_client_download_landing_page`: the client download landing page URL
-* `__meta_elasticache_cache_cluster_ip_discovery`: the IP discovery mode (ipv4 or ipv6)
-* `__meta_elasticache_cache_cluster_network_type`: the network type (ipv4, ipv6, or dual_stack)
-* `__meta_elasticache_cache_cluster_preferred_availability_zone`: the preferred availability zone
-* `__meta_elasticache_cache_cluster_preferred_maintenance_window`: the preferred maintenance window
-* `__meta_elasticache_cache_cluster_preferred_outpost_arn`: the preferred outpost ARN
-* `__meta_elasticache_cache_cluster_replication_group_id`: the replication group ID (for Redis clusters that are part of a replication group)
-* `__meta_elasticache_cache_cluster_replication_group_log_delivery_enabled`: whether log delivery is enabled for the replication group
-* `__meta_elasticache_cache_cluster_snapshot_retention_limit`: the snapshot retention limit in days
-* `__meta_elasticache_cache_cluster_snapshot_window`: the daily snapshot window
-* `__meta_elasticache_cache_cluster_configuration_endpoint_address`: the configuration endpoint address (cluster mode enabled only)
-* `__meta_elasticache_cache_cluster_configuration_endpoint_port`: the configuration endpoint port (cluster mode enabled only)
-* `__meta_elasticache_cache_cluster_notification_topic_arn`: the SNS topic ARN for notifications
-* `__meta_elasticache_cache_cluster_notification_topic_status`: the SNS topic status
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_destination_type_`: log delivery destination type (cloudwatch-logs or kinesis-firehose)
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_log_format_`: log format (text or json)
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_log_type_`: log type (slow-log or engine-log)
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_status_`: log delivery status
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_message_`: log delivery message
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_log_group_`: CloudWatch log group name (cloudwatch-logs destination only)
-* `__meta_elasticache_cache_cluster_log_delivery_configuration_delivery_stream_`: Kinesis Firehose delivery stream name (kinesis-firehose destination only)
-* `__meta_elasticache_cache_cluster_pending_modified_values_auth_token_status`: pending auth token status
-* `__meta_elasticache_cache_cluster_pending_modified_values_cache_node_type`: pending cache node type change
-* `__meta_elasticache_cache_cluster_pending_modified_values_engine_version`: pending engine version upgrade
-* `__meta_elasticache_cache_cluster_pending_modified_values_num_cache_nodes`: pending number of cache nodes
-* `__meta_elasticache_cache_cluster_pending_modified_values_transit_encryption_enabled`: pending transit encryption status
-* `__meta_elasticache_cache_cluster_pending_modified_values_transit_encryption_mode`: pending transit encryption mode
-* `__meta_elasticache_cache_cluster_pending_modified_values_cache_node_ids_to_remove`: comma-separated list of cache node IDs to be removed
-* `__meta_elasticache_cache_cluster_security_group_membership_id_`: security group ID (indexed)
-* `__meta_elasticache_cache_cluster_security_group_membership_status_`: security group status (indexed)
-* `__meta_elasticache_cache_cluster_node_id`: cache node ID
-* `__meta_elasticache_cache_cluster_node_status`: cache node status
-* `__meta_elasticache_cache_cluster_node_create_time`: cache node creation time in RFC3339 format
-* `__meta_elasticache_cache_cluster_node_availability_zone`: cache node availability zone
-* `__meta_elasticache_cache_cluster_node_customer_outpost_arn`: cache node outpost ARN
-* `__meta_elasticache_cache_cluster_node_source_cache_node_id`: source cache node ID for replication
-* `__meta_elasticache_cache_cluster_node_parameter_group_status`: parameter group status
-* `__meta_elasticache_cache_cluster_node_endpoint_address`: cache node endpoint address
-* `__meta_elasticache_cache_cluster_node_endpoint_port`: cache node endpoint port
-* `__meta_elasticache_cache_cluster_tag_`: each cache cluster tag value, keyed by tag name
-
-#### `rds`
-
-The `rds` role discovers targets from [AWS RDS](https://aws.amazon.com/rds/)
-database instances within clusters. One target is created for each DB instance
-within the specified clusters. The endpoint address and port of each instance is used by default.
-
-The IAM credentials used must have the `rds:DescribeDBClusters` and `rds:DescribeDBInstances`
-permissions to discover scrape targets.
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-**Cluster labels:**
-
-* `__meta_rds_cluster_activity_stream_kinesis_stream_name`: the name of the Amazon Kinesis data stream used for database activity stream
-* `__meta_rds_cluster_activity_stream_kms_key_id`: the AWS KMS key identifier used for encrypting the database activity stream
-* `__meta_rds_cluster_activity_stream_mode`: the mode of the database activity stream (sync or async)
-* `__meta_rds_cluster_activity_stream_status`: the status of the database activity stream
-* `__meta_rds_cluster_allocated_storage`: the allocated storage size in gibibytes (GiB)
-* `__meta_rds_cluster_arn`: the Amazon Resource Name (ARN) of the DB cluster
-* `__meta_rds_cluster_auto_minor_version_upgrade`: whether automatic minor version upgrades are enabled
-* `__meta_rds_cluster_automatic_restart_time`: the time when a stopped cluster will be automatically restarted
-* `__meta_rds_cluster_aws_backup_recovery_point_arn`: the ARN of the recovery point in AWS Backup
-* `__meta_rds_cluster_backtrack_consumed_change_records`: the number of change records stored for backtrack
-* `__meta_rds_cluster_backtrack_window`: the target backtrack window in hours
-* `__meta_rds_cluster_backup_retention_period`: the number of days for which automated backups are retained
-* `__meta_rds_cluster_capacity`: the current capacity of an Aurora Serverless DB cluster
-* `__meta_rds_cluster_character_set_name`: the name of the character set
-* `__meta_rds_cluster_clone_group_id`: the ID of the clone group
-* `__meta_rds_cluster_cluster_create_time`: the time when the DB cluster was created
-* `__meta_rds_cluster_cluster_scalability_type`: the scalability type of the cluster
-* `__meta_rds_cluster_copy_tags_to_snapshot`: whether tags are copied from the cluster to snapshots
-* `__meta_rds_cluster_cross_account_clone`: whether the DB cluster is a cross-account clone
-* `__meta_rds_cluster_database_insights_mode`: the mode of Database Insights
-* `__meta_rds_cluster_database_name`: the database name
-* `__meta_rds_cluster_db_system_id`: the Oracle system ID (Oracle SID)
-* `__meta_rds_cluster_deletion_protection`: whether deletion protection is enabled
-* `__meta_rds_cluster_earliest_backtrack_time`: the earliest time to which a database can be restored with backtrack
-* `__meta_rds_cluster_earliest_restorable_time`: the earliest time to which a database can be restored
-* `__meta_rds_cluster_endpoint`: the endpoint of the DB cluster
-* `__meta_rds_cluster_engine_lifecycle_support`: the engine lifecycle support value
-* `__meta_rds_cluster_engine_mode`: the engine mode of the cluster (provisioned, serverless, etc.)
-* `__meta_rds_cluster_engine_version`: the version of the database engine
-* `__meta_rds_cluster_engine`: the database engine of the DB cluster
-* `__meta_rds_cluster_global_cluster_identifier`: the identifier of the global cluster
-* `__meta_rds_cluster_global_write_forwarding_requested`: whether global write forwarding is requested
-* `__meta_rds_cluster_global_write_forwarding_status`: the status of global write forwarding
-* `__meta_rds_cluster_hosted_zone_id`: the Route 53 hosted zone ID
-* `__meta_rds_cluster_http_endpoint_enabled`: whether the HTTP endpoint is enabled
-* `__meta_rds_cluster_iam_database_authentication_enabled`: whether the DB cluster has IAM database authentication enabled
-* `__meta_rds_cluster_identifier`: the identifier of the DB cluster
-* `__meta_rds_cluster_instance_class`: the compute and memory capacity class of the DB cluster
-* `__meta_rds_cluster_io_optimized_next_allowed_modification_time`: the time when the next IO optimization configuration change is allowed
-* `__meta_rds_cluster_iops`: the provisioned IOPS (I/O operations per second) value
-* `__meta_rds_cluster_kms_key_id`: the AWS KMS key identifier for the encrypted cluster
-* `__meta_rds_cluster_latest_restorable_time`: the latest time to which a database can be restored
-* `__meta_rds_cluster_local_write_forwarding_status`: the status of local write forwarding
-* `__meta_rds_cluster_master_username`: the master username
-* `__meta_rds_cluster_monitoring_interval`: the interval in seconds between enhanced monitoring metrics collection
-* `__meta_rds_cluster_monitoring_role_arn`: the ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch
-* `__meta_rds_cluster_multi_az`: whether the DB cluster is multi-AZ
-* `__meta_rds_cluster_network_type`: the network type (IPV4 or DUAL)
-* `__meta_rds_cluster_parameter_group`: the name of the DB cluster parameter group
-* `__meta_rds_cluster_percent_progress`: the progress percentage of the DB cluster operation
-* `__meta_rds_cluster_performance_insights_enabled`: whether Performance Insights is enabled
-* `__meta_rds_cluster_performance_insights_kms_key_id`: the AWS KMS key identifier for encrypting Performance Insights data
-* `__meta_rds_cluster_performance_insights_retention_period`: the retention period for Performance Insights data
-* `__meta_rds_cluster_port`: the port the DB cluster is listening on
-* `__meta_rds_cluster_preferred_backup_window`: the daily time range during which automated backups are created
-* `__meta_rds_cluster_preferred_maintenance_window`: the weekly time range during which system maintenance can occur
-* `__meta_rds_cluster_publicly_accessible`: whether the DB cluster is publicly accessible
-* `__meta_rds_cluster_reader_endpoint`: the reader endpoint of the DB cluster
-* `__meta_rds_cluster_replication_source_identifier`: the identifier of the source DB cluster if this is a read replica
-* `__meta_rds_cluster_resource_id`: the AWS Region-unique immutable identifier for the DB cluster
-* `__meta_rds_cluster_serverless_v2_platform_version`: the platform version of the Aurora Serverless v2 DB cluster
-* `__meta_rds_cluster_status`: the status of the DB cluster
-* `__meta_rds_cluster_storage_encrypted`: whether the DB cluster is storage encrypted
-* `__meta_rds_cluster_storage_encryption_type`: the storage encryption type
-* `__meta_rds_cluster_storage_throughput`: the storage throughput in MiBps
-* `__meta_rds_cluster_storage_type`: the storage type
-* `__meta_rds_cluster_subnet_group`: the name of the subnet group associated with the DB cluster
-* `__meta_rds_cluster_tag_`: each tag value of the DB cluster
-* `__meta_rds_cluster_upgrade_rollout_order`: the upgrade rollout order
-
-**Instance labels:**
-
-* `__meta_rds_instance_activity_stream_engine_native_audit_fields_included`: whether engine-native audit fields are included in the database activity stream
-* `__meta_rds_instance_activity_stream_kinesis_stream_name`: the name of the Amazon Kinesis data stream used for the database activity stream
-* `__meta_rds_instance_activity_stream_kms_key_id`: the AWS KMS key identifier used for encrypting the database activity stream
-* `__meta_rds_instance_activity_stream_mode`: the mode of the database activity stream (sync or async)
-* `__meta_rds_instance_activity_stream_policy_status`: the policy status of the database activity stream
-* `__meta_rds_instance_activity_stream_status`: the status of the database activity stream
-* `__meta_rds_instance_allocated_storage`: the allocated storage size in gibibytes (GiB)
-* `__meta_rds_instance_arn`: the Amazon Resource Name (ARN) of the DB instance
-* `__meta_rds_instance_auto_minor_version_upgrade`: whether automatic minor version upgrades are enabled
-* `__meta_rds_instance_automatic_restart_time`: the time when a stopped instance will be automatically restarted
-* `__meta_rds_instance_automation_mode`: the automation mode of the instance
-* `__meta_rds_instance_availability_zone`: the availability zone of the DB instance
-* `__meta_rds_instance_aws_backup_recovery_point_arn`: the ARN of the recovery point in AWS Backup
-* `__meta_rds_instance_backup_retention_period`: the number of days for which automated backups are retained
-* `__meta_rds_instance_backup_target`: the backup target (region or outposts)
-* `__meta_rds_instance_ca_certificate_identifier`: the identifier of the CA certificate for the DB instance
-* `__meta_rds_instance_character_set_name`: the name of the character set
-* `__meta_rds_instance_class`: the compute and memory capacity class of the DB instance
-* `__meta_rds_instance_copy_tags_to_snapshot`: whether tags are copied from the instance to snapshots
-* `__meta_rds_instance_custom_iam_instance_profile`: the instance profile associated with the underlying Amazon EC2 instance
-* `__meta_rds_instance_customer_owned_ip_enabled`: whether a customer-owned IP address (CoIP) is enabled
-* `__meta_rds_instance_database_insights_mode`: the mode of Database Insights
-* `__meta_rds_instance_db_cluster_identifier`: the identifier of the DB cluster this instance is a member of
-* `__meta_rds_instance_db_name`: the database name
-* `__meta_rds_instance_db_system_id`: the Oracle system ID (Oracle SID)
-* `__meta_rds_instance_dedicated_log_volume`: whether the DB instance has a dedicated log volume
-* `__meta_rds_instance_deletion_protection`: whether deletion protection is enabled
-* `__meta_rds_instance_endpoint_address`: the DNS address of the DB instance
-* `__meta_rds_instance_endpoint_hosted_zone_id`: the Route 53 hosted zone ID of the endpoint
-* `__meta_rds_instance_endpoint_port`: the port that the DB instance listens on
-* `__meta_rds_instance_engine_lifecycle_support`: the engine lifecycle support value
-* `__meta_rds_instance_engine_version`: the version of the database engine
-* `__meta_rds_instance_engine`: the database engine that the DB instance uses
-* `__meta_rds_instance_enhanced_monitoring_resource_arn`: the ARN of the Amazon CloudWatch Logs log stream for enhanced monitoring
-* `__meta_rds_instance_iam_database_authentication_enabled`: whether IAM database authentication is enabled
-* `__meta_rds_instance_identifier`: the identifier of the DB instance
-* `__meta_rds_instance_instance_create_time`: the time when the DB instance was created
-* `__meta_rds_instance_iops`: the provisioned IOPS (I/O operations per second) value
-* `__meta_rds_instance_is_cluster_writer`: whether the instance is the cluster writer (true/false)
-* `__meta_rds_instance_is_storage_config_upgrade_available`: whether a storage configuration upgrade is available
-* `__meta_rds_instance_kms_key_id`: the AWS KMS key identifier for the encrypted instance
-* `__meta_rds_instance_latest_restorable_time`: the latest time to which a database can be restored
-* `__meta_rds_instance_license_model`: the license model information
-* `__meta_rds_instance_listener_endpoint_address`: the DNS address of the listener endpoint
-* `__meta_rds_instance_listener_endpoint_hosted_zone_id`: the Route 53 hosted zone ID of the listener endpoint
-* `__meta_rds_instance_listener_endpoint_port`: the port that the listener endpoint listens on
-* `__meta_rds_instance_master_username`: the master username
-* `__meta_rds_instance_max_allocated_storage`: the upper limit in gibibytes to which storage can be scaled automatically
-* `__meta_rds_instance_monitoring_interval`: the interval in seconds between enhanced monitoring metrics collection
-* `__meta_rds_instance_monitoring_role_arn`: the ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch
-* `__meta_rds_instance_multi_az`: whether the DB instance is a Multi-AZ deployment
-* `__meta_rds_instance_multi_tenant`: whether the instance is in a multi-tenant configuration
-* `__meta_rds_instance_nchar_character_set_name`: the national character set name
-* `__meta_rds_instance_network_type`: the network type (IPV4 or DUAL)
-* `__meta_rds_instance_percent_progress`: the progress percentage of the DB instance operation
-* `__meta_rds_instance_performance_insights_enabled`: whether Performance Insights is enabled
-* `__meta_rds_instance_performance_insights_kms_key_id`: the AWS KMS key identifier for encrypting Performance Insights data
-* `__meta_rds_instance_performance_insights_retention_period`: the retention period for Performance Insights data
-* `__meta_rds_instance_port`: the port that the DB instance listens on
-* `__meta_rds_instance_preferred_backup_window`: the daily time range during which automated backups are created
-* `__meta_rds_instance_preferred_maintenance_window`: the weekly time range during which system maintenance can occur
-* `__meta_rds_instance_promotion_tier`: the order in which an Aurora replica is promoted to primary instance after a failure
-* `__meta_rds_instance_publicly_accessible`: whether the DB instance is publicly accessible
-* `__meta_rds_instance_read_replica_source_db_cluster_identifier`: the identifier of the source DB cluster if this instance is a read replica
-* `__meta_rds_instance_read_replica_source_db_instance_identifier`: the identifier of the source DB instance if this instance is a read replica
-* `__meta_rds_instance_replica_mode`: the replica mode (open-read-only or mounted)
-* `__meta_rds_instance_resource_id`: the AWS Region-unique immutable identifier for the DB instance
-* `__meta_rds_instance_resume_full_automation_mode_time`: the time when the DB instance will resume full automation
-* `__meta_rds_instance_secondary_availability_zone`: the secondary availability zone for Multi-AZ instances
-* `__meta_rds_instance_status`: the status of the DB instance
-* `__meta_rds_instance_storage_encrypted`: whether the DB instance is storage encrypted
-* `__meta_rds_instance_storage_encryption_type`: the storage encryption type
-* `__meta_rds_instance_storage_throughput`: the storage throughput in MiBps
-* `__meta_rds_instance_storage_type`: the storage type
-* `__meta_rds_instance_storage_volume_status`: the status of the storage volume
-* `__meta_rds_instance_subnet_group`: the name of the subnet group associated with the DB instance
-* `__meta_rds_instance_tag_`: each tag value of the DB instance
-* `__meta_rds_instance_tde_credential_arn`: the ARN for the TDE encryption key
-* `__meta_rds_instance_timezone`: the time zone of the DB instance
-* `__meta_rds_instance_upgrade_rollout_order`: the upgrade rollout order
-
-See below for the configuration options for AWS discovery:
-
-```yaml
-# The AWS role to use for service discovery.
-# Must be one of: ec2, lightsail, ecs, msk, elasticache, or rds.
-role:
-
-# The AWS region. If blank, the region from the instance metadata is used.
-[ region: ]
-
-# Custom endpoint to be used.
-[ endpoint: ]
-
-# AWS access key ID. If blank, the environment variable AWS_ACCESS_KEY_ID is used.
-[ access_key: ]
-
-# AWS secret access key. If blank, the environment variable AWS_SECRET_ACCESS_KEY is used.
-[ secret_key: ]
-
-# Named AWS profile used to authenticate.
-[ profile: ]
-
-# AWS Role ARN, an alternative to using AWS API keys.
-[ role_arn: ]
-
-# Optional External ID that can go along with role_arn.
-[ external_id: ]
-
-# Refresh interval to re-read the targets list.
-[ refresh_interval: | default = 60s ]
-
-# The port to scrape metrics from. If using the public IP address, this must
-# instead be specified in the relabeling rule.
-[ port: | default = 80 ]
-
-# Filters can be used optionally to filter the instance list by other criteria (ec2 & rds role only).
-# Available filter criteria can be found here:
-# EC2:
-# - https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html
-# - Filter API documentation: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html
-# RDS:
-# - https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html
-# - Filter API documentation: https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Filter.html
-filters:
- [ - name:
- values: , [...] ]
-
-# List of ECS, ElastiCache, MSK, or RDS cluster identifiers (ecs, elasticache, msk, and rds roles only) to discover.
-# A List of ARNs of clusters to discover. If empty, all clusters in the region are discovered.
-# This can significantly improve performance when you only need to monitor specific clusters/caches.
-[ clusters: [, ...] ]
-
-# HTTP client settings, including authentication methods (such as basic auth and
-# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
-[ ]
-```
-
-### ``
-
-Azure SD configurations allow retrieving scrape targets from Azure VMs.
-
-The discovery requires at least the following permissions:
-
-* `Microsoft.Compute/virtualMachines/read`: Required for VM discovery
-* `Microsoft.Network/networkInterfaces/read`: Required for VM discovery
-* `Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read`: Required for scale set (VMSS) discovery
-* `Microsoft.Compute/virtualMachineScaleSets/virtualMachines/networkInterfaces/read`: Required for scale set (VMSS) discovery
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-* `__meta_azure_machine_id`: the machine ID
-* `__meta_azure_machine_location`: the location the machine runs in
-* `__meta_azure_machine_name`: the machine name
-* `__meta_azure_machine_computer_name`: the machine computer name
-* `__meta_azure_machine_os_type`: the machine operating system
-* `__meta_azure_machine_private_ip`: the machine's private IP
-* `__meta_azure_machine_public_ip`: the machine's public IP if it exists
-* `__meta_azure_machine_resource_group`: the machine's resource group
-* `__meta_azure_machine_tag_`: each tag value of the machine
-* `__meta_azure_machine_scale_set`: the name of the scale set which the vm is part of (this value is only set if you are using a [scale set](https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/))
-* `__meta_azure_machine_size`: the machine size
-* `__meta_azure_subscription_id`: the subscription ID
-* `__meta_azure_tenant_id`: the tenant ID
-
-See below for the configuration options for Azure discovery:
-
-```yaml
-# The information to access the Azure API.
-# The Azure environment.
-[ environment: | default = AzurePublicCloud ]
-
-# The authentication method, either OAuth, ManagedIdentity or SDK.
-# See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview
-# SDK authentication method uses environment variables by default.
-# See https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication
-[ authentication_method: | default = OAuth]
-# The subscription ID. Always required.
-subscription_id:
-# Optional tenant ID. Only required with authentication_method OAuth.
-[ tenant_id: ]
-# Optional client ID. Only required with authentication_method OAuth.
-[ client_id: ]
-# Optional client secret. Only required with authentication_method OAuth.
-[ client_secret: ]
-
-# Optional resource group name. Limits discovery to this resource group.
-[ resource_group: ]
-
-# Refresh interval to re-read the instance list.
-[ refresh_interval: | default = 300s ]
-
-# The port to scrape metrics from. If using the public IP address, this must
-# instead be specified in the relabeling rule.
-[ port: | default = 80 ]
-
-# HTTP client settings, including authentication methods (such as basic auth and
-# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
-[ ]
-```
-
-### ``
-
-Consul SD configurations allow retrieving scrape targets from [Consul's](https://www.consul.io)
-service catalog. Discovery uses two Consul API endpoints:
-
-1. The [Catalog API](https://developer.hashicorp.com/consul/api-docs/catalog) to list services
- (used when `services` is empty, or when `tags` or `filter` are set).
-2. The [Health API](https://developer.hashicorp.com/consul/api-docs/health) to retrieve service
- instances and their health status.
-
-Because these two APIs have different filtering field schemas, Prometheus exposes separate filter
-options for each: `filter` applies to the Catalog API and `health_filter` applies to the Health API.
-For example, tags are exposed as `ServiceTags` in the Catalog API but as `Service.Tags` in the
-Health API.
-
-The following meta labels are available on targets during [relabeling](#relabel_config):
-
-* `__meta_consul_address`: the address of the target
-* `__meta_consul_dc`: the datacenter name for the target
-* `__meta_consul_health`: the health status of the service
-* `__meta_consul_partition`: the admin partition name where the service is registered
-* `__meta_consul_metadata_`: each node metadata key value of the target
-* `__meta_consul_node`: the node name defined for the target
-* `__meta_consul_service_address`: the service address of the target
-* `__meta_consul_service_id`: the service ID of the target
-* `__meta_consul_service_metadata_`: each service metadata key value of the target
-* `__meta_consul_service_port`: the service port of the target
-* `__meta_consul_service`: the name of the service the target belongs to
-* `__meta_consul_tagged_address_`: each node tagged address key value of the target
-* `__meta_consul_tags`: the list of tags of the target joined by the tag separator
-
-```yaml
-# The information to access the Consul API. It is to be defined
-# as the Consul documentation requires.
-[ server: | default = "localhost:8500" ]
-# Prefix for URIs for when consul is behind an API gateway (reverse proxy).
-[ path_prefix: ]
-[ token: ]
-[ datacenter: ]
-# Namespaces are only supported in Consul Enterprise.
-[ namespace: ]
-# Admin Partitions are only supported in Consul Enterprise.
-[ partition: ]
-[ scheme: | default = "http" ]
-# The username and password fields are deprecated in favor of the basic_auth configuration.
-[ username: ]
-[ password: