Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

perf(usage): drop the team_id partition key on usage records (#88485)

Ben Whitedd2765fbb9ae
diff --git a/rust/usage-ingestion/src/service.rs b/rust/usage-ingestion/src/service.rs
index 69bb0debe4c4..6e8ada5ce454 100644
--- a/rust/usage-ingestion/src/service.rs
+++ b/rust/usage-ingestion/src/service.rs
@@ -94,10 +94,10 @@ impl UsageIngestion for UsageIngestionService {
.iter()
.map(|record| record.record_id.clone())
.collect::<Vec<_>>();
+ // No key: nothing downstream reads per-team order, and a team key crowds one partition.
let payloads = prepared.into_iter().map(|record| {
- let key = Some(record.team_id.to_string());
serde_json::to_vec(&record)
- .map(|payload| (key, payload))
+ .map(|payload| (None, payload))
.map_err(|error| {
Status::internal(format!("failed to encode usage record: {error}"))
})