Skip to content

Sinks Batching Delay is only applied for postgres sink #821

@0xgouda

Description

@0xgouda

Describe the bug
Sinks max Batching delay for flushing the measurements is only applied to the postgres sink

To Reproduce
Steps to reproduce the behavior:

  1. go run ./cmd/pgwatch --sources=postgres://postgres:postgres@localhost:5432/postgres --sink=rpc://localhost:1234 --batching-delay 5m --sink=jsonfile://file.json
  2. use basic preset for the monitored database
  3. the logs will show peridoical writes every 1 minute (metric interval for basic preset) without consideration for the provided batching delay

Screenshots

go run ./cmd/pgwatch --sources=postgres://postgres:postgres@localhost:5432/postgres --sink=rpc://localhost:1234 --batching-delay 5m --sink=jsonfile://file.json
2025-06-25 15:50:22.955 [INFO] [sources:1] sources refreshed
2025-06-25 15:50:22.957 [INFO] [metrics:74] [presets:16] metrics and presets refreshed
2025-06-25 15:50:22.968 [INFO] [source:books344] [recovery:false] Connect OK. Version: PostgreSQL 16.9 (Ubuntu 16.9-0ubuntu0.24.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, 64-bit
2025-06-25 15:50:22.968 [INFO] [source:books344] [metric:wal] [interval:60] starting gatherer
2025-06-25 15:50:22.968 [INFO] [source:books344] [metric:db_size] [interval:300] starting gatherer
2025-06-25 15:50:22.968 [INFO] [source:books344] [metric:db_stats] [interval:60] starting gatherer
2025-06-25 15:50:22.969 [INFO] [source:books344] [metric:wal] [rows:1] [cache:false] measurements fetched
2025-06-25 15:50:22.969 [INFO] [sink:jsonfile] [filename:file.json] [rows:1] [elapsed:111.749µs] measurements written
2025-06-25 15:50:22.979 [INFO] [source:books344] [metric:db_stats] [rows:1] [cache:false] measurements fetched
2025-06-25 15:50:22.979 [INFO] [sink:jsonfile] [filename:file.json] [rows:1] [elapsed:48.327µs] measurements written
2025-06-25 15:50:22.980 [INFO] [source:books344] [metric:db_size] [rows:1] [cache:false] measurements fetched
2025-06-25 15:50:22.980 [INFO] [sink:jsonfile] [filename:file.json] [rows:1] [elapsed:25.478µs] measurements written
2025-06-25 15:51:23.002 [INFO] [source:books344] [metric:wal] [rows:1] [cache:false] measurements fetched
2025-06-25 15:51:23.003 [INFO] [sink:jsonfile] [filename:file.json] [rows:1] [elapsed:127.333µs] measurements written
2025-06-25 15:51:23.005 [INFO] [source:books344] [metric:db_stats] [rows:1] [cache:false] measurements fetched
2025-06-25 15:51:23.005 [INFO] [sink:jsonfile] [filename:file.json] [rows:1] [elapsed:48.533µs] measurements written

Additional context
inpsecting the codebase you will notice that opts.BatchingDelay is only used in postgres sink

Metadata

Metadata

Assignees

Labels

sinksWhere and how to store monitored datawontfixThis will not be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions