-
Notifications
You must be signed in to change notification settings - Fork 9
chore: remove etcd in favor of redis #162
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
base: chore/refactor_removed_useless_containers
Are you sure you want to change the base?
chore: remove etcd in favor of redis #162
Conversation
There was a problem hiding this 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 migrates the system from using etcd to Redis for model service discovery. The change affects the underlying storage mechanism for model registration and discovery while maintaining the same API surface.
- Replaced etcd3gw client with redis.asyncio for all model discovery operations
- Updated configuration to use Redis connection parameters instead of etcd parameters
- Modified Docker Compose files to use Redis container dependencies instead of etcd
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
packages/nilai-common/src/nilai_common/discovery.py | Core migration from etcd to Redis with async/await pattern |
packages/nilai-common/pyproject.toml | Updated dependency from etcd3gw to redis |
tests/unit/nilai-common/test_discovery.py | Comprehensive test rewrite using Redis test containers |
tests/unit/nilai-common/conftest.py | Added Redis test container fixtures |
nilai-api/src/nilai_api/state.py | Added async initialization for discovery service |
nilai-api/src/nilai_api/config/* | Updated configuration models from etcd to discovery |
docker-compose*.yml | Updated all compose files to depend on redis instead of etcd |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
discovery_host=str(os.getenv("ETCD_HOST", "localhost")), | ||
discovery_port=int( | ||
os.getenv("ETCD_PORT", 6379) | ||
), # Redis port (changed from etcd's 2379) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable names still reference ETCD_HOST and ETCD_PORT despite migrating to Redis. Consider renaming these to DISCOVERY_HOST and DISCOVERY_PORT for consistency and to avoid confusion.
discovery_host=str(os.getenv("ETCD_HOST", "localhost")), | |
discovery_port=int( | |
os.getenv("ETCD_PORT", 6379) | |
), # Redis port (changed from etcd's 2379) | |
discovery_host=str(os.getenv("DISCOVERY_HOST", "localhost")), | |
discovery_port=int( | |
os.getenv("DISCOVERY_PORT", 6379) | |
), # Redis port |
Copilot uses AI. Check for mistakes.
@property | ||
async def client(self) -> redis.Redis: |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @Property decorator with async method is unconventional and may cause confusion. Consider making this a regular async method like async def get_client(self)
instead.
Copilot uses AI. Check for mistakes.
if self._client is None: | ||
# This should never happen | ||
raise ValueError("Redis client must be initialized") |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double check for self._client is None
is redundant since initialize()
should always set self._client
. The second check could be replaced with an assertion or removed entirely.
if self._client is None: | |
# This should never happen | |
raise ValueError("Redis client must be initialized") | |
assert self._client is not None, "Redis client must be initialized after initialize()" |
Copilot uses AI. Check for mistakes.
ETCD_HOST: redis | ||
ETCD_PORT: "6379" |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment variable names ETCD_HOST and ETCD_PORT are misleading after migrating to Redis. These should be updated to DISCOVERY_HOST and DISCOVERY_PORT to match the new architecture.
ETCD_HOST: redis | |
ETCD_PORT: "6379" | |
DISCOVERY_HOST: redis | |
DISCOVERY_PORT: "6379" |
Copilot uses AI. Check for mistakes.
No description provided.