Skip to content

Commit 8c71639

Browse files
committed
postgres data-observability - default startup lookback to 300s, trim description
Bumps cron startup recovery window from 60s to 5 minutes (300s) so longer scheduler gaps don't drop fires, and removes the implementation-specific note about the Cluster Agent rebalancing pods from the user-facing config description. Signed-off-by: mobuchowski <maciej.obuchowski@datadoghq.com>
1 parent 21a4211 commit 8c71639

4 files changed

Lines changed: 10 additions & 14 deletions

File tree

postgres/assets/configuration/spec.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,12 @@ files:
602602
Lookback window for cron-scheduled queries on check startup. If the
603603
most recent scheduled tick was within this many seconds before the
604604
check started, the query fires immediately on startup to recover
605-
fires that may have been lost across a check restart (for example,
606-
when the Cluster Agent rebalances checks across pods). Larger
607-
values trade higher duplicate-fire rate for fewer missed fires.
605+
fires that may have been lost across a check restart.
608606
Set to 0 to disable startup recovery.
609607
value:
610608
type: integer
611-
example: 60
612-
display_default: 60
609+
example: 300
610+
display_default: 300
613611
- name: run_sync
614612
hidden: true
615613
description: Run the job synchronously (for testing).

postgres/datadog_checks/postgres/data/conf.yaml.example

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,14 @@ instances:
465465
#
466466
# collection_interval: 10
467467

468-
## @param cron_startup_lookback_seconds - integer - optional - default: 60
468+
## @param cron_startup_lookback_seconds - integer - optional - default: 300
469469
## Lookback window for cron-scheduled queries on check startup. If the
470470
## most recent scheduled tick was within this many seconds before the
471471
## check started, the query fires immediately on startup to recover
472-
## fires that may have been lost across a check restart (for example,
473-
## when the Cluster Agent rebalances checks across pods). Larger
474-
## values trade higher duplicate-fire rate for fewer missed fires.
472+
## fires that may have been lost across a check restart.
475473
## Set to 0 to disable startup recovery.
476474
#
477-
# cron_startup_lookback_seconds: 60
475+
# cron_startup_lookback_seconds: 300
478476

479477
## @param pg_stat_statements_view - string - optional - default: pg_stat_statements
480478
## Set this value if you want to define a custom view or function to allow the datadog user to query the

postgres/datadog_checks/postgres/data_observability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Cap the number of rows fetched per query to prevent unbounded memory usage.
2222
MAX_RESULT_ROWS = 10_000
2323

24-
DEFAULT_CRON_STARTUP_LOOKBACK_SECONDS = 60
24+
DEFAULT_CRON_STARTUP_LOOKBACK_SECONDS = 300
2525

2626

2727
class PostgresDataObservability(DBMAsyncJob):

postgres/tests/test_data_observability.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ def _make_cron_lookback_check(pg_instance, lookback_seconds, queries=None):
880880

881881
def test_cron_startup_lookback_recovers_missed_fire(pg_instance, aggregator, monkeypatch):
882882
"""A first-sight cron query whose previous tick falls within the lookback window fires immediately."""
883-
# 00:50:10 — 10s after the 00:50 tick, well inside the default 60s lookback window.
883+
# 00:50:10 — 10s after the 00:50 tick, well inside the default 300s lookback window.
884884
current_time = [float(_BASE_EPOCH + 70)]
885885
monkeypatch.setattr('datadog_checks.postgres.data_observability.time.time', lambda: current_time[0])
886886

@@ -909,8 +909,8 @@ def test_cron_startup_lookback_disabled_skips_recovery(pg_instance, aggregator,
909909

910910
def test_cron_startup_lookback_outside_window_skips(pg_instance, aggregator, monkeypatch):
911911
"""A pod starting well past the lookback window does not over-fire."""
912-
# 00:51:3090s after the 00:50 tick, beyond the default 60s lookback.
913-
current_time = [float(_BASE_EPOCH + 150)]
912+
# 00:55:40340s after the 00:50 tick, beyond the default 300s lookback.
913+
current_time = [float(_BASE_EPOCH + 400)]
914914
monkeypatch.setattr('datadog_checks.postgres.data_observability.time.time', lambda: current_time[0])
915915

916916
mock_conn, _ = _make_mock_conn()

0 commit comments

Comments
 (0)