Skip to content

Commit

Permalink
add batch usage advice for spectator-py
Browse files Browse the repository at this point in the history
  • Loading branch information
copperlight committed Sep 11, 2024
1 parent 3d93ba3 commit 995151c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/spectator/lang/py/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ example, if you want to disable metrics publishing from the `Registry`, then you
export SPECTATOR_OUTPUT_LOCATION=none
```

## Batch Usage

When using `spectator-py` to report metrics from a batch job, ensure that the batch job runs for at
least five (5), if not ten (10) seconds in duration. This is necessary in order to allow sufficient
time for `spectatord` to publish metrics to the Atlas backend; it publishes every five seconds. If
your job does not run this long, or you find you are missing metrics that were reported at the end
of your job run, then add a five-second sleep before exiting: `time.sleep(5)`. This will allow time
for the metrics to be sent.

## Writing Tests

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

0 comments on commit 995151c

Please sign in to comment.