Skip to content

prometheus-pusher is a helper for creating worker for push Prometheus metrics

License

Notifications You must be signed in to change notification settings

bigbag/prometheus-pusher

Repository files navigation

prometheus-pusher

CI codecov pypi downloads versions license

prometheus-pusher is a helper for push metrics in Prometheus push gateway.

Installation

prometheus-pusher is available on PyPI. Use pip to install:

$ pip install prometheus-pusher

Basic Usage

from prometheus_client import CollectorRegistry
from prometheus_client import Counter

from prometheus_pusher import monitoring_adapter

monitoring_registry = CollectorRegistry()
demo_count_metric = Counter("demo", "Demo count", registry=monitoring_registry)


monitoring_adapter.startup(
    gateway="http://127.0.0.1:9091",
    job_name="test_job",
    user="testuser",
    password="testpassword",
    registry=monitoring_registry,
    is_enabled=True,
)


def demo_send():
    demo_count_metric.inc()
    monitoring_adapter.send()
    return


def demo_serve():
    demo_count_metric.inc()
    monitoring_adapter.serve()
    return


if __name__ == "__main__":
    demo_send()
    demo_serve()
    print("Test")
    

License

prometheus-pusher is developed and distributed under the Apache 2.0 license.

Reporting a Security Vulnerability

See our security policy.

About

prometheus-pusher is a helper for creating worker for push Prometheus metrics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published