Commit 3efec8fe authored by Waleed Akbar's avatar Waleed Akbar
Browse files

fix: Update InfluxDBFetcher logging and adjust test parameters for analyze endpoint

parent 20279c5f
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ class InfluxDBFetcher:
        
        LOGGER.debug(f"Processed {len(metrics)} metric records with {len(available_full_cols)} columns")
        LOGGER.debug(f"Extracted {len(metric_values)} metric value records with {len(available_metric_cols)} columns")
        LOGGER.info(f"Response values are: {metric_values} ")
        
        return {
            'metrics':       metrics,
@@ -148,33 +149,6 @@ class InfluxDBFetcher:
        self,
        sla_policy: SLAPolicyConfig
    ) -> Dict[str, Any]:
        """
        Fetch performance metrics from InfluxDB.

        Queries InfluxDB for time-series performance data based on the
        SLA policy parameters and device information. The retry decorator
        ensures resilience against transient failures.
        
        If the initial query returns fewer samples than required by 
        sla_policy.forecast_sample_count, the method will automatically fetch 
        older data with an extended time window until the required 
        sample count is met or max attempts are reached.

        Args:
            sla_policy: The SLA policy configuration containing time window,
                threshold parameters, and required sample count.

        Returns:
            Dictionary containing:
                - 'metrics': List of performance metric records.
                - 'metric_values': List of metric values only.
                - 'timestamp_range': Dictionary with 'start' and 'end'
                    timestamps for the queried data.

        Raises:
            Exception: If InfluxDB is unavailable after all retries,
                or if the query fails.
        """
        
        if not self.is_connected():
            raise ConnectionError("Unable to connect to InfluxDB")
+2 −2
Original line number Diff line number Diff line
@@ -94,9 +94,9 @@ def test_analyze_endpoint(ai_engine_server):
            "latency_threshold_ms": 0,
            "bandwidth_utilization": 0.0
        },
        "history_window_size_sec":      600,
        "history_window_size_sec":      60,
        "forecast_sample_interval_sec": 5,
        "forecast_sample_count":        120,
        "forecast_sample_count":        50,
    }

    LOGGER.info(f"Sending analyze request with payload: {payload}")