Skip to content

Commit 8a646cb

Browse files
proxy: add request context for observability and blocking (#6160)
## Summary of changes ### RequestMonitoring We want to add an event stream with information on each request for easier analysis than what we can do with diagnostic logs alone (neondatabase/cloud#8807). This RequestMonitoring will keep a record of the final state of a request. On drop it will be pushed into a queue to be uploaded. Because this context is a bag of data, I don't want this information to impact logic of request handling. I personally think that weakly typed data (such as all these options) makes for spaghetti code. I will however allow for this data to impact rate-limiting and blocking of requests, as this does not _really_ change how a request is handled. ### Parquet Each `RequestMonitoring` is flushed into a channel where it is converted into `RequestData`, which is accumulated into parquet files. Each file will have a certain number of rows per row group, and several row groups will eventually fill up the file, which we then upload to S3. We will also upload smaller files if they take too long to construct.
1 parent a4ac8e2 commit 8a646cb

25 files changed

+1209
-249
lines changed

Cargo.lock

Lines changed: 142 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ opentelemetry = "0.19.0"
107107
opentelemetry-otlp = { version = "0.12.0", default_features=false, features = ["http-proto", "trace", "http", "reqwest-client"] }
108108
opentelemetry-semantic-conventions = "0.11.0"
109109
parking_lot = "0.12"
110+
parquet = { version = "49.0.0", default-features = false, features = ["zstd"] }
111+
parquet_derive = "49.0.0"
110112
pbkdf2 = { version = "0.12.1", features = ["simple", "std"] }
111113
pin-project-lite = "0.2"
112114
prometheus = {version = "0.13", default_features=false, features = ["process"]} # removes protobuf dependency
@@ -161,7 +163,7 @@ tracing-error = "0.2.0"
161163
tracing-opentelemetry = "0.19.0"
162164
tracing-subscriber = { version = "0.3", default_features = false, features = ["smallvec", "fmt", "tracing-log", "std", "env-filter", "json"] }
163165
url = "2.2"
164-
uuid = { version = "1.2", features = ["v4", "serde"] }
166+
uuid = { version = "1.6.1", features = ["v4", "v7", "serde"] }
165167
walkdir = "2.3.2"
166168
webpki-roots = "0.25"
167169
x509-parser = "0.15"
@@ -215,6 +217,10 @@ tonic-build = "0.9"
215217
# TODO: we should probably fork `tokio-postgres-rustls` instead.
216218
tokio-postgres = { git = "https://github.com/neondatabase/rust-postgres.git", branch="neon" }
217219

220+
# bug fixes for UUID
221+
parquet = { git = "https://github.com/neondatabase/arrow-rs", branch = "neon-fix-bugs" }
222+
parquet_derive = { git = "https://github.com/neondatabase/arrow-rs", branch = "neon-fix-bugs" }
223+
218224
################# Binary contents sections
219225

220226
[profile.release]

proxy/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition.workspace = true
55
license.workspace = true
66

77
[features]
8-
default = []
8+
default = ["testing"]
99
testing = []
1010

1111
[dependencies]
@@ -14,6 +14,7 @@ async-trait.workspace = true
1414
base64.workspace = true
1515
bstr.workspace = true
1616
bytes = { workspace = true, features = ["serde"] }
17+
camino.workspace = true
1718
chrono.workspace = true
1819
clap.workspace = true
1920
consumption_metrics.workspace = true
@@ -35,13 +36,16 @@ metrics.workspace = true
3536
once_cell.workspace = true
3637
opentelemetry.workspace = true
3738
parking_lot.workspace = true
39+
parquet.workspace = true
40+
parquet_derive.workspace = true
3841
pbkdf2 = { workspace = true, features = ["simple", "std"] }
3942
pin-project-lite.workspace = true
4043
postgres_backend.workspace = true
4144
pq_proto.workspace = true
4245
prometheus.workspace = true
4346
rand.workspace = true
4447
regex.workspace = true
48+
remote_storage = { version = "0.1", path = "../libs/remote_storage/" }
4549
reqwest = { workspace = true, features = ["json"] }
4650
reqwest-middleware.workspace = true
4751
reqwest-retry.workspace = true
@@ -80,6 +84,7 @@ smol_str.workspace = true
8084
workspace_hack.workspace = true
8185

8286
[dev-dependencies]
87+
camino-tempfile.workspace = true
8388
rcgen.workspace = true
8489
rstest.workspace = true
8590
tokio-postgres-rustls.workspace = true

0 commit comments

Comments
 (0)