Skip to content
Merged
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
1 change: 1 addition & 0 deletions include/config/guc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern int psch_min_duration_us;
extern int psch_normalize_cache_max;
extern double psch_sample_rate;
extern bool psch_otel_arrow_passthrough;
extern bool psch_use_unified_arrow_exporter;
extern int psch_otel_max_block_bytes;
extern char* psch_extra_attributes;
extern char* psch_debug_arrow_dump_dir;
Expand Down
18 changes: 18 additions & 0 deletions src/config/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ int psch_min_duration_us = 0;
int psch_normalize_cache_max = 32768;
double psch_sample_rate = 1.0;
bool psch_otel_arrow_passthrough = false;
bool psch_use_unified_arrow_exporter = false;
int psch_otel_max_block_bytes = 3 * 1024 * 1024; // 3 MiB (max: 16 MiB)
char* psch_extra_attributes = NULL;
char* psch_debug_arrow_dump_dir = NULL;
Expand Down Expand Up @@ -356,6 +357,23 @@ void PschInitGuc(void) {
0,
NULL, NULL, NULL);

DefineCustomBoolVariable(
"pg_stat_ch.use_unified_arrow_exporter",
"Use the StatsExporter-implementing Arrow exporter instead of arrow_batch.cc.",
"When enabled together with use_otel and otel_arrow_passthrough, the bgworker "
"builds Arrow IPC via the typed StatsExporter column interface, writing the "
"events_raw schema (typed integer ids, no sprintf decimal-string encoding). "
"When off, the legacy arrow_batch.cc path runs and produces the query_logs_arrow "
"wire shape. Default off; flip on to opt a producer into the new exporter. "
"PGC_POSTMASTER: the bgworker picks the exporter implementation at init time, "
"so a runtime change would mismatch the per-cycle dispatcher (Arrow batches "
"would silently drop, since OTelArrowExporter does not implement SendArrowBatch).",
Comment on lines +368 to +370
Comment on lines +368 to +370
&psch_use_unified_arrow_exporter,
false,
PGC_POSTMASTER,
0,
NULL, NULL, NULL);
Comment on lines +360 to +375

DefineCustomIntVariable(
"pg_stat_ch.otel_max_block_bytes",
"Maximum Arrow batch size in bytes per OTLP request.",
Expand Down
12 changes: 11 additions & 1 deletion src/export/exporter_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,20 @@ class StatsExporter {
virtual int NumConsecutiveFailures() const = 0;
virtual void ResetFailures() = 0;
virtual int NumExported() const = 0;
virtual bool SendArrowBatch(const uint8_t* ipc_data, size_t ipc_len, int num_rows) {
// block_format is the discriminator emitted as the
// pg_stat_ch.block_format resource + log-record attribute on the OTLP
// request. The central OTel collector's routingconnector matches on
// it to fan to the right downstream receiver (e.g. legacy
// query_logs_arrow vs new events_raw). Callers pass an explicit value
// because Google Style forbids default arguments on virtual methods
// (the default is dispatched on the static type, not the dynamic one,
// which is a footgun for overriders).
virtual bool SendArrowBatch(const uint8_t* ipc_data, size_t ipc_len, int num_rows,
string_view block_format) {
(void)ipc_data;
(void)ipc_len;
(void)num_rows;
(void)block_format;
return false;
}

Expand Down
Loading
Loading