Skip to content
Draft
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
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ target_link_libraries(pg_stat_ch PRIVATE
PostgreSQLServer::PostgreSQLServer
opentelemetry-cpp::api
opentelemetry-cpp::sdk
opentelemetry-cpp::otlp_grpc_metrics_exporter
opentelemetry-cpp::otlp_grpc_log_record_exporter
opentelemetry-cpp::otlp_http_log_record_exporter
opentelemetry-cpp::metrics
opentelemetry-cpp::logs
Arrow::arrow_static
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.otel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
volumes:
- ./otel/collector-config.yaml:/etc/otelcol-contrib/config.yaml
ports:
- "4317:4317" # gRPC OTLP receiver (matches psch_otel_endpoint default)
- "4318:4318" # HTTP OTLP receiver (matches psch_otel_endpoint default)
- "9091:9090" # Prometheus metrics exporter (host:9091 → container:9090)
- "13133:13133" # Health check HTTP endpoint
healthcheck:
Expand Down
4 changes: 2 additions & 2 deletions docker/otel/collector-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318

exporters:
# Expose received metrics as Prometheus for test assertions
Expand Down
16 changes: 8 additions & 8 deletions src/config/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int psch_batch_max = 200000;
int psch_log_min_elevel = WARNING;
int psch_otel_log_queue_size = 65536;
int psch_otel_log_batch_size = 8192;
int psch_otel_log_max_bytes = 3 * 1024 * 1024; // 3 MiB: gRPC default max is 4 MiB
int psch_otel_log_max_bytes = 3 * 1024 * 1024; // 3 MiB: stay under collector body limits
int psch_otel_log_delay_ms = 100;
int psch_otel_metric_interval_ms = 5000;
bool psch_debug_force_locked_overflow = false;
Expand Down Expand Up @@ -175,10 +175,10 @@ void PschInitGuc(void) {

DefineCustomStringVariable(
"pg_stat_ch.otel_endpoint",
"OpenTelemetry gRPC endpoint (host:port).",
"OpenTelemetry OTLP/HTTP logs URL.",
NULL,
&psch_otel_endpoint,
"localhost:4317",
"http://localhost:4318/v1/logs",
PGC_POSTMASTER,
0,
NULL, NULL, NULL);
Expand Down Expand Up @@ -254,7 +254,7 @@ void PschInitGuc(void) {
"pg_stat_ch.otel_log_batch_size",
"Maximum records per OTLP log export call.",
"Caps how many log records the direct OTLP exporter puts into a single "
"gRPC ExportLogs request.",
"ExportLogs request.",
&psch_otel_log_batch_size,
8192, // bootValue
1, 131072, // min, max
Expand All @@ -266,7 +266,7 @@ void PschInitGuc(void) {
"pg_stat_ch.otel_log_max_bytes",
"Soft byte budget for a single OTLP log export call.",
"The direct OTLP exporter chunks log records to stay under this per-request "
"budget. The gRPC default is 4 MiB; the default leaves a safety margin.",
"budget. Collector receivers cap request bodies; the default leaves a safety margin.",
&psch_otel_log_max_bytes,
3 * 1024 * 1024, // bootValue: 3 MiB
65536, 64 * 1024 * 1024, // min: 64 KiB, max: 64 MiB
Expand All @@ -277,7 +277,7 @@ void PschInitGuc(void) {
DefineCustomIntVariable(
"pg_stat_ch.otel_log_delay_ms",
"Deadline in milliseconds for a single OTLP log export call.",
"The direct OTLP exporter uses this as the per-request gRPC timeout so "
"The direct OTLP exporter uses this as the per-request HTTP timeout so "
"the bgworker cannot block indefinitely on a slow collector.",
&psch_otel_log_delay_ms,
100, // bootValue
Expand Down Expand Up @@ -361,7 +361,7 @@ void PschInitGuc(void) {
"Maximum Arrow batch size in bytes per OTLP request.",
"Controls the soft byte budget (estimated, pre-compression) for a single "
"Arrow IPC batch before it is flushed. ZSTD compression typically shrinks "
"the payload 20-30x, so this budget can safely exceed the gRPC wire limit.",
"the payload 20-30x, so the on-wire request stays far smaller.",
&psch_otel_max_block_bytes,
3 * 1024 * 1024, // bootValue: 3 MiB
65536, 16 * 1024 * 1024, // min: 64 KiB, max: 16 MiB
Expand All @@ -382,7 +382,7 @@ void PschInitGuc(void) {

DefineCustomStringVariable(
"pg_stat_ch.debug_arrow_dump_dir",
"Directory for dumping raw Arrow IPC payloads before gRPC send.",
"Directory for dumping raw Arrow IPC payloads before OTLP send.",
"When non-empty, each Arrow IPC payload is written to this directory before "
"being sent through OTLP. Intended for test validation and debugging only.",
&psch_debug_arrow_dump_dir,
Expand Down
2 changes: 1 addition & 1 deletion src/export/exporter_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class StatsExporter {
};

// Bridge functions for PG logging from files that cannot include postgres.h
// (e.g. otel_exporter.cc conflicts with libintl.h via gRPC headers).
// (e.g. otel_exporter.cc conflicts with libintl.h via Arrow/protobuf headers).
void LogNegativeValue(const std::string& column_name, int64_t value);
void LogExporterWarning(const char* context, const char* message);
void RecordExporterFailure(const char* message);
Expand Down
Loading
Loading