Skip to content

LCORE-1857: Add metrics to track degraded mode startup state#1985

Merged
tisnik merged 1 commit into
lightspeed-core:mainfrom
anik120:logs-degraded-mode
Jun 24, 2026
Merged

LCORE-1857: Add metrics to track degraded mode startup state#1985
tisnik merged 1 commit into
lightspeed-core:mainfrom
anik120:logs-degraded-mode

Conversation

@anik120

@anik120 anik120 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Add Prometheus metrics to monitor when Lightspeed Core Stack starts in degraded mode (without llama-stack connectivity). During implementation, discovered that PR #327's lazy initialization pattern prevented model metrics from being set up correctly, requiring a revert.

When LCORE starts in degraded mode, the @run_once_async decorator marks setup_model_metrics() as "done" after it returns early. On restart with llama-stack available, the function never runs again, leaving model metrics uninitialized. Moving setup back to startup fixes this while degraded mode already provides the startup resilience that PR #327 originally addressed.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: (e.g., Claude, CodeRabbit, Ollama, etc., N/A if not used)
  • Generated by: (e.g., tool name and version; N/A if not used)

Related Tickets & Documents

  • Related Issue #
  • Closes #

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new Prometheus gauge (ls_started_in_degraded_mode) to indicate whether the service started in degraded or healthy mode.
  • Improvements

    • Metrics instrumentation is now initialized during application startup (when healthy), rather than during the first /metrics request.
    • If metrics setup encounters connectivity issues, the service logs a warning and continues operating.
    • /metrics now consistently returns the latest Prometheus metrics in plain text format.
  • Tests / Documentation

    • Updated metrics endpoint tests and OpenAPI descriptions accordingly.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

setup_model_metrics() now runs during FastAPI startup when the app is healthy instead of inside the /metrics endpoint. A new ls_started_in_degraded_mode gauge records degraded startup state, and DegradedModeTracker updates it on state changes. Endpoint docs and tests were adjusted to match the revised metrics response.

Changes

Startup metrics initialization and degraded mode gauge

