From 6aee5811b8438d91d9216b744d4a99fb3011f589 Mon Sep 17 00:00:00 2001 From: hpal Date: Thu, 28 Nov 2024 19:54:15 +0000 Subject: [PATCH] [Integration][Datadog] Fix SLO history configuration validation error (#1192) --- .../.port/resources/port-app-config.yaml | 2 +- integrations/datadog/CHANGELOG.md | 13 ++++++++++++ integrations/datadog/overrides.py | 20 ++++++++++++++----- integrations/datadog/pyproject.toml | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/integrations/datadog/.port/resources/port-app-config.yaml b/integrations/datadog/.port/resources/port-app-config.yaml index edcc59ed7b..2b3fc85d6c 100644 --- a/integrations/datadog/.port/resources/port-app-config.yaml +++ b/integrations/datadog/.port/resources/port-app-config.yaml @@ -85,7 +85,7 @@ resources: selector: query: "true" timeframe: 30 - period_of_time_in_years: 12 + periodOfTimeInMonths: 6 port: entity: mappings: diff --git a/integrations/datadog/CHANGELOG.md b/integrations/datadog/CHANGELOG.md index 09051c9a15..3c5de5147d 100644 --- a/integrations/datadog/CHANGELOG.md +++ b/integrations/datadog/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## 0.1.58 (2024-11-28) + + +### Bug Fixes + +- Fixed SLO history configuration parsing and improved error handling: + - Added descriptive field documentation for configuration parameters + - Changed validation to use warnings instead of errors + - Fixed field alias to match schema + - Added detailed warning messages for troubleshooting + - Updated default period from 12 to 6 months for better performance + + ## 0.1.57 (2024-11-25) diff --git a/integrations/datadog/overrides.py b/integrations/datadog/overrides.py index cc916a1bfd..afe90ec6b3 100644 --- a/integrations/datadog/overrides.py +++ b/integrations/datadog/overrides.py @@ -7,7 +7,7 @@ Selector, ) from pydantic import Field, validator, BaseModel - +from loguru import logger from port_ocean.core.integrations.base import BaseIntegration @@ -18,13 +18,23 @@ class SLOHistorySelector(Selector): @validator("timeframe") def validate_timeframe_field(cls, v: int) -> int: if v < 1: - raise ValueError("timeframe must be greater than 0") + logger.warning( + f"The selector value 'timeframe' ({v}) must be greater than 0. " + f"This value determines the time window in days for each SLO history data point. " + f"Using default value of 7 days." + ) + return 7 return v @validator("period_of_time_in_months") - def validate_period_of_time_in_years(cls, v: int) -> int: - if v > 1: - raise ValueError("period_of_time_in_months must be less or equal to 12") + def validate_period_of_time_in_months(cls, v: int) -> int: + if v < 1 or v > 12: + logger.warning( + f"The selector value 'periodOfTimeInMonths' ({v}) must be between 1 and 12. " + f"This value determines how far back in time to fetch SLO history. " + f"Using default value of 6 months." + ) + return 6 return v diff --git a/integrations/datadog/pyproject.toml b/integrations/datadog/pyproject.toml index 441ce463aa..1054fd9834 100644 --- a/integrations/datadog/pyproject.toml +++ b/integrations/datadog/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "datadog" -version = "0.1.57" +version = "0.1.58" description = "Datadog Ocean Integration" authors = ["Albert Luganga "]