Spaces:
Running
Running
debug: add print checks for prometheus.yml contents
Browse files- app/main.py +17 -0
app/main.py
CHANGED
|
@@ -42,6 +42,23 @@ if grafana_key:
|
|
| 42 |
print(f"GRAFANA_API_KEY: length={len(grafana_key)}, has_whitespace={has_whitespace}, starts with='{grafana_key[:8]}...', ends with='...{grafana_key[-8:]}'")
|
| 43 |
else:
|
| 44 |
print("GRAFANA_API_KEY is NOT SET in HF Secrets!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
print("-------------------------------------")
|
| 46 |
|
| 47 |
|
|
|
|
| 42 |
print(f"GRAFANA_API_KEY: length={len(grafana_key)}, has_whitespace={has_whitespace}, starts with='{grafana_key[:8]}...', ends with='...{grafana_key[-8:]}'")
|
| 43 |
else:
|
| 44 |
print("GRAFANA_API_KEY is NOT SET in HF Secrets!")
|
| 45 |
+
|
| 46 |
+
# Diagnostic: check prometheus.yml contents
|
| 47 |
+
try:
|
| 48 |
+
prom_path = "/code/prometheus.yml"
|
| 49 |
+
if os.path.exists(prom_path):
|
| 50 |
+
with open(prom_path, "r") as f:
|
| 51 |
+
lines = f.readlines()
|
| 52 |
+
print("--- prometheus.yml CONTENTS ---")
|
| 53 |
+
for line in lines:
|
| 54 |
+
if "password:" in line:
|
| 55 |
+
val = line.split("password:")[1].strip()
|
| 56 |
+
print(f" password: [MASKED, length={len(val)}, starts_with='{val[:8]}']")
|
| 57 |
+
else:
|
| 58 |
+
print(" ", line.strip())
|
| 59 |
+
print("--------------------------------")
|
| 60 |
+
except Exception as e:
|
| 61 |
+
print("Failed to read prometheus.yml for diagnostics:", e)
|
| 62 |
print("-------------------------------------")
|
| 63 |
|
| 64 |
|