Layer / File(s) Summary
Degraded mode gauge definition and recording helper
src/metrics/__init__.py, src/metrics/recording.py
Adds the ls_started_in_degraded_mode Prometheus Gauge and a helper that sets it to 1 or 0, logging on common update errors.
DegradedModeTracker emits degraded mode gauge
src/utils/degraded_mode.py
DegradedModeTracker imports metrics recording and calls set_started_in_degraded_mode(True/False) on degraded and healthy transitions.
startup setup and /metrics response
src/metrics/utils.py, src/app/main.py, src/app/endpoints/metrics.py, docs/openapi.json, tests/unit/app/endpoints/test_metrics.py
setup_model_metrics becomes a plain async startup helper, is called during lifespan startup only when healthy, and is removed from the /metrics handler. The handler docs and OpenAPI description now describe returning the latest Prometheus metrics, and the unit test now checks for the new degraded-mode gauge in the response.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • tisnik
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding metrics to track degraded-mode startup state.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/degraded_mode.py`:
- Around line 35-44: The `set_healthy()` method is calling
`recording.set_started_in_degraded_mode(False)` which overwrites the
startup-state metric, erasing evidence that the service started degraded. Since
this metric should only capture the startup state and be write-once per process,
remove the line `recording.set_started_in_degraded_mode(False)` from the
`set_healthy()` method. The metric should only be set once during
initialization, not updated when transitioning between degraded and healthy
modes later.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7902cec5-73e6-43fa-ab6a-79464359fa17

📥 Commits

Reviewing files that changed from the base of the PR and between c9871df and dae36bf.

📒 Files selected for processing (6)
  • src/app/endpoints/metrics.py
  • src/app/main.py
  • src/metrics/__init__.py
  • src/metrics/recording.py
  • src/metrics/utils.py
  • src/utils/degraded_mode.py
📜 Review details
⏰ Context from checks skipped due to timeout. (15)
  • GitHub Check: Pylinter
  • GitHub Check: unit_tests (3.13)
  • GitHub Check: unit_tests (3.12)
  • GitHub Check: build-pr
  • GitHub Check: integration_tests (3.12)
  • GitHub Check: integration_tests (3.13)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-6-on-pull-request
  • GitHub Check: E2E: server mode / ci / group 3
  • GitHub Check: E2E: server mode / ci / group 1
  • GitHub Check: E2E: library mode / ci / group 1
  • GitHub Check: E2E: server mode / ci / group 2
  • GitHub Check: E2E: library mode / ci / group 3
  • GitHub Check: E2E: library mode / ci / group 2
  • GitHub Check: E2E Tests for Lightspeed Evaluation job
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.py: Use absolute imports for internal modules: from authentication import get_auth_dependency
Llama Stack imports: Use from llama_stack_client import AsyncLlamaStackClient
Check constants.py for shared constants before defining new ones
All modules must start with descriptive docstrings explaining purpose
Use logger = get_logger(__name__) from log.py for module logging
All functions must have complete type annotations for parameters and return types, use modern syntax (str | int), and include descriptive docstrings
Use snake_case with descriptive, action-oriented names for functions (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns; return new data structures instead of modifying function parameters
Use async def for I/O operations and external API calls
Use standard log levels with clear purposes: debug() for diagnostic info, info() for program execution, warning() for unexpected events, error() for serious problems
All classes must have descriptive docstrings explaining purpose and use PascalCase with standard suffixes: Configuration, Error/Exception, Resolver, Interface
Abstract classes must use ABC with @abstractmethod decorators
Follow Google Python docstring conventions with required sections: Parameters, Returns, Raises, and Attributes for classes

Files:

  • src/metrics/__init__.py
  • src/metrics/recording.py
  • src/app/endpoints/metrics.py
  • src/utils/degraded_mode.py
  • src/metrics/utils.py
  • src/app/main.py
src/**/__init__.py

📄 CodeRabbit inference engine (AGENTS.md)

Package __init__.py files must contain brief package descriptions

Files:

  • src/metrics/__init__.py
src/app/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/app/**/*.py: FastAPI dependencies: Import from fastapi module for APIRouter, HTTPException, Request, status, Depends
Use FastAPI HTTPException with appropriate status codes for API endpoints and handle APIConnectionError from Llama Stack

Files:

  • src/app/endpoints/metrics.py
  • src/app/main.py
🧠 Learnings (1)
📚 Learning: 2026-04-06T20:18:07.852Z
Learnt from: major
Repo: lightspeed-core/lightspeed-stack PR: 1463
File: src/app/endpoints/rlsapi_v1.py:266-271
Timestamp: 2026-04-06T20:18:07.852Z
Learning: In the lightspeed-stack codebase, within `src/app/endpoints/` inference/MCP endpoints, treat `tools: Optional[list[Any]]` in MCP tool definitions as an intentional, consistent typing pattern (used across `query`, `responses`, `streaming_query`, `rlsapi_v1`). Do not raise or suggest this as a typing issue during code review; changing it in isolation could break endpoint typing consistency across the codebase.

Applied to files:

  • src/app/endpoints/metrics.py
🔇 Additional comments (6)
src/metrics/__init__.py (1)

85-90: LGTM!

src/metrics/recording.py (1)

162-174: LGTM!

src/utils/degraded_mode.py (1)

9-9: LGTM!

src/metrics/utils.py (1)

13-20: LGTM!

src/app/main.py (1)

26-26: LGTM!

Also applies to: 124-130

src/app/endpoints/metrics.py (1)

49-49: LGTM!

Also applies to: 65-65

Comment on lines +35 to +44
# Record startup state metric
recording.set_started_in_degraded_mode(True)

def set_healthy(self) -> None:
"""Mark the service as running in healthy mode."""
self._is_degraded = False
self._degraded_reason = None

# Record startup state metric
recording.set_started_in_degraded_mode(False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve startup-only semantics for ls_started_in_degraded_mode.

Line 43 resets the gauge to 0, which can erase evidence that the service started degraded if set_healthy() is called after startup. For a startup-state metric, this should be write-once per process startup.

💡 Suggested fix
 class DegradedModeTracker(metaclass=Singleton):
@@
     def __init__(self) -> None:
         """Initialize the degraded mode tracker."""
         self._is_degraded: bool = False
         self._degraded_reason: Optional[str] = None
+        self._startup_state_recorded: bool = False
+
+    def _record_startup_state_once(self, is_degraded: bool) -> None:
+        """Record startup degraded-state metric only once per process start."""
+        if self._startup_state_recorded:
+            return
+        recording.set_started_in_degraded_mode(is_degraded)
+        self._startup_state_recorded = True
@@
-        recording.set_started_in_degraded_mode(True)
+        self._record_startup_state_once(True)
@@
-        recording.set_started_in_degraded_mode(False)
+        self._record_startup_state_once(False)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/degraded_mode.py` around lines 35 - 44, The `set_healthy()` method
is calling `recording.set_started_in_degraded_mode(False)` which overwrites the
startup-state metric, erasing evidence that the service started degraded. Since
this metric should only capture the startup state and be write-once per process,
remove the line `recording.set_started_in_degraded_mode(False)` from the
`set_healthy()` method. The metric should only be set once during
initialization, not updated when transitioning between degraded and healthy
modes later.

