-
Notifications
You must be signed in to change notification settings - Fork 84
[MME] feat: Implement telemetry recording for video processing pipelines #1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bhardwaj-nakul
wants to merge
14
commits into
open-edge-platform:main
Choose a base branch
from
bhardwaj-nakul:feat/mme-telemetry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e93ad24
feat: Implement telemetry recording for video processing pipelines
bhardwaj-nakul 8ac848d
feat: Add telemetry logging and metrics documentation for video proce…
bhardwaj-nakul 4f32729
feat: Update telemetry metrics documentation with detailed sample res…
bhardwaj-nakul 98df77e
feat: Add wall time throughput metric to telemetry and update related…
bhardwaj-nakul 37e1165
Merge branch 'main' into feat/mme-telemetry
bhardwaj-nakul 06fa776
Merge branch 'main' into feat/mme-telemetry
bhardwaj-nakul 8c5b9b1
feat: Add configuration for embedding batch size and max parallel wor…
bhardwaj-nakul e7dc09a
Merge branch 'main' into feat/mme-telemetry
bharagha 7229f81
Merge branch 'main' into feat/mme-telemetry
bhardwaj-nakul 57defdc
Merge branch 'main' into feat/mme-telemetry
bhardwaj-nakul 25e8ebc
allow for PM_MULTI_FRAME_COUNT override in setup script
bhardwaj-nakul 3440d38
fix: change return to exit in setup script on build failure
bhardwaj-nakul 398375f
Merge branch 'main' into feat/mme-telemetry
bhardwaj-nakul 0afaee7
fix: add default value handling for PM_MULTI_FRAME_COUNT in setup script
bhardwaj-nakul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
158 changes: 158 additions & 0 deletions
158
...visual-data-preparation-for-retrieval/vdms/docs/user-guide/telemetry-metrics.md
This file contains hidden or 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,158 @@ | ||
| # Telemetry Metrics | ||
|
|
||
| This note explains what the `/telemetry` endpoint returns, how each metric is computed, and how to interpret the numbers when tuning the VDMS DataPrep microservice. | ||
|
|
||
| ## Endpoint recap | ||
|
|
||
| - **Path:** `GET /telemetry` | ||
| - **Query parameters:** | ||
| - `limit` (default `10`, max `100`) – number of most recent records to return (capped by the server-side retention window). | ||
| - `source` – optional filter that matches the request path that produced the entry (for example `/videos/upload`). | ||
| - **Response shape:** | ||
|
|
||
| Sample response: | ||
|
|
||
| ```json | ||
| { | ||
| "count": 1, | ||
| "items": [ | ||
| { | ||
| "request_id": "a2e00af4-3d62-4d3b-b9e2-5a08743b21b7", | ||
| "source": "/videos/minio", | ||
| "processing_mode": "sdk", | ||
| "timestamps": { | ||
| "requested_at": "2025-12-15T05:18:19.320075Z", | ||
| "completed_at": "2025-12-15T05:18:53.187766Z", | ||
| "wall_time_seconds": 33.42496871948242 | ||
| }, | ||
| "video": { | ||
| "bucket_name": "video-summary", | ||
| "video_id": "a0ee04eb-5dc2-450b-a4b7-16a230a1c282", | ||
| "filename": "sample.mp4", | ||
| "frame_interval": 20, | ||
| "fps": 30.0, | ||
| "total_frames": 17973, | ||
| "video_duration_seconds": 599.1, | ||
| "tags": [], | ||
| "video_url": "http://vdms-dataprep:8000/v1/dataprep/videos/download?video_id=a0ee04eb-5dc2-450b-a4b7-16a230a1c282&bucket_name=video-summary", | ||
| "video_rel_url": "/v1/dataprep/videos/download?video_id=a0ee04eb-5dc2-450b-a4b7-16a230a1c282&bucket_name=video-summary", | ||
| "processing_mode": "sdk" | ||
| }, | ||
| "config": { | ||
| "embedding_mode": "sdk", | ||
| "object_detection_enabled": true, | ||
| "detection_confidence": 0.85, | ||
| "sdk_parallel_workers": 60, | ||
| "sdk_batch_size": 32 | ||
| }, | ||
| "counts": { | ||
| "frames_extracted": 899, | ||
| "items_after_detection": 2370, | ||
| "embeddings_stored": 2370 | ||
| }, | ||
| "stages": [ | ||
| { | ||
| "name": "extraction", | ||
| "seconds": 14.225327968597412, | ||
| "percent_of_total": 42.55898663057204 | ||
| }, | ||
| { | ||
| "name": "detection", | ||
| "seconds": 388.91471695899963, | ||
| "percent_of_total": 48.282008923343355 | ||
| }, | ||
| { | ||
| "name": "embedding", | ||
| "seconds": 59.44792938232422, | ||
| "percent_of_total": 7.380192447729496 | ||
| }, | ||
| { | ||
| "name": "storage", | ||
| "seconds": 14.32844614982605, | ||
| "percent_of_total": 1.7788119983550996 | ||
| } | ||
| ], | ||
| "throughput": { | ||
| "embeddings_per_second": 960.7483555108118, | ||
| "wall_time_embeddings_per_second": 70.9559383300526, | ||
| "embedding_stage_embeddings_per_second": 39.86682168117158, | ||
| "frames_per_second": 63.19713696475425 | ||
| }, | ||
| "batches": [ | ||
| { | ||
| "batch_index": 29, | ||
| "input_frames": 3, | ||
| "items_after_detection": 7, | ||
| "detection_seconds": 0.8262088298797607, | ||
| "embedding_seconds": 0.25011181831359863, | ||
| "storage_seconds": 0.06559395790100098, | ||
| "total_seconds": 1.1423156261444092, | ||
| "embeddings_stored": 7 | ||
| }, | ||
| <other batch details omitted for brevity> | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| Each `TelemetryRecord` is stored in JSONL under `data/telemetry/telemetry.jsonl` (or the configured path) and is served verbatim after lightweight normalization so that older float timestamps are converted to UTC ISO-8601 strings. | ||
|
|
||
| ## Metric derivations | ||
|
|
||
| ### Timestamps | ||
|
|
||
| | Field | Description | Calculation | | ||
| | --- | --- | --- | | ||
| | `requested_at` | When the pipeline accepted the request. | Captured at the start of processing and emitted as a UTC string (`YYYY-MM-DDTHH:MM:SS.sssZ`). | | ||
| | `completed_at` | When the final artifact (embeddings + manifests) was written. | Same formatting as `requested_at`, recorded after storage finishes. | | ||
| | `wall_time_seconds` | End-to-end time the request spent in the pipeline. | Difference between the completion and request timestamps (falls back to `0` if either timestamp is missing). | | ||
|
|
||
| ### Video metadata | ||
|
|
||
| This block mirrors the request that was processed: | ||
|
|
||
| - `bucket_name`, `video_id`, `filename`, and `frame_interval` are copied from the active job. Numerical fields (`fps`, `total_frames`, `video_duration_seconds`) come straight from the frame extractor. | ||
| - `video_url` and `video_rel_url` point to the download endpoint for the processed video or stitched preview. | ||
| - `processing_mode` echoes the embedding execution path (`sdk` or `api`). | ||
|
|
||
| ### Processing config | ||
|
|
||
| Fields such as `embedding_mode`, `object_detection_enabled`, `detection_confidence`, `sdk_parallel_workers`, and `sdk_batch_size` are captured from the resolved runtime configuration. They reflect the **effective** configuration (after environment variables, CLI args, and defaults are merged) so operators can correlate telemetry with tuning changes. | ||
|
|
||
| ### Aggregate counts | ||
|
|
||
| | Field | Description | | ||
| | --- | --- | | ||
| | `frames_extracted` | Number of keyframes pulled from the source video before detection. | | ||
| | `items_after_detection` | Crops + frames that survived object detection filters. | | ||
| | `embeddings_stored` | Items that were successfully embedded and written to VDMS. This value should match the `embeddings` counter in the service logs for the same request. | | ||
|
|
||
| ### Stage timings | ||
|
|
||
| Stage timing objects follow the schema `{name, seconds, percent_of_total}` and are produced by `_build_stage_timings`: | ||
|
|
||
| 1. `seconds` equals the summed time spent in the stage per the pipeline stats. | ||
| 2. Percentages always add up to `100` even when stages overlap: | ||
| - Extraction runs before anything else, so its percentage is `frame_extraction_seconds / wall_time_seconds`. | ||
| - Detection, embedding, and storage often overlap when the parallel pipeline is enabled. Their raw seconds are normalized against the **parallel budget**, computed as `(wall_time_seconds - extraction_seconds)`. Each stage receives a share of that budget proportional to its measured seconds. This highlights relative pressure inside the concurrently running stages without double-counting wall time. | ||
|
|
||
| ### Throughput metrics | ||
|
|
||
| | Field | Description | Formula | | ||
| | --- | --- | --- | | ||
| | `embeddings_per_second` | Effective throughput for the entire request. Accounts for overlapping stages. | `embeddings_stored / effective_embedding_seconds`, where `effective_embedding_seconds = wall_time_seconds * (embedding_stage_percent / 100)`. Falls back to `wall_time_seconds` if the embedding stage percent is `0`. | | ||
| | `embedding_stage_embeddings_per_second` | Raw throughput during the embedding stage only. Useful for spotting model-level slowdowns. | `embeddings_stored / embedding_seconds_total`. | | ||
| | `wall_time_embeddings_per_second` | Wall-clock throughput that ignores stage overlap. | `embeddings_stored / wall_time_seconds`. | | ||
| | `frames_per_second` | Frame extraction throughput. | `frames_extracted / frame_extraction_seconds` (or `/ wall_time_seconds` if extraction time is unknown). | | ||
|
|
||
| ### Batch breakdown | ||
|
|
||
| When SDK mode runs with batching enabled, each batch reports: | ||
|
|
||
| - `batch_index` – sequential identifier (starting at `1`). | ||
| - `input_frames` and `items_after_detection` – how many frames/crops were submitted for that batch. | ||
| - `detection_seconds`, `embedding_seconds`, `storage_seconds`, `total_seconds` – stage timing for the batch, captured before threading overhead is applied. | ||
| - `embeddings_stored` – how many embeddings survived all downstream filters. | ||
|
|
||
| These entries make it easy to identify skewed batches (for example, ones with large detection times because of busy scenes). |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.