项目作者: hairyhenderson

项目描述 :
A Prometheus-format exporter to report on DockerHub per-image rate limits
高级语言: Go
项目地址: git://github.com/hairyhenderson/dockerhub_ratelimit_exporter.git
创建时间: 2020-11-19T04:04:16Z
项目社区:https://github.com/hairyhenderson/dockerhub_ratelimit_exporter

开源协议:MIT License

下载


Build
Docker Build
Total Downloads
hairyhenderson/dockerhub_ratelimit_exporter on DockerHub

dockerhub_ratelimit_exporter

A Prometheus-format exporter to report on DockerHub per-image rate limits.

Recently, DockerHub has introduced rate limiting
for anonymous and free-tier users. This exporter can help Prometheus users
track the remaining pulls for certain images.

Status/Roadmap

This is brand-new, hacked-together over the course of a couple hours. It works,
but I’m certain there are bugs.

This is currently very thin on features. Some things that are missing:

  • support for authenticating to DockerHub
  • support for caching auth tokens on a per-repo basis
  • exposing a few more general-purpose metrics

Usage

The image name is provided as a query parameter when querying the exporter,
and Prometheus-format metrics are returned, like this:

  1. $ curl http://localhost:9766/limits?image=hairyhenderson/gomplate:v3.8.0
  2. # HELP dockerhub_ratelimits_limit total number of pulls that can be performed during the window
  3. # TYPE dockerhub_ratelimits_limit gauge
  4. dockerhub_ratelimits_limit{image="hairyhenderson/gomplate:v3.8.0"} 100
  5. # HELP dockerhub_ratelimits_remaining number of pulls remaining for the window
  6. # TYPE dockerhub_ratelimits_remaining gauge
  7. dockerhub_ratelimits_remaining{image="hairyhenderson/gomplate:v3.8.0"} 100
  8. # HELP dockerhub_ratelimits_window_seconds the length of the time window
  9. # TYPE dockerhub_ratelimits_window_seconds gauge
  10. dockerhub_ratelimits_window_seconds{image="hairyhenderson/gomplate:v3.8.0"} 21600

Prometheus Configuration

When using Prometheus to scrape the exporter, the image parameter can be
provided like this:

  1. scrape_configs:
  2. - job_name: hub-limits
  3. scrape_interval: 15s
  4. metrics_path: /limits
  5. params:
  6. image:
  7. - busybox
  8. - hairyhenderson/gomplate:v3.8.0
  9. - prom/prometheus:v2.22.1
  10. static_configs:
  11. - targets:
  12. - localhost:9766

License

The MIT License

Copyright (c) 2020 Dave Henderson