@anik120 anik120 marked this pull request as draft June 23, 2026 21:34
@anik120 anik120 force-pushed the logs-degraded-mode branch 2 times, most recently from cee4a9a to b169143 Compare June 24, 2026 14:42
Add Prometheus metrics to monitor when Lightspeed Core Stack starts in
degraded mode (without llama-stack connectivity). During implementation,
discovered that PR lightspeed-core#327's lazy initialization pattern prevented model
metrics from being set up correctly, requiring a revert.

When LCORE starts in degraded mode, the @run_once_async
decorator marks setup_model_metrics() as "done" after it returns early.
On restart with llama-stack available, the function never runs again,
leaving model metrics uninitialized. Moving setup back to startup fixes
this while degraded mode already provides the startup resilience that
PR lightspeed-core#327 originally addressed.

Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>
@anik120 anik120 force-pushed the logs-degraded-mode branch from b169143 to 359b19e Compare June 24, 2026 14:43
@anik120 anik120 marked this pull request as ready for review June 24, 2026 15:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/utils/degraded_mode.py (1)

43-44: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Startup-state gauge is reset on later healthy transitions.

set_healthy() writes 0 to ls_started_in_degraded_mode, which can overwrite the recorded startup state if a healthy transition occurs after startup. For a startup-state metric this should be write-once per process.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/degraded_mode.py` around lines 43 - 44, The startup-state gauge is
being overwritten by later healthy transitions in set_healthy(), which makes
ls_started_in_degraded_mode no longer reflect only process startup state. Update
the degraded_mode logic so set_started_in_degraded_mode is written once during
startup and not reset by later calls to set_healthy(); keep the startup
recording in the startup path and remove or guard the zero-write in
set_healthy() while preserving the behavior of the other degraded mode metrics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/openapi.json`:
- Line 10403: The OpenAPI schema artifact is out of sync with the generated
runtime schema, causing the Spectral CI drift failure. Regenerate the schema
using the existing generator workflow that updates docs/openapi.json, then
commit the refreshed artifact so it matches the current API definition; the key
target to verify is the metrics endpoint description in the generated OpenAPI
output.

In `@src/metrics/recording.py`:
- Around line 168-169: The docstring for the relevant function in recording.py
uses the nonstandard Args: header; update it to the repo’s required Parameters:
section while keeping the existing is_degraded argument description intact.
Locate the affected docstring near the metrics recording function and replace
the header so it matches the standard used throughout the codebase.

---

