Skip to main content

Module otlp

Module otlp 

Source
Expand description

The otlp format for COPY FROM STDIN: one binary OTLP payload for any of the three signals — ExportMetricsServiceRequest, ExportTraceServiceRequest or ExportLogsServiceRequest.

COPY FROM STDIN WITH (FORMAT otlp [, signal 'traces'] [, <options>]) is a GreptimeDB-specific, binary format (wire format code 1). Metrics are table-less; traces and logs also accept COPY [catalog.][schema.]table FROM STDIN. For those signals the destination precedence is WITH (table_name ...), then the COPY target’s table name, then the signal’s default table. A qualified COPY target sets the catalog/schema even when table_name overrides its table name. Targets need not exist before ingestion. Column lists are not supported: the payload determines the ingested columns. A target that leaves the session’s catalog/schema is subject to the same disallow_cross_catalog_query restriction as SQL INSERT and the csv format, and the user provider must authorize the target scope — the same UserProvider::authorize check a login to that database would run — before any data is transferred.

This format does not decode here: the whole payload is buffered until CopyDone — exactly like an OTLP/HTTP request body — then decoded and completed through the frontend’s OpenTelemetryProtocolHandler, the same path the /v1/otlp/v1/{metrics,traces,logs} endpoints use, under the connection’s regular postgres query context.

The WITH options carry what the HTTP endpoints take as request headers; values already provided by the postgres session (database, user, permissions) are not repeated. Option semantics, defaults and parsing helpers are shared with the HTTP extractors (truthy, SelectInfo, GreptimePipelineParams, PipelineWay), so the two ingestion routes cannot drift.

One COPY statement is one bounded ingestion request (see crate::postgres::copy_in::COPY_IN_MAX_PAYLOAD_BYTES).

Structs§

OtlpOptions 🔒
The format’s validated options: the signal and its header-equivalent configuration, carried to the flush that completes the copy.

Enums§

OtlpSignal 🔒

Functions§

build_otlp_codec 🔒
take_truthy 🔒
Takes a boolean option with the HTTP header’s exact truthy spellings (true, 1, yes, on, t), plus the COPY forms (bare flag or TRUE/FALSE), so both routes accept the same values.