mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-29 06:04:06 +00:00
* feat(postgres): Prometheus Remote Write protobuf ingest via COPY FROM STDIN COPY FROM STDIN WITH (FORMAT promwrite [, version 2] [, <options>]) ingests one Prometheus Remote Write request body over the postgres wire protocol — a GreptimeDB-specific, binary COPY format (wire format code 1). The payload is byte-for-byte the body a remote-write client POSTs to /v1/prometheus/write, compression included: buffered until CopyDone and completed through the exact ingestion core that endpoint runs. To share that core, the HTTP handlers' ingestion bodies are extracted into axum-free functions (ingest_remote_write_v1/v2 plus the context extension stamping), and the HTTP routes become thin wrappers — their behavior is unchanged, and the copy layer runs the identical decode, validation, conversion, batched/prepared write paths, per-batch write-progress accounting and context extensions, under the connection's regular postgres context. The WITH options carry what the HTTP endpoint takes as its content-type/-encoding and query parameters; session-provided values (database, user) are not repeated: - version 1|2 (default 1), matching the content-type's proto - zstd, matching Content-Encoding: zstd (snappy by default) - physical_table, matching the ?physical_table= parameter - pipeline_name/pipeline_version, matching the pipeline headers (v1 only; for v2 they are accepted and ignored, exactly like the HTTP route ignores them) Table-less like the other ingestion formats; one COPY statement is one bounded request (shared 64 MiB limit); the row count reports written rows (v1) or written samples plus histograms (v2). The flush enforces the frontend's shared request-memory quota (max_in_flight_write_bytes) — the same limiter the HTTP ingestion protocols use, so COPY cannot bypass the aggregate budget. Wiring: PostgresServer::with_prom_remote_write carries the handler, metric-engine flag, validation mode and shared memory limiter. e2e: v1 body chunked across CopyData boundaries; v2 samples with readback; physical_table option routing; garbage-body decode failure with connection reuse; a tiny-quota regression where a compressed body whose decompressed size exceeds the budget fails like the HTTP route. Signed-off-by: Ning Sun <sunning@greptime.com> * fix(servers): propagate COPY body reservations and test write accounting Signed-off-by: Ning Sun <sunning@greptime.com> * fix(postgres): share Prometheus logical batching with COPY ingestion Signed-off-by: Ning Sun <sunning@greptime.com> * refactor(postgres): narrow Prometheus COPY scope and share write outcomes Signed-off-by: Ning Sun <sunning@greptime.com> --------- Signed-off-by: Ning Sun <sunning@greptime.com> Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com>
137 lines
3.7 KiB
TOML
137 lines
3.7 KiB
TOML
[package]
|
|
name = "tests-integration"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
autotests = false
|
|
|
|
[[test]]
|
|
name = "main"
|
|
path = "tests/main.rs"
|
|
|
|
[features]
|
|
dashboard = ["servers/dashboard"]
|
|
enterprise = ["frontend/enterprise", "meta-srv/enterprise", "common-meta/enterprise"]
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
api.workspace = true
|
|
arrow-flight.workspace = true
|
|
async-trait.workspace = true
|
|
auth.workspace = true
|
|
axum.workspace = true
|
|
cache.workspace = true
|
|
catalog.workspace = true
|
|
client.workspace = true
|
|
cmd.workspace = true
|
|
common-base.workspace = true
|
|
common-catalog.workspace = true
|
|
common-config.workspace = true
|
|
common-datasource.workspace = true
|
|
common-error.workspace = true
|
|
common-event-recorder.workspace = true
|
|
common-grpc.workspace = true
|
|
common-memory-manager.workspace = true
|
|
common-meta.workspace = true
|
|
common-procedure.workspace = true
|
|
common-query.workspace = true
|
|
common-recordbatch.workspace = true
|
|
common-runtime.workspace = true
|
|
common-telemetry.workspace = true
|
|
common-test-util.workspace = true
|
|
common-time.workspace = true
|
|
common-wal.workspace = true
|
|
datanode = { workspace = true }
|
|
datatypes.workspace = true
|
|
dotenv.workspace = true
|
|
flow.workspace = true
|
|
frontend.workspace = true
|
|
futures.workspace = true
|
|
futures-util.workspace = true
|
|
http.workspace = true
|
|
hyper-util = { workspace = true, features = ["tokio"] }
|
|
meta-client.workspace = true
|
|
meta-srv = { workspace = true, features = ["mock"] }
|
|
mito2.workspace = true
|
|
object-store.workspace = true
|
|
operator.workspace = true
|
|
pipeline.workspace = true
|
|
prost.workspace = true
|
|
query.workspace = true
|
|
rand.workspace = true
|
|
serde_json.workspace = true
|
|
servers.workspace = true
|
|
session.workspace = true
|
|
sql.workspace = true
|
|
standalone.workspace = true
|
|
store-api.workspace = true
|
|
substrait.workspace = true
|
|
table.workspace = true
|
|
tempfile.workspace = true
|
|
tokio.workspace = true
|
|
tokio-stream = { workspace = true, features = ["net"] }
|
|
tonic.workspace = true
|
|
tower.workspace = true
|
|
uuid.workspace = true
|
|
|
|
[dev-dependencies]
|
|
base64.workspace = true
|
|
bytes.workspace = true
|
|
catalog = { workspace = true, features = ["testing"] }
|
|
chrono.workspace = true
|
|
clap.workspace = true
|
|
cli.workspace = true
|
|
client = { workspace = true, features = ["testing"] }
|
|
common-frontend.workspace = true
|
|
common-memory-manager.workspace = true
|
|
common-meta = { workspace = true, features = ["testing"] }
|
|
common-options.workspace = true
|
|
common-procedure-test.workspace = true
|
|
common-wal = { workspace = true, features = ["testing"] }
|
|
datafusion.workspace = true
|
|
datafusion-expr.workspace = true
|
|
either.workspace = true
|
|
flate2 = "1.0"
|
|
frontend = { workspace = true, features = ["testing"] }
|
|
hex.workspace = true
|
|
http.workspace = true
|
|
itertools.workspace = true
|
|
jsonb.workspace = true
|
|
log-query.workspace = true
|
|
loki-proto.workspace = true
|
|
mito2 = { workspace = true, features = ["test", "test-shared-fs-region-migration"] }
|
|
mysql_async = { version = "0.37", default-features = false, features = [
|
|
"time",
|
|
"default-rustls-ring",
|
|
] }
|
|
opentelemetry-proto.workspace = true
|
|
operator = { workspace = true, features = ["testing"] }
|
|
otel-arrow-rust.workspace = true
|
|
paste.workspace = true
|
|
plugins.workspace = true
|
|
prost.workspace = true
|
|
rand.workspace = true
|
|
rskafka.workspace = true
|
|
rstest.workspace = true
|
|
rstest_reuse.workspace = true
|
|
sea-query.workspace = true
|
|
servers = { workspace = true, features = ["testing"] }
|
|
similar-asserts.workspace = true
|
|
sqlx = { workspace = true, features = [
|
|
"mysql",
|
|
"mysql-rsa",
|
|
"postgres",
|
|
"chrono",
|
|
] }
|
|
store-api.workspace = true
|
|
temp-env.workspace = true
|
|
time = "0.3"
|
|
tokio-postgres = { workspace = true }
|
|
tokio-util.workspace = true
|
|
url = "2.3"
|
|
urlencoding = "2.1"
|
|
yaml-rust = "0.4"
|
|
zstd.workspace = true
|