Skip to content

Conversation

@alxtkr77
Copy link
Member

@alxtkr77 alxtkr77 commented Jan 8, 2026

Summary

Fix the model-monitoring-stream pod failing when flushing batches to TimescaleDB with "Table does not exist" errors.

Root Cause

TimescaleDBConnector (API server side) auto-generates database name as mlrun_mm_{system_id}, but TimescaleDBStoreyTarget (stream side) used the original profile database directly, causing a mismatch. Tables were created in mlrun_mm_{system_id} but stream tried to write to postgres.

Changes Made

  • Add shared get_tsdb_database_name() function in mlrun/common/model_monitoring/helpers.py
  • Update TimescaleDBConnector._determine_database_name() to use the shared function
  • Update TimescaleDBStoreyTarget.__init__() to use the shared function for consistent database naming

Testing

  • Unit tests: 41 passed
  • Integration tests with real TimescaleDB: 4 passed (test_timescaledb_connector.py)
  • Pre-commit checks: sourcery, ruff format, ruff check all passed

Checklist

  • Code follows project style guidelines
  • Tests added/updated
  • Documentation not needed (internal implementation)
  • No breaking changes

Reference

The model-monitoring-stream pod failed when flushing batches to TimescaleDB
with "Table does not exist" errors. Root cause: TimescaleDBConnector (API server)
auto-generates database name as 'mlrun_mm_{system_id}', but TimescaleDBStoreyTarget
(stream) used the original profile database, causing a mismatch.

- Add shared get_tsdb_database_name() function in helpers.py
- Update TimescaleDBConnector to use shared function
- Update TimescaleDBStoreyTarget to use shared function for consistent naming

Fixes: ML-11807
@alxtkr77 alxtkr77 requested a review from a team as a code owner January 8, 2026 12:43
Copy link
Collaborator

@gtopper gtopper left a comment

Choose a reason for hiding this comment

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

Looks good. Could benefit from a regression test if one can be added without too much effort.

…1807)

Add tests to verify consistent database naming between TimescaleDBConnector
and TimescaleDBStoreyTarget components. These tests cover the shared
get_tsdb_database_name() helper function introduced in the fix.

- Add TestGetTsdbDatabaseName class with 6 test cases in test_helpers.py
- Add TestTimescaleDBStoreyTargetDatabaseResolution with 4 test cases
- Fix pre-existing bug in error message (datastore_profile.type.__name__ → type)

Reference: ML-11807
@alxtkr77 alxtkr77 merged commit acf743d into mlrun:development Jan 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants