Skip to content

Instantly share code, notes, and snippets.

@kkirsanov
Created November 22, 2018 09:20
Show Gist options
  • Save kkirsanov/077355b8d0344b1c9c426800bee33d1b to your computer and use it in GitHub Desktop.
Save kkirsanov/077355b8d0344b1c9c426800bee33d1b to your computer and use it in GitHub Desktop.
write prometheus metrics to string
from prometheus_client import CollectorRegistry, Gauge, generate_latest
registry = CollectorRegistry()
g = Gauge('reg_cnt', '1-2 per day is ok', registry=registry)
g.set(2)
print(generate_latest(registry))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment