Skip to content

Commit

Permalink
[Integration][Datadog] Fix SLO history configuration validation error (
Browse files Browse the repository at this point in the history
  • Loading branch information
phalbert authored Nov 28, 2024
1 parent 412e336 commit 6aee581
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion integrations/datadog/.port/resources/port-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ resources:
selector:
query: "true"
timeframe: 30
period_of_time_in_years: 12
periodOfTimeInMonths: 6
port:
entity:
mappings:
Expand Down
13 changes: 13 additions & 0 deletions integrations/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes start -->

## 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)


Expand Down
20 changes: 15 additions & 5 deletions integrations/datadog/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Selector,
)
from pydantic import Field, validator, BaseModel

from loguru import logger
from port_ocean.core.integrations.base import BaseIntegration


Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion integrations/datadog/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "datadog"
version = "0.1.57"
version = "0.1.58"
description = "Datadog Ocean Integration"
authors = ["Albert Luganga <[email protected]>"]

Expand Down

0 comments on commit 6aee581

Please sign in to comment.