Duplicate comments:
In `@src/utils/degraded_mode.py`:
- Around line 43-44: The startup-state gauge is being overwritten by later
healthy transitions in set_healthy(), which makes ls_started_in_degraded_mode no
longer reflect only process startup state. Update the degraded_mode logic so
set_started_in_degraded_mode is written once during startup and not reset by
later calls to set_healthy(); keep the startup recording in the startup path and
remove or guard the zero-write in set_healthy() while preserving the behavior of
the other degraded mode metrics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d9a69587-8ade-4368-af9e-305ac6f3550a

📥 Commits

Reviewing files that changed from the base of the PR and between dae36bf and 359b19e.

📒 Files selected for processing (8)
  • docs/openapi.json
  • src/app/endpoints/metrics.py
  • src/app/main.py
  • src/metrics/__init__.py
  • src/metrics/recording.py
  • src/metrics/utils.py
  • src/utils/degraded_mode.py
  • tests/unit/app/endpoints/test_metrics.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-6-on-pull-request
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
📓 Path-based instructions (4)
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.py: Use pytest for all unit and integration tests; do not use unittest
Use pytest.mark.asyncio marker for async tests

Files:

  • tests/unit/app/endpoints/test_metrics.py
src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.py: Use absolute imports for internal modules: from authentication import get_auth_dependency
Llama Stack imports: Use from llama_stack_client import AsyncLlamaStackClient
Check constants.py for shared constants before defining new ones
All modules must start with descriptive docstrings explaining purpose
Use logger = get_logger(__name__) from log.py for module logging
All functions must have complete type annotations for parameters and return types, use modern syntax (str | int), and include descriptive docstrings
Use snake_case with descriptive, action-oriented names for functions (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns; return new data structures instead of modifying function parameters
Use async def for I/O operations and external API calls
Use standard log levels with clear purposes: debug() for diagnostic info, info() for program execution, warning() for unexpected events, error() for serious problems
All classes must have descriptive docstrings explaining purpose and use PascalCase with standard suffixes: Configuration, Error/Exception, Resolver, Interface
Abstract classes must use ABC with @abstractmethod decorators
Follow Google Python docstring conventions with required sections: Parameters, Returns, Raises, and Attributes for classes

Files:

  • src/metrics/recording.py
  • src/app/endpoints/metrics.py
  • src/utils/degraded_mode.py
  • src/app/main.py
  • src/metrics/__init__.py
  • src/metrics/utils.py
src/app/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/app/**/*.py: FastAPI dependencies: Import from fastapi module for APIRouter, HTTPException, Request, status, Depends
Use FastAPI HTTPException with appropriate status codes for API endpoints and handle APIConnectionError from Llama Stack

Files:

  • src/app/endpoints/metrics.py
  • src/app/main.py
src/**/__init__.py

📄 CodeRabbit inference engine (AGENTS.md)

Package __init__.py files must contain brief package descriptions

Files:

  • src/metrics/__init__.py
🧠 Learnings (2)
📚 Learning: 2026-06-24T13:45:37.249Z
Learnt from: Jdubrick
Repo: lightspeed-core/lightspeed-stack PR: 1971
File: src/utils/markdown_repair.py:31-36
Timestamp: 2026-06-24T13:45:37.249Z
Learning: In the lightspeed-stack repository, docstrings must use the section header name "Parameters:" (not "Args:") for function arguments, even if the project references Google Python docstring conventions. Ensure docstrings follow the project’s established "Parameters:" header format for any documented function parameters.

Applied to files:

  • tests/unit/app/endpoints/test_metrics.py
  • src/metrics/recording.py
  • src/app/endpoints/metrics.py
  • src/utils/degraded_mode.py
  • src/app/main.py
  • src/metrics/__init__.py
  • src/metrics/utils.py
📚 Learning: 2026-04-06T20:18:07.852Z
Learnt from: major
Repo: lightspeed-core/lightspeed-stack PR: 1463
File: src/app/endpoints/rlsapi_v1.py:266-271
Timestamp: 2026-04-06T20:18:07.852Z
Learning: In the lightspeed-stack codebase, within `src/app/endpoints/` inference/MCP endpoints, treat `tools: Optional[list[Any]]` in MCP tool definitions as an intentional, consistent typing pattern (used across `query`, `responses`, `streaming_query`, `rlsapi_v1`). Do not raise or suggest this as a typing issue during code review; changing it in isolation could break endpoint typing consistency across the codebase.

Applied to files:

  • src/app/endpoints/metrics.py
🪛 GitHub Actions: OpenAPI (Spectral) / 0_spectral.txt
docs/openapi.json

[error] 1-1: docs/openapi.json is out of date (generated schema differs from /tmp/openapi-generated.json). Regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.json

🔇 Additional comments (5)
src/metrics/__init__.py (1)

86-90: LGTM!

src/metrics/utils.py (1)

12-20: LGTM!

src/app/endpoints/metrics.py (1)

64-65: LGTM!

src/app/main.py (1)

126-129: 🩺 Stability & Availability

Broaden startup error handling if model-metrics setup should not abort boot

setup_model_metrics() can still raise APIStatusError from models.list() or HTTPException from check_configuration_loaded(), but the lifespan only catches APIConnectionError. If healthy-mode startup should tolerate those failures too, handle them here; otherwise this fail-fast behavior is fine.

tests/unit/app/endpoints/test_metrics.py (1)

7-7: LGTM!

Also applies to: 43-43

Comment thread docs/openapi.json
],
"summary": "Metrics Endpoint Handler",
"description": "Handle request to the /metrics endpoint.\n\nProcess GET requests to the /metrics endpoint, returning the\nlatest Prometheus metrics in form of a plain text.\n\nInitializes model metrics on the first request if not already\nset up, then responds with the current metrics snapshot in\nPrometheus format.\n\n### Parameters:\n- request: The incoming HTTP request (used by middleware).\n- auth: Authentication tuple from the auth dependency (used by middleware).\n\n### Returns:\n- PlainTextResponse: Response body containing the Prometheus metrics text\n and the Prometheus content type.",
"description": "Handle request to the /metrics endpoint.\n\nProcess GET requests to the /metrics endpoint, returning the\nlatest Prometheus metrics in plain text Prometheus format.\n\n### Parameters:\n- request: The incoming HTTP request (used by middleware).\n- auth: Authentication tuple from the auth dependency (used by middleware).\n\n### Returns:\n- PlainTextResponse: Response body containing the Prometheus metrics text\n and the Prometheus content type.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Regenerate and commit OpenAPI schema to fix CI drift.

