Skip to content

Conversation

@A-Artemis
Copy link
Contributor

@A-Artemis A-Artemis commented Aug 25, 2025

Summary

Added a MetricsService which collects and retrieves the model's inference latencies. It uses shared memory so that it is process safe when accessing the recorded measurements.
The latencies are stored in memory and only a total of 1024 entries are kept.

How to test

http://[geti-tune.localhost/api/pipelines/ace3f1da-fdd9-4048-a95e-a647ed969442/metrics](http://geti-tune.localhost/api/pipelines/ace3f1da-fdd9-4048-a95e-a647ed969442/metrics)

image

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​

License

  • I submit my code changes under the same Apache License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

@github-actions
Copy link

github-actions bot commented Aug 25, 2025

Docker Image Sizes

Image Size
geti-tune-backend-pr-4599 1.2G
geti-tune-backend-sha-fc057a8 1.2G
geti-tune-ui-pr-4599 50M
geti-tune-ui-sha-fc057a8 50M

@A-Artemis A-Artemis changed the title 4537 model latency endpoint Add model latency endpoint Aug 26, 2025
@A-Artemis A-Artemis self-assigned this Aug 26, 2025
@A-Artemis A-Artemis linked an issue Aug 26, 2025 that may be closed by this pull request
@A-Artemis A-Artemis added the Geti Tune Backend Issues related to Geti Tune backend label Aug 26, 2025
@A-Artemis A-Artemis marked this pull request as ready for review August 26, 2025 10:48
@A-Artemis A-Artemis requested a review from Copilot August 26, 2025 10:48

This comment was marked as outdated.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@leoll2 leoll2 requested a review from Copilot September 1, 2025 13:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds model latency tracking capabilities by implementing a MetricsCollector that uses shared memory for process-safe storage of inference latency measurements, along with a new API endpoint to retrieve pipeline metrics.

  • Implements a MetricsCollector using shared memory to track model inference latencies across processes
  • Adds pipeline metrics API endpoint that returns latency statistics (avg, min, max, p95, latest) over configurable time windows
  • Integrates latency collection into the inference workflow by recording start/end times and storing measurements

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/app/services/metrics_collector.py Core MetricsCollector implementation with shared memory and circular buffer
backend/app/workers/inference.py Integration of latency measurement recording in inference workflow
backend/app/services/pipeline_service.py Pipeline metrics calculation and percentile computation logic
backend/app/api/endpoints/pipelines.py New GET endpoint for retrieving pipeline metrics with validation
backend/app/schemas/metrics.py Pydantic models for metrics API response structure
backend/app/services/model_service.py Enhanced LoadedModel to include model ID for metrics tracking
backend/app/schemas/model_activation.py Added active_model_id field to ModelActivationState
backend/tests/unit/services/test_metrics_collector.py Comprehensive unit tests for MetricsCollector functionality
backend/tests/unit/services/test_pipeline_service.py Unit tests for pipeline metrics calculation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@itallix itallix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress! I've added a few suggestions for further improvement.

leoll2
leoll2 previously approved these changes Sep 3, 2025
Copy link
Contributor

@itallix itallix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@A-Artemis A-Artemis merged commit 6b23297 into develop Sep 3, 2025
24 of 25 checks passed
@A-Artemis A-Artemis deleted the aurelien/4537-model-latency-endpoint branch September 3, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Geti Tune Backend Issues related to Geti Tune backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Endpoint to monitor model latency

4 participants