Public | Automated Build

Last pushed: 3 years ago
Short Description
Short description is empty for this repo.
Full Description


The expvar_exporter connects to a expvar http endppoint (usually at
/vars/debug) and exposes the metrics for prometheus consumption.

In general it's strongly encouraged to use the prometheus client library
instead since the expvar data model is limited.


Since the expvar memstats are untyped internally and some refer to values "since
last garbage collection" and other to longer cycles, the expvar_exporter
doesn't do any convertion and exposes them as untyped metrics.

Custom metrics

To export custom metrics, a config which maps expvars to prometheus metrics in
the following structure is required:

  help: some help string          # required
  labels:                         # optional
    - 3rd-lowest-level-label
    - 2nd-lowest-level-label
    - lowest-level-label
    - 1st-key-in-expvar
    - 2nd-key-in-expvar

The expvar_exporter will select a portion of expvar specified by the select
attribute and traversal that branch until it reachs a bool or float64 value.
It then uses the specified labels for the lowest level parents and joins the
remaining parents by _ and prepends the pometheus_metric_name and namespace
command line flag to form the metric name.

Example: docker-registry

Assuming the docker registry v2 expvars contain the following structure:

  "registry": {
    "cache": {
      "storage": {
        "layerinfo": {
          "Exists": {
            "Requests": 0,
            "Hits": 0,
            "Misses": 0
          "Fetch": {
            "Requests": 0,
            "Hits": 0,
            "Misses": 0

To expose those for prometheus comsumption and create a metric
registry_cache_storage with labels for the deepest three levels of the
structure, a config like this is required:

    - registry
    - cache
  help: expvar metrics for registry cache
  type: counter
    - kind
    - op
    - type

With this in place the expvar exporter will expose the following metrics:

# HELP registry_cache_storage expvar metrics for registry subsystem
# TYPE registry_cache_storage counter
registry_cache_storage{kind="layerinfo",op="exists",type="hits"} 0
registry_cache_storage{kind="layerinfo",op="exists",type="misses"} 0
registry_cache_storage{kind="layerinfo",op="exists",type="requests"} 0
registry_cache_storage{kind="layerinfo",op="fetch",type="hits"} 0
registry_cache_storage{kind="layerinfo",op="fetch",type="misses"} 0
registry_cache_storage{kind="layerinfo",op="fetch",type="requests"} 0

Keep in mind that we compromise here and this structure doesn't follow
Prometheus Best Practices.

Docker Pull Command
Source Repository