gold module - add azure image service#275
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Azure cloud support to the gold module: new AzureImageService implementation, DI wiring for an azure provider, Azure config keys, and Azure SDK dependencies. Changes
Sequence DiagramsequenceDiagram
participant App as Application
participant AzureService as AzureImageService
participant Blob as Azure Blob Storage
participant Queue as Azure Queue Storage
App->>AzureService: upload_image(image_data, object_key)
AzureService->>Blob: upload blob (content_type='image/jpeg')
Blob-->>AzureService: blob URI
App->>AzureService: upload_image_metadata(metadata, object_key)
AzureService->>Blob: upload metadata blob (application/json)
Blob-->>AzureService: metadata URI
App->>AzureService: send_message(message)
AzureService->>Queue: send json-serialized message
Queue-->>AzureService: message ID
AzureService-->>App: message ID
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
wavefront/server/modules/gold_module/pyproject.toml (1)
10-19:⚠️ Potential issue | 🟠 MajorAdd
boto3explicitly to gold-module dependencies.
wavefront/server/modules/gold_module/gold_module/services/cloud_image_service.pyimportsboto3at line 6, but this dependency is not declared inpyproject.toml. Thecommon-moduledependency does not provideboto3, so a clean install ofgold-modulewill fail. Addboto3<=1.38.40to the dependencies list to match the version constraint used elsewhere in the workspace.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@wavefront/server/modules/gold_module/pyproject.toml` around lines 10 - 19, The pyproject.toml for gold_module is missing the boto3 dependency referenced by the import in gold_module/services/cloud_image_service.py (import boto3 at line 6); add "boto3<=1.38.40" to the dependencies list in the pyproject.toml so the package installs cleanly and matches the workspace version constraint.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@wavefront/server/modules/gold_module/gold_module/gold_container.py`:
- Around line 42-45: The mapping selection uses the local variable
cloud_provider (from os.environ) instead of the configured value; change the
selection to use config.cloud_config.cloud_provider (or a resolved variable that
prefers config then falls back to env) when choosing between aws_image_service,
gcp_image_service, and azure_image_service so AzureImageService can be picked
when the config sets cloud_provider=azure; update any variable references to
cloud_provider in gold_container.py to read from the config object rather than
only os.environ to ensure config-driven deployments select the correct provider.
In
`@wavefront/server/modules/gold_module/gold_module/services/cloud_image_service.py`:
- Around line 7-9: The AzureImageService currently implements async methods
upload_image, upload_image_metadata, and send_message but instantiates and calls
synchronous Azure SDK clients (BlobServiceClient and QueueClient), which blocks
the event loop; fix by either (A) converting to true async: import and
instantiate azure.storage.blob.aio.BlobServiceClient and
azure.storage.queue.aio.QueueClient from the aio packages, use their async
context managers and await upload/metadata/message calls inside upload_image,
upload_image_metadata, and send_message, and ensure DefaultAzureCredential usage
remains compatible, or (B) make the service methods synchronous: remove
async/await from AzureImageService methods, call the current synchronous
BlobServiceClient and QueueClient directly, and update any callers to run them
in threadpool if needed; choose one approach and apply consistently across
AzureImageService, upload_image, upload_image_metadata, and send_message.
---
Outside diff comments:
In `@wavefront/server/modules/gold_module/pyproject.toml`:
- Around line 10-19: The pyproject.toml for gold_module is missing the boto3
dependency referenced by the import in
gold_module/services/cloud_image_service.py (import boto3 at line 6); add
"boto3<=1.38.40" to the dependencies list in the pyproject.toml so the package
installs cleanly and matches the workspace version constraint.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: cdd34f80-15ba-48d8-ac91-03d99c7b0e0c
⛔ Files ignored due to path filters (1)
wavefront/server/uv.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
wavefront/server/apps/floware/floware/config.iniwavefront/server/modules/gold_module/gold_module/gold_container.pywavefront/server/modules/gold_module/gold_module/services/cloud_image_service.pywavefront/server/modules/gold_module/pyproject.toml
| cloud_provider, | ||
| aws=aws_image_service, | ||
| gcp=gcp_image_service, | ||
| azure=azure_image_service, |
There was a problem hiding this comment.
Select the provider from the loaded config, not only from CLOUD_PROVIDER.
This new azure branch is still gated by cloud_provider, which is sourced from os.environ above instead of config.cloud_config.cloud_provider. In a config-driven deployment, setting [cloud_config] cloud_provider=azure in wavefront/server/apps/floware/floware/config.ini will still fall back to gcp when the env var is absent, so AzureImageService never gets selected.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@wavefront/server/modules/gold_module/gold_module/gold_container.py` around
lines 42 - 45, The mapping selection uses the local variable cloud_provider
(from os.environ) instead of the configured value; change the selection to use
config.cloud_config.cloud_provider (or a resolved variable that prefers config
then falls back to env) when choosing between aws_image_service,
gcp_image_service, and azure_image_service so AzureImageService can be picked
when the config sets cloud_provider=azure; update any variable references to
cloud_provider in gold_container.py to read from the config object rather than
only os.environ to ensure config-driven deployments select the correct provider.
| from azure.identity import DefaultAzureCredential | ||
| from azure.storage.blob import BlobServiceClient, ContentSettings | ||
| from azure.storage.queue import QueueClient |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python - <<'PY'
import ast
from pathlib import Path
path = Path("wavefront/server/modules/gold_module/gold_module/services/cloud_image_service.py")
tree = ast.parse(path.read_text())
for node in tree.body:
if isinstance(node, ast.ClassDef) and node.name == "AzureImageService":
for fn in node.body:
if isinstance(fn, ast.AsyncFunctionDef):
has_await = any(isinstance(n, ast.Await) for n in ast.walk(fn))
print(f"{fn.name}: has_await={has_await}")
PY
echo
echo "Azure client imports:"
rg -n -C1 'from azure\.storage\.(blob|queue)\b' wavefront/server/modules/gold_module/gold_module/services/cloud_image_service.pyRepository: rootflo/wavefront
Length of output: 395
Use async Azure SDK clients or make these methods synchronous.
The async methods upload_image, upload_image_metadata, and send_message in AzureImageService use synchronous Azure clients (BlobServiceClient from azure.storage.blob, QueueClient from azure.storage.queue) without await, which blocks the FastAPI event loop during network I/O. Either switch to azure.storage.blob.aio.BlobServiceClient and azure.storage.queue.aio.QueueClient and await their calls, or make these service methods synchronous.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@wavefront/server/modules/gold_module/gold_module/services/cloud_image_service.py`
around lines 7 - 9, The AzureImageService currently implements async methods
upload_image, upload_image_metadata, and send_message but instantiates and calls
synchronous Azure SDK clients (BlobServiceClient and QueueClient), which blocks
the event loop; fix by either (A) converting to true async: import and
instantiate azure.storage.blob.aio.BlobServiceClient and
azure.storage.queue.aio.QueueClient from the aio packages, use their async
context managers and await upload/metadata/message calls inside upload_image,
upload_image_metadata, and send_message, and ensure DefaultAzureCredential usage
remains compatible, or (B) make the service methods synchronous: remove
async/await from AzureImageService methods, call the current synchronous
BlobServiceClient and QueueClient directly, and update any callers to run them
in threadpool if needed; choose one approach and apply consistently across
AzureImageService, upload_image, upload_image_metadata, and send_message.
- rather use ASSET_STORAGE_BUCKET only
Summary by CodeRabbit