Skip to content

[Bug]: Backend startup fails with ImportError for INGEST_COUNTER #156

Description

@adepat06

Affected Component

Backend API (FastAPI — apps/backend/)

Bug Description

While attempting to run the FastAPI backend locally, the application fails during startup with an ImportError related to metric aliases imported by the ingest route.

The backend does not start successfully, preventing contributors from accessing API endpoints, testing backend functionality, or using the development server.

The error occurs when apps/backend/routes/ingest.py imports INGEST_COUNTER and REASONING_TRIGGER_COUNTER from libs.observability.metrics.

Steps to Reproduce

  1. Clone the repository.
  2. Install project dependencies.
  3. Navigate to the backend directory:
cd apps/backend
  1. Start the FastAPI server:
uvicorn main:app --reload --port 8000
  1. Observe the startup failure and traceback in the terminal.

Expected Behavior

The backend should start successfully and launch the FastAPI application without import errors.

After startup, contributors should be able to access the API server and available endpoints (including development and documentation endpoints) normally.

Actual Behavior

The backend fails during startup and the FastAPI application is not launched.

Instead of starting the server, an ImportError is raised when importing metrics used by the ingest route:

ImportError: cannot import name 'INGEST_COUNTER' from 'libs.observability.metrics'

As a result, the backend cannot be started and API endpoints are unavailable.

Python Version

3.11

Operating System

macOS

Inference Device

CPU

Error Log / Traceback

Traceback (most recent call last):
  File "/Users/.../apps/backend/routes/ingest.py", line 16, in <module>
    from libs.observability.metrics import INGEST_COUNTER, REASONING_TRIGGER_COUNTER

ImportError: cannot import name 'INGEST_COUNTER' from 'libs.observability.metrics'

Screenshots or Recordings

Image

Additional Context

The issue was encountered on a fresh local setup while attempting to verify backend functionality.

No custom configuration changes were made before reproducing the error. The failure occurs during application startup and prevents the FastAPI backend from launching, which also blocks access to API endpoints and local development workflows.

Checklist

  • I have searched existing issues and this is not a duplicate.
  • I have tested with the latest version of the main branch.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions