Refactor Docker setup and add mock data support
- Updated .dockerignore and .gitignore for better file management. - Introduced .env.example for environment variable configuration. - Added docker-compose.dev.yml for development with mock data and live reload. - Enhanced Dockerfile to include necessary dependencies and entrypoint script. - Created mock_data.py to provide sample data for testing without OpenStack/Prometheus. - Added unit tests for template filters in dashboard. - Cleaned up various files for consistency and improved readability.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import requests
|
||||
|
||||
from watcher_visio.settings import PROMETHEUS_URL
|
||||
|
||||
def query_prometheus(query: str) -> str | list[str]:
|
||||
url = f"{PROMETHEUS_URL}/api/v1/query"
|
||||
params = {
|
||||
"query": query,
|
||||
}
|
||||
response = requests.get(url=url, params=params)
|
||||
response.raise_for_status()
|
||||
result = response.json()["data"]["result"]
|
||||
if len(result) > 1:
|
||||
return result[0]["value"][1]
|
||||
else:
|
||||
return result[0]["values"]
|
||||
import requests
|
||||
|
||||
from watcher_visio.settings import PROMETHEUS_URL
|
||||
|
||||
def query_prometheus(query: str) -> str | list[str]:
|
||||
url = f"{PROMETHEUS_URL}/api/v1/query"
|
||||
params = {
|
||||
"query": query,
|
||||
}
|
||||
response = requests.get(url=url, params=params)
|
||||
response.raise_for_status()
|
||||
result = response.json()["data"]["result"]
|
||||
if len(result) > 1:
|
||||
return result
|
||||
else:
|
||||
return result[0]["value"][1]
|
||||
|
||||
Reference in New Issue
Block a user