The Spectral job is failing because docs/openapi.json no longer matches the generated schema. Please regenerate with uv run python scripts/generate_openapi_schema.py docs/openapi.json and commit the updated artifact to keep docs and runtime schema in sync.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openapi.json` at line 10403, The OpenAPI schema artifact is out of sync
with the generated runtime schema, causing the Spectral CI drift failure.
Regenerate the schema using the existing generator workflow that updates
docs/openapi.json, then commit the refreshed artifact so it matches the current
API definition; the key target to verify is the metrics endpoint description in
the generated OpenAPI output.

Source: Pipeline failures

Comment thread src/metrics/recording.py
Comment on lines +168 to +169
Args:
is_degraded: True if service started in degraded mode, False if healthy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the Parameters: docstring header instead of Args:.

This repo standardizes on the Parameters: section header for documented arguments.

📝 Proposed fix
-    Args:
-        is_degraded: True if service started in degraded mode, False if healthy.
+    Parameters:
+        is_degraded: True if service started in degraded mode, False if healthy.

Based on learnings: docstrings must use the section header name "Parameters:" (not "Args:") for function arguments.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Args:
is_degraded: True if service started in degraded mode, False if healthy.
Parameters:
is_degraded: True if service started in degraded mode, False if healthy.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/metrics/recording.py` around lines 168 - 169, The docstring for the
relevant function in recording.py uses the nonstandard Args: header; update it
to the repo’s required Parameters: section while keeping the existing
is_degraded argument description intact. Locate the affected docstring near the
metrics recording function and replace the header so it matches the standard
used throughout the codebase.

Source: Learnings

@tisnik tisnik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tisnik tisnik merged commit ab86328 into lightspeed-core:main Jun 24, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants