Skip to content

Commit

Permalink
metrics: track job processor in duration metric (#154)
Browse files Browse the repository at this point in the history
Co-authored-by: Avram Tudor <tudor.avram@8x8.com>
  • Loading branch information
quitrk and Avram Tudor authored Feb 18, 2025
1 parent 24f2db0 commit dea42aa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/env_vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Skynet is configurable via environment variables. Some are shared by all modules
|--------------------------------|-------------------------------------------------------------|-------------------------------------------|---------------------------------------------------------------------------------|
| `ENABLED_MODULES` | Which modules should be enabled, separated by commas | `summaries:dispatcher,summaries:executor,assistant` | `summaries:dispatcher`, `summaries:executor`, `assistant`, `streaming_whisper` |
| `BYPASS_AUTHORIZATION` | If signed JWT authorization should be enabled | `false` | `true`, `false` |
| `ENABLE_MONITORING` | If the Prometheus metrics endpoint should be enabled or not | `true` | `true`, `false` |
| `ENABLE_METRICS` | If the Prometheus metrics endpoint should be enabled or not | `true` | `true`, `false` |
| `ASAP_PUB_KEYS_REPO_URL` | Public key repository URL | `NULL` | N/A |
| `ASAP_PUB_KEYS_FOLDER` | Public key repository root path | `NULL` | N/A |
| `ASAP_PUB_KEYS_AUDS` | Allowed JWT audiences, separated by commas | `NULL` | N/A |
Expand Down
2 changes: 1 addition & 1 deletion docs/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Skynet exposes a Prometheus `/metrics` endpoint on port `8001`.

The metrics endpoint can be disabled by setting the `ENABLE_MONITORING` env var to `false`.
The metrics endpoint can be disabled by setting the `ENABLE_METRICS` env var to `false`.

## Exposed metrics

Expand Down
2 changes: 1 addition & 1 deletion skynet/modules/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace=PROMETHEUS_NAMESPACE,
subsystem=PROMETHEUS_SUMMARIES_SUBSYSTEM,
buckets=[5**n for n in range(4)],
labelnames=['app_id'],
labelnames=['app_id', 'processor'],
)

SUMMARY_FULL_DURATION_METRIC = Histogram(
Expand Down
2 changes: 1 addition & 1 deletion skynet/modules/ttt/summaries/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def update_done_job(job: Job, result: str, processor: Processors, has_fail

await db.lrem(RUNNING_JOBS_KEY, 0, job.id)

SUMMARY_DURATION_METRIC.labels(updated_job.metadata.app_id).observe(updated_job.computed_duration)
SUMMARY_DURATION_METRIC.labels(updated_job.metadata.app_id, processor.value).observe(updated_job.computed_duration)
SUMMARY_FULL_DURATION_METRIC.observe(updated_job.computed_full_duration)
SUMMARY_INPUT_LENGTH_METRIC.observe(len(updated_job.payload.text))

Expand Down

0 comments on commit dea42aa

Please sign in to comment.