Documentation
¶
Overview ¶
Command prometheus-universal-exporter turns HTTP endpoints and files that were never meant for Prometheus into Prometheus targets, as configured by collectors. See README.md and docs/.
The command line and the process lifecycle are here, the --dry-run report in check.go and --healthcheck in healthcheck.go; everything else is under internal/.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
pue-allocator
command
Command pue-allocator is the target allocator of prometheus-universal-exporter: it serves every exporter replica run with --allocator.url its configuration and its share of the static targets, and Prometheus the probe targets, each already pointed at a replica, through HTTP service discovery.
|
Command pue-allocator is the target allocator of prometheus-universal-exporter: it serves every exporter replica run with --allocator.url its configuration and its share of the static targets, and Prometheus the probe targets, each already pointed at a replica, through HTTP service discovery. |
|
internal
|
|
|
allocapi
Package allocapi is what the target allocator (cmd/pue-allocator) and an exporter in allocator mode say to each other: the heartbeat a replica sends, the bundle of configuration files it is served, the paths they travel on, and the rendezvous hash that decides which replica owns a target.
|
Package allocapi is what the target allocator (cmd/pue-allocator) and an exporter in allocator mode say to each other: the heartbeat a replica sends, the bundle of configuration files it is served, the paths they travel on, and the rendezvous hash that decides which replica owns a target. |
|
allocator
Package allocator is the target allocator, cmd/pue-allocator: it serves every exporter replica in allocator mode its configuration and its share of the static targets as one bundle, and Prometheus the probe targets already pointed at a replica, through HTTP service discovery.
|
Package allocator is the target allocator, cmd/pue-allocator: it serves every exporter replica in allocator mode its configuration and its share of the static targets as one bundle, and Prometheus the probe targets already pointed at a replica, through HTTP service discovery. |
|
allocclient
Package allocclient is the exporter's side of the target allocator (internal/allocapi): in allocator mode (--allocator.url) it heartbeats to every instance of the allocator, long-polls the allocator for its bundle, writes a new bundle into the cache directory where the configuration manager loads it, and has the manager reload it.
|
Package allocclient is the exporter's side of the target allocator (internal/allocapi): in allocator mode (--allocator.url) it heartbeats to every instance of the allocator, long-polls the allocator for its bundle, writes a new bundle into the cache directory where the configuration manager loads it, and has the manager reload it. |
|
config
Package config loads and validates the configuration file, its collector files and the static target file, reloads them when they change, and describes them with JSON Schemas.
|
Package config loads and validates the configuration file, its collector files and the static target file, reloads them when they change, and describes them with JSON Schemas. |
|
decode
Package decode turns fetched bytes into data a transform can read: JSON, YAML, XML, CSV, HTML, the Prometheus text format and plain text, after converting the body to UTF-8 from the charset it declares.
|
Package decode turns fetched bytes into data a transform can read: JSON, YAML, XML, CSV, HTML, the Prometheus text format and plain text, after converting the body to UTF-8 from the charset it declares. |
|
exporter
Package exporter serves the exporter's HTTP endpoints — /probe, the self-metrics, /health, /ready and /-/reload — and runs the probe pipeline behind them: fetch, decode, transform and validate, with the response cache, shared in-flight probes and concurrency limits.
|
Package exporter serves the exporter's HTTP endpoints — /probe, the self-metrics, /health, /ready and /-/reload — and runs the probe pipeline behind them: fetch, decode, transform and validate, with the response cache, shared in-flight probes and concurrency limits. |
|
expr
Package expr compiles the expressions metric rules are written in — jq, regular expressions, CSS selectors and XPath — and keeps each compiled program in a bounded cache, so a rule is compiled once rather than on every scrape.
|
Package expr compiles the expressions metric rules are written in — jq, regular expressions, CSS selectors and XPath — and keeps each compiled program in a bounded cache, so a rule is compiled once rather than on every scrape. |
|
fetch
Package fetch gets a collector's raw data.
|
Package fetch gets a collector's raw data. |
|
grpctest
Package grpctest runs an in-process gRPC server for the tests of the grpc request type: a queue service defined by .proto sources compiled at run time, so the tests need neither protoc nor generated code, with the health service and, as a test asks, reflection v1, v1alpha or none, over plaintext or TLS.
|
Package grpctest runs an in-process gRPC server for the tests of the grpc request type: a queue service defined by .proto sources compiled at run time, so the tests need neither protoc nor generated code, with the health service and, as a test asks, reflection v1, v1alpha or none, over plaintext or TLS. |
|
kubeapi
Package kubeapi lists objects from a Kubernetes API server over its REST API, with nothing but the standard library: the target allocator's kubernetes discovery lists EndpointSlices with it, and the exporter's kubernetes request type lists objects of any kind.
|
Package kubeapi lists objects from a Kubernetes API server over its REST API, with nothing but the standard library: the target allocator's kubernetes discovery lists EndpointSlices with it, and the exporter's kubernetes request type lists objects of any kind. |
|
kubetest
Package kubetest is a stand-in Kubernetes API server for the tests of internal/kubeapi and of the kubernetes request type: an HTTPS server that answers a listing of the objects a test gave it at a path, a page at a time as the limit asks with a continue token for the rest, refuses a request without the token in its service account directory, or the one it was told to require, with 401, answers 403 and 404 as the API server does, 429 as its priority and fairness does, 410 Expired for a continue token it was told to have lost, a listing of the objects' metadata alone when it is asked for that, can be slow to answer, and records every request it was sent.
|
Package kubetest is a stand-in Kubernetes API server for the tests of internal/kubeapi and of the kubernetes request type: an HTTPS server that answers a listing of the objects a test gave it at a path, a page at a time as the limit asks with a continue token for the rest, refuses a request without the token in its service account directory, or the one it was told to require, with 401, answers 403 and 404 as the API server does, 429 as its priority and fairness does, 410 Expired for a continue token it was told to have lost, a listing of the objects' metadata alone when it is asked for that, can be slow to answer, and records every request it was sent. |
|
ldaptest
Package ldaptest is a stand-in LDAP server for the tests of the ldap request type: a TCP server, or a TLS one for ldaps://, with a self-signed certificate whose file it writes, that answers LDAPv3 messages in BER as a directory server does.
|
Package ldaptest is a stand-in LDAP server for the tests of the ldap request type: a TCP server, or a TLS one for ldaps://, with a self-signed certificate whose file it writes, that answers LDAPv3 messages in BER as a directory server does. |
|
model
Package model holds the data the other packages share: the configuration as it is written (Config, Collector and the types under them), the static target file, and the metrics a probe produces (MetricSet).
|
Package model holds the data the other packages share: the configuration as it is written (Config, Collector and the types under them), the static target file, and the metrics a probe produces (MetricSet). |
|
pagekit
Package pagekit is what the HTML pages of the exporter and of the target allocator share, so the two look and behave alike: the stylesheet and its light and dark colours, the theme picker and the script that applies the theme chosen before a page is first drawn, the project's logo as the browser-tab icon, the pages' Content-Security-Policy, the controls of a page that refreshes itself, and how a page writes a duration.
|
Package pagekit is what the HTML pages of the exporter and of the target allocator share, so the two look and behave alike: the stylesheet and its light and dark colours, the theme picker and the script that applies the theme chosen before a page is first drawn, the project's logo as the browser-tab icon, the pages' Content-Security-Policy, the controls of a page that refreshes itself, and how a page writes a duration. |
|
redistest
Package redistest is a stand-in Redis server for the tests of the redis request type: a TCP server, or a TLS one with a self-signed certificate whose file it writes, that answers RESP2 commands as Redis and Valkey do.
|
Package redistest is a stand-in Redis server for the tests of the redis request type: a TCP server, or a TLS one with a self-signed certificate whose file it writes, that answers RESP2 commands as Redis and Valkey do. |
|
sqltest
Package sqltest is a stand-in database for the tests of the sql request type: a database/sql/driver implementation that answers each statement with the rows a test gave it, and records what the exporter asked of it — the transactions it began and how, the statements it ran before the query, the values it bound, the connections it opened and closed, the pings.
|
Package sqltest is a stand-in database for the tests of the sql request type: a database/sql/driver implementation that answers each statement with the rows a test gave it, and records what the exporter asked of it — the transactions it began and how, the statements it ran before the query, the values it bound, the connections it opened and closed, the pings. |
|
sshtest
Package sshtest is an in-process SSH server with an SFTP subsystem, for the sshfile request type's tests, which runs commands too, for the sshexec type's: it serves the exporter's own filesystem, so a test writes files to a temporary directory and reads them over SFTP by their absolute paths, and it hands each command to the test's Options.Exec, which writes its output and says its exit status.
|
Package sshtest is an in-process SSH server with an SFTP subsystem, for the sshfile request type's tests, which runs commands too, for the sshexec type's: it serves the exporter's own filesystem, so a test writes files to a temporary directory and reads them over SFTP by their absolute paths, and it hands each command to the test's Options.Exec, which writes its output and says its exit status. |
|
testutil
Package testutil holds the helpers the tests of several packages share: temporary files, a minimal collector and configuration, captured logs and polling.
|
Package testutil holds the helpers the tests of several packages share: temporary files, a minimal collector and configuration, captured logs and polling. |
|
testutil/alloctest
Package alloctest measures what a function allocates, for the tests that bound it or compare it with what another function allocates.
|
Package alloctest measures what a function allocates, for the tests that bound it or compare it with what another function allocates. |
|
testutil/tier
Package tier splits the tests into two tiers: the quick one, which `make test-quick` runs (go test -short) while a change is being written, and the whole suite, which `make test` and CI run.
|
Package tier splits the tests into two tiers: the quick one, which `make test-quick` runs (go test -short) while a change is being written, and the whole suite, which `make test` and CI run. |
|
transform
Package transform turns decoded data into metrics with a collector's metric rules — jq, yq, XPath, CSS, CSV, regex and Prometheus pass-through — or with a Python script, run in a pool of worker processes.
|
Package transform turns decoded data into metrics with a collector's metric rules — jq, yq, XPath, CSS, CSV, regex and Prometheus pass-through — or with a Python script, run in a pool of worker processes. |
|
tools
|
|
|
depupdate
command
Command depupdate proposes updates for the versions the Dockerfile pins.
|
Command depupdate proposes updates for the versions the Dockerfile pins. |