Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"abstract": "PostgreSQL Query Telemetry Exporter to ClickHouse",
"docfile": "README.md",
"file": "pg_stat_ch.control",
"version": "0.3.11"
"version": "0.4.0"
}
},
"resources": {
Expand All @@ -49,5 +49,5 @@
"metrics",
"clickhouse"
],
"version": "0.3.11"
"version": "0.4.0"
}
2 changes: 1 addition & 1 deletion pg_stat_ch.control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
comment = 'Query telemetry exporter to ClickHouse'
default_version = '0.3'
default_version = '0.4'
module_pathname = '$libdir/pg_stat_ch'
relocatable = false
14 changes: 14 additions & 0 deletions sql/pg_stat_ch--0.3--0.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
\echo Use "ALTER EXTENSION pg_stat_ch UPDATE TO '0.4'" to load this file. \quit

-- 0.4 is a no-op on the Postgres side: no functions, types, or other SQL
-- objects changed. The default_version bump exists purely so
-- `ALTER EXTENSION pg_stat_ch UPDATE` has a migration path to follow —
-- without this file, an install pinned at extversion='0.3' would have no
-- way to reach '0.4' once that becomes the control file's default_version.
--
-- What actually changed in this release lives entirely on the ClickHouse
-- side: the exporter can now write to a new unified `events_raw` schema
-- (see schema/migrations/) via the `pg_stat_ch.use_unified_arrow_exporter`
-- GUC, replacing the legacy `query_logs_arrow` wire shape. That's an
-- opt-in producer/schema change, not a change to this extension's SQL
-- interface, so there's nothing to migrate here.
50 changes: 50 additions & 0 deletions sql/pg_stat_ch--0.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- pg_stat_ch extension SQL definitions

-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_stat_ch" to load this file. \quit

-- Version function
CREATE FUNCTION pg_stat_ch_version()
RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;

COMMENT ON FUNCTION pg_stat_ch_version()
IS 'Returns the pg_stat_ch extension version';

-- Stats function (11 columns)
CREATE FUNCTION pg_stat_ch_stats(
OUT enqueued_events bigint,
OUT dropped_events bigint,
OUT exported_events bigint,
OUT send_failures bigint,
OUT last_success_ts timestamptz,
OUT last_error_text text,
OUT last_error_ts timestamptz,
OUT queue_size integer,
OUT queue_capacity integer,
OUT queue_usage_pct double precision,
OUT dsa_oom_count bigint
)
RETURNS record
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;

COMMENT ON FUNCTION pg_stat_ch_stats()
IS 'Returns pg_stat_ch queue and exporter statistics';

-- Reset function
CREATE FUNCTION pg_stat_ch_reset() RETURNS void
AS 'MODULE_PATHNAME', 'pg_stat_ch_reset'
LANGUAGE C STRICT;

COMMENT ON FUNCTION pg_stat_ch_reset()
IS 'Resets all pg_stat_ch queue counters to zero';

-- Flush function (trigger immediate export)
CREATE FUNCTION pg_stat_ch_flush() RETURNS void
AS 'MODULE_PATHNAME', 'pg_stat_ch_flush'
LANGUAGE C STRICT;

COMMENT ON FUNCTION pg_stat_ch_flush()
IS 'Trigger immediate flush of queued events to ClickHouse';
Loading