complete rewrite
This commit is contained in:
@@ -1,13 +1,27 @@
|
||||
from prometheus_rus import Path, Counter, Gauge, Summary, GLOBAL_REGISTRY, NOW
|
||||
from prometheus_rus import CounterFamily, GaugeFamily, SummaryFamily, Registry
|
||||
|
||||
g1 = Gauge(value=20, path=Path("foobar_g1", {"server": "[host:xy]"}), help="foo help with bar")
|
||||
g2 = Gauge(path=Path("foobar_g2", {"server": "[host:xy]"}), help="foo help with bar")
|
||||
registry = Registry()
|
||||
|
||||
gf1 = GaugeFamily(name="foobar_g1", help="foo help with bar")
|
||||
g1 = gf1.create(value=20, labels=dict(server="[host:xy]"))
|
||||
registry.register(g1)
|
||||
g1.inc(10)
|
||||
c = Counter(
|
||||
path=Path("foobar", {"server": "[host:xy]"}), help="foo help with bar")
|
||||
|
||||
gf2 = GaugeFamily(name="foobar_g2", help="foo help with bar")
|
||||
g2 = gf2.create(labels=dict(server="[host:xy]"))
|
||||
registry.register(g2)
|
||||
|
||||
|
||||
cf = CounterFamily(name="foobar", help="foo help with bar")
|
||||
c = cf.create(labels=dict(server="[host:xy]"))
|
||||
registry.register(c)
|
||||
c.set(1024.12374981723)
|
||||
s = Summary(path=Path("m_sum_foo", {"tag": "sum"}), help="count on it!")
|
||||
s.observe(1)
|
||||
s.observe(2)
|
||||
s.observe(3, NOW)
|
||||
print(GLOBAL_REGISTRY.collect())
|
||||
|
||||
sf = SummaryFamily(name="m_sum_foo", help="count on it!")
|
||||
s = sf.create(labels={"tag": "sum"})
|
||||
registry.register(s)
|
||||
s.observe(1, timestamp=None)
|
||||
s.observe(2, timestamp=None)
|
||||
s.observe(3)
|
||||
|
||||
print(registry.collect())
|
||||
|
||||
Reference in New Issue
Block a user