Skip to content

Commit c22df47

Browse files
authored
update spectator-py docs for 1.0.3 (#194)
Top-level imports were added, which simplifies usage, so relevant examples were updated. The main code examples were simplified a bit.
1 parent f1aa0bb commit c22df47

File tree

12 files changed

+66
-68
lines changed

12 files changed

+66
-68
lines changed

docs/spectator/lang/py/meters/age-gauge.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Time Since Last Success alerting pattern.
77
To set a specific time as the last success:
88

99
```python
10-
from spectator.registry import Registry
10+
from spectator import Registry
1111

1212
registry = Registry()
1313
registry.age_gauge("time.sinceLastSuccess").set(1611081000)
@@ -19,7 +19,7 @@ registry.age_gauge_with_id(last_success).set(1611081000)
1919
To set `now()` as the last success:
2020

2121
```python
22-
from spectator.registry import Registry
22+
from spectator import Registry
2323

2424
registry = Registry()
2525
registry.age_gauge("time.sinceLastSuccess").now()

docs/spectator/lang/py/meters/counter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ be used to convert them back into a value-per-step on a graph.
77
Call `increment()` when an event occurs:
88

99
```python
10-
from spectator.registry import Registry
10+
from spectator import Registry
1111

1212
registry = Registry()
1313
registry.counter("server.numRequests").increment()
@@ -20,7 +20,7 @@ You can also pass a value to `increment()`. This is useful when a collection of
2020
together:
2121

2222
```python
23-
from spectator.registry import Registry
23+
from spectator import Registry
2424

2525
registry = Registry()
2626
registry.counter("queue.itemsAdded").increment(10)

docs/spectator/lang/py/meters/dist-summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This means that a `4K` tick label will represent 4 kilobytes, rather than 4 kilo
99
Call `record()` with a value:
1010

1111
```python
12-
from spectator.registry import Registry
12+
from spectator import Registry
1313

1414
registry = Registry()
1515
registry.distribution_summary("server.requestSize").record(10)

docs/spectator/lang/py/meters/gauge.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ higher or lower at some point during interval, but that is not known.
99
Call `set()` with a value:
1010

1111
```python
12-
from spectator.registry import Registry
12+
from spectator import Registry
1313

1414
registry = Registry()
1515
registry.gauge("server.queueSize").set(10)
@@ -23,7 +23,7 @@ not need to be collected on a tight 1-minute schedule to ensure that Atlas shows
2323
graphs. A custom TTL may be configured for gauges. SpectatorD enforces a minimum TTL of 5 seconds.
2424

2525
```python
26-
from spectator.registry import Registry
26+
from spectator import Registry
2727

2828
registry = Registry()
2929
registry.gauge("server.queueSize", ttl_seconds=120).set(10)

docs/spectator/lang/py/meters/max-gauge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ standard Gauges, Max Gauges do not continue to report to the backend, and there
66
Call `set()` with a value:
77

88
```python
9-
from spectator.registry import Registry
9+
from spectator import Registry
1010

1111
registry = Registry()
1212
registry.max_gauge("server.queueSize").set(10)

docs/spectator/lang/py/meters/monotonic-counter-uint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Call `set()` when an event occurs:
88

99
```python
1010
from ctypes import c_uint64
11-
from spectator.registry import Registry
11+
from spectator import Registry
1212

1313
registry = Registry()
1414
registry.monotonic_counter_uint("iface.bytes").set(c_uint64(1))

docs/spectator/lang/py/meters/monotonic-counter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ these values, at the expense of a slower time-to-first metric.
77
Call `set()` when an event occurs:
88

99
```python
10-
from spectator.registry import Registry
10+
from spectator import Registry
1111

1212
registry = Registry()
1313
registry.monotonic_counter("iface.bytes").set(10)

docs/spectator/lang/py/meters/percentile-dist-summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ added to Percentile Distribution Summaries and ensure that they have a small bou
1111
Call `record()` with a value:
1212

1313
```python
14-
from spectator.registry import Registry
14+
from spectator import Registry
1515

1616
registry = Registry()
1717
registry.pct_distribution_summary("server.requestSize").record(10)

docs/spectator/lang/py/meters/percentile-timer.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Timers and ensure that they have a small bounded cardinality.
1111
Call `record()` with a value:
1212

1313
```python
14-
from spectator.registry import Registry
14+
from spectator import Registry
1515

1616
registry = Registry()
1717
registry.pct_timer("server.requestLatency").record(0.01)
@@ -25,8 +25,7 @@ the number of seconds that have elapsed while executing a block of code:
2525

2626
```python
2727
import time
28-
from spectator.registry import Registry
29-
from spectator.stopwatch import StopWatch
28+
from spectator import Registry, StopWatch
3029

3130
registry = Registry()
3231
thread_sleep = registry.pct_timer("thread.sleep")

docs/spectator/lang/py/meters/timer.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ A Timer is used to measure how long (in seconds) some event is taking.
33
Call `record()` with a value:
44

55
```python
6-
from spectator.registry import Registry
6+
from spectator import Registry
77

88
registry = Registry()
99
registry.timer("server.requestLatency").record(0.01)
@@ -17,8 +17,7 @@ the number of seconds that have elapsed while executing a block of code:
1717

1818
```python
1919
import time
20-
from spectator.registry import Registry
21-
from spectator.stopwatch import StopWatch
20+
from spectator import Registry, StopWatch
2221

2322
registry = Registry()
2423
thread_sleep = registry.timer("thread.sleep")

0 commit comments

Comments
 (0)