-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update spectator-py docs for the 1.0 release (#179)
- Loading branch information
1 parent
070b350
commit 3eddfd4
Showing
15 changed files
with
422 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
A Counter is used to measure the rate at which an event is occurring. Considering an API | ||
endpoint, a Counter could be used to measure the rate at which it is being accessed. | ||
A Counter is used to measure the rate at which an event is occurring. Considering an API endpoint, | ||
a Counter could be used to measure the rate at which it is being accessed. | ||
|
||
Counters are reported to the backend as a rate-per-second. In Atlas, the `:per-step` operator | ||
can be used to convert them back into a value-per-step on a graph. | ||
Counters are reported to the backend as a rate-per-second. In Atlas, the `:per-step` operator can | ||
be used to convert them back into a value-per-step on a graph. | ||
|
||
Call `increment()` when an event occurs: | ||
|
||
```python | ||
from spectator import GlobalRegistry | ||
from spectator.registry import Registry | ||
|
||
GlobalRegistry.counter("server.numRequests").increment() | ||
registry = Registry() | ||
registry.counter("server.numRequests").increment() | ||
|
||
num_requests = registry.new_id("server.numRequests") | ||
registry.counter_with_id(num_requests).increment() | ||
``` | ||
|
||
You can also pass a value to `increment()`. This is useful when a collection of events happens | ||
together: | ||
|
||
```python | ||
from spectator import GlobalRegistry | ||
from spectator.registry import Registry | ||
|
||
registry = Registry() | ||
registry.counter("queue.itemsAdded").increment(10) | ||
|
||
GlobalRegistry.counter("queue.itemsAdded").increment(10) | ||
num_requests = registry.new_id("server.numRequests") | ||
registry.counter_with_id(num_requests).increment(10) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
A Monotonic Counter (uint64) is used to measure the rate at which an event is occurring, when the | ||
source data is a monotonically increasing number. A minimum of two samples must be sent, in order to | ||
calculate a delta value and report it to the backend as a rate-per-second. A variety of networking | ||
metrics may be reported monotonically, and this metric type provides a convenient means of recording | ||
these values, at the expense of a slower time-to-first metric. | ||
|
||
Call `set()` when an event occurs: | ||
|
||
```python | ||
from ctypes import c_uint64 | ||
from spectator.registry import Registry | ||
|
||
registry = Registry() | ||
registry.monotonic_counter_uint("iface.bytes").set(c_uint64(1)) | ||
|
||
iface_bytes = registry.new_id("iface.bytes") | ||
registry.monotonic_counter_uint_with_id(iface_bytes).set(c_uint64(1)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
A Monotonic Counter (float) is used to measure the rate at which an event is occurring, when the | ||
source data is a monotonically increasing number. A minimum of two samples must be sent, in order to | ||
calculate a delta value and report it to the backend as a rate-per-second. A variety of networking | ||
metrics may be reported monotonically, and this metric type provides a convenient means of recording | ||
these values, at the expense of a slower time-to-first metric. | ||
|
||
Call `set()` when an event occurs: | ||
|
||
```python | ||
from spectator.registry import Registry | ||
|
||
registry = Registry() | ||
registry.monotonic_counter("iface.bytes").set(10) | ||
|
||
iface_bytes = registry.new_id("iface.bytes") | ||
registry.monotonic_counter_with_id(iface_bytes).set(10) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.