-
Notifications
You must be signed in to change notification settings - Fork 893
feat(docs): document OpenTelemetry limits on large AI events page #19799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9e0c450
20d57fa
84b829a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,25 @@ Not on Python or Node? Build events with [manual capture](/docs/ai-observability | |
| POST <ph_client_api_host>/i/v0/ai/batch/ | ||
| ``` | ||
|
|
||
| ## Sending over OpenTelemetry | ||
|
|
||
| If you send AI traces with [OpenTelemetry](/docs/ai-observability/installation/opentelemetry), your spans arrive over OTLP at a dedicated path: | ||
|
|
||
| ```shell | ||
| POST <ph_client_api_host>/i/v0/ai/otel | ||
| ``` | ||
|
|
||
| Two size limits apply on this path: | ||
|
|
||
| - **4MB per export.** PostHog accepts an OTLP export body up to 4MB. This cap is lower than the per-event ceiling, so a batch of spans can exceed it before any single span does. | ||
| - **8MB per event.** Each span becomes one AI event, held to the same 8MB ceiling as the other paths. | ||
|
|
||
| An export or span over these limits is dropped, but the request still returns success. A failure response would only make your collector retry the same oversize data, so PostHog accepts the request and discards what does not fit. The only signal is a `MessageSizeTooLarge` [ingestion warning](/docs/data/ingestion-warnings) – your application gets no error, and the data is lost silently. | ||
|
|
||
| To stay under the 4MB export cap, add the [`batch` processor](https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/batchprocessor/README.md) to your collector and set a small `send_batch_max_size`, so it splits large batches into smaller exports. For a single span that is too large on its own, capture it with [`capture_ai`](#calling-capture_ai-directly) instead. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A small maximum batch size can make the Collector configuration invalidWhy we think it's a valid issue
Issue descriptionThe Collector defaults Suggested fixShow a configuration that sets both values. State that Prompt to fix with AI (copy-paste)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The batch processor cannot enforce the 4 MiB byte limitWhy we think it's a valid issue
Issue description
Suggested fixState that this setting only reduces the risk of oversized exports. Tell users to measure encoded export sizes and choose a count from their largest normal span. Recommend Prompt to fix with AI (copy-paste) |
||
|
|
||
| ## Limits | ||
|
|
||
| Events up to **8MB** are accepted for now. The SDKs drop larger events before sending and log an error instead. The limit will increase as the beta continues. | ||
|
|
||
| Over [OpenTelemetry](#sending-over-opentelemetry), a lower **4MB** per-export cap also applies, and oversize data is dropped without an application error. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 4 MiB export limit does not return success
Why we think it's a valid issue
rust/capture/src/otel/mod.rsin PostHog/posthog, plus the body extractor, the gzip decompressor, and theCaptureErrorto HTTP status map.otel/mod.rs:36setsOTEL_BODY_SIZE = 4 * 1024 * 1024.otel/mod.rs:77-88passes it toextract_body_with_timeoutand returnsErr(e.into_response())on failure.extractors.rs:176-193raisesCaptureError::EventTooBigwhen the body passes the limit, andapi.rs:170-172mapsEventTooBigtoStatusCode::PAYLOAD_TOO_LARGE. A body over 4MB therefore gets HTTP 413, not success.otel/ingestion.rs:61-62callsdecompress_gzip_to_bytes(body, body_limit)withOTEL_BODY_SIZE, andpayload/decompression.rs:54-64raisesEventTooBigwhen the decompressed size passes the limit, which is again 413.otel/mod.rs:298-310usesretainto shed spans overstate.ai_max_event_bytes, emitsemit_span_too_big_warning, and lets the handler continue toOk(Json(json!({})))at line 361. The comment atotel/mod.rs:286-297states this divergence directly: "Shed spans past the deployment's per-event ceiling rather than refusing the export."MessageSizeTooLargewarning comes from the 4MB rejection. The body-read failure path atotel/mod.rs:85-88calls onlyreport_internal_error_metrics, with noingestion_warning_emitter. The gzip path atotel/mod.rs:157-168emitsemit_otel_parse_warning, which is a parse warning and notMessageSizeTooLarge.large-events.mdx:120("An export or span over these limits is dropped, but the request still returns success"),large-events.mdx:128("oversize data is dropped without an application error"), andinstallation/opentelemetry.mdx:59("Oversize data is dropped without an application error"). A sender that passes 4MB does get an error and must handle the 413. The page tells that sender the loss is silent and directs them to hunt for aMessageSizeTooLargewarning that the 4MB path never writes. The page also gives the same advice for both limits, so the reader cannot tell which limit produces which behavior. The silent-loss claim, which is the reason the section exists, holds for the 8MB per-span ceiling alone.Issue description
The OTLP handler returns HTTP 413 when the request body exceeds 4 MiB. It also returns 413 when gzip expands past 4 MiB. Only a converted event over 8 MiB is dropped while the export returns 200. The initial body-size rejection also cannot create an ingestion warning.
Suggested fix
Describe the cases separately. State that a body over 4 MiB rejects the complete export with HTTP 413. State that an event over 8 MiB drops only that span, returns 200, and creates
MessageSizeTooLarge. Update the installation callout and the Limits note with the same distinction.Prompt to fix with AI (copy-paste)