Update core/true_arf_oss.py
Browse files- core/true_arf_oss.py +34 -1
core/true_arf_oss.py
CHANGED
|
@@ -918,4 +918,37 @@ async def get_mock_true_arf_oss(config: Optional[Dict[str, Any]] = None) -> True
|
|
| 918 |
}
|
| 919 |
}
|
| 920 |
|
| 921 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 918 |
}
|
| 919 |
}
|
| 920 |
|
| 921 |
+
return MockTrueARFOSS(config)
|
| 922 |
+
|
| 923 |
+
# ============================================================================
|
| 924 |
+
# MAIN ENTRY POINT
|
| 925 |
+
# ============================================================================
|
| 926 |
+
|
| 927 |
+
if __name__ == "__main__":
|
| 928 |
+
# Test the implementation
|
| 929 |
+
import asyncio
|
| 930 |
+
|
| 931 |
+
async def test():
|
| 932 |
+
# Create test scenario
|
| 933 |
+
scenario = {
|
| 934 |
+
"component": "redis_cache",
|
| 935 |
+
"telemetry": [
|
| 936 |
+
{"timestamp": time.time() - 60, "metric": "latency_p99", "value": 100},
|
| 937 |
+
{"timestamp": time.time() - 50, "metric": "latency_p99", "value": 120},
|
| 938 |
+
{"timestamp": time.time() - 40, "metric": "latency_p99", "value": 150},
|
| 939 |
+
{"timestamp": time.time() - 30, "metric": "latency_p99", "value": 300},
|
| 940 |
+
{"timestamp": time.time() - 20, "metric": "latency_p99", "value": 450},
|
| 941 |
+
{"timestamp": time.time() - 10, "metric": "latency_p99", "value": 520},
|
| 942 |
+
],
|
| 943 |
+
"context": {
|
| 944 |
+
"environment": "production",
|
| 945 |
+
"severity": "high",
|
| 946 |
+
"error_rate": 0.08,
|
| 947 |
+
}
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
arf = await get_true_arf_oss()
|
| 951 |
+
result = await arf.analyze_scenario("Test Cache Latency", scenario)
|
| 952 |
+
print("Test Result:", json.dumps(result, indent=2, default=str))
|
| 953 |
+
|
| 954 |
+
asyncio.run(test())
|