Skip to content

Commit 15edf71

Browse files
authored
add batch usage advice for spectator-py (#186)
1 parent 3d93ba3 commit 15edf71

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/spectator/lang/py/usage.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,27 @@ example, if you want to disable metrics publishing from the `Registry`, then you
246246
export SPECTATOR_OUTPUT_LOCATION=none
247247
```
248248

249+
## Batch Usage
250+
251+
When using `spectator-py` to report metrics from a batch job, ensure that the batch job runs for at
252+
least five (5), if not ten (10) seconds in duration. This is necessary in order to allow sufficient
253+
time for `spectatord` to publish metrics to the Atlas backend; it publishes every five seconds. If
254+
your job does not run this long, or you find you are missing metrics that were reported at the end
255+
of your job run, then add a five-second sleep before exiting: `time.sleep(5)`. This will allow time
256+
for the metrics to be sent.
257+
258+
## Debug Metrics Delivery to `spectatord`
259+
260+
In order to see debug log messages from `spectatord`, create an `/etc/default/spectatord` file with
261+
the following contents:
262+
263+
```shell
264+
SPECTATORD_OPTIONS="--verbose"
265+
```
266+
267+
This will report all metrics that are sent to the Atlas backend in the `spectatord` logs, which will
268+
provide an opportunity to correlate metrics publishing events from your client code.
269+
249270
## Writing Tests
250271

251272
To write tests against this library, instantiate an instance of the `Registry` and provide a `Config`

0 commit comments

Comments
 (0)