Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/public-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ impl core::fmt::Display for posthog_rs::ClientOptionsBuilderError
pub fn posthog_rs::ClientOptionsBuilderError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
#[non_exhaustive] pub enum posthog_rs::Endpoint
pub posthog_rs::Endpoint::Capture
pub posthog_rs::Endpoint::CaptureAi
pub posthog_rs::Endpoint::Flags
pub posthog_rs::Endpoint::LocalEvaluation
impl posthog_rs::Endpoint
Expand Down Expand Up @@ -111,6 +112,7 @@ pub fn posthog_rs::CaptureExceptionOptions::trace_context<T: core::convert::Into
#[non_exhaustive] pub struct posthog_rs::CaptureFailure<'a>
impl<'a> posthog_rs::CaptureFailure<'a>
pub fn posthog_rs::CaptureFailure<'a>::attempt(&self) -> u32
pub fn posthog_rs::CaptureFailure<'a>::endpoint(&self) -> posthog_rs::Endpoint
pub fn posthog_rs::CaptureFailure<'a>::error(&self) -> core::option::Option<&posthog_rs::Error>
pub fn posthog_rs::CaptureFailure<'a>::error_response(&self) -> core::option::Option<&posthog_rs::CaptureErrorResponse>
pub fn posthog_rs::CaptureFailure<'a>::event_count(&self) -> usize
Expand All @@ -130,6 +132,10 @@ pub struct posthog_rs::Client
impl posthog_rs::Client
pub fn posthog_rs::Client::alias<P: core::convert::Into<alloc::string::String>, D: core::convert::Into<alloc::string::String>>(&self, P, D)
pub fn posthog_rs::Client::capture(&self, posthog_rs::Event)
pub fn posthog_rs::Client::capture_ai(&self, posthog_rs::Event)
pub fn posthog_rs::Client::capture_ai_batch(&self, alloc::vec::Vec<posthog_rs::Event>, bool)
pub async fn posthog_rs::Client::capture_ai_batch_immediate(&self, alloc::vec::Vec<posthog_rs::Event>, bool) -> core::result::Result<posthog_rs::CaptureSummary, posthog_rs::Error>
pub async fn posthog_rs::Client::capture_ai_immediate(&self, posthog_rs::Event) -> core::result::Result<posthog_rs::CaptureSummary, posthog_rs::Error>
pub fn posthog_rs::Client::capture_batch(&self, alloc::vec::Vec<posthog_rs::Event>, bool)
pub async fn posthog_rs::Client::capture_batch_immediate(&self, alloc::vec::Vec<posthog_rs::Event>, bool) -> core::result::Result<posthog_rs::CaptureSummary, posthog_rs::Error>
pub async fn posthog_rs::Client::capture_exception<E>(&self, &E) -> core::result::Result<(), posthog_rs::Error> where E: core::error::Error + ?core::marker::Sized
Expand All @@ -152,6 +158,8 @@ pub fn posthog_rs::ClientOptions::from((&str, &str)) -> Self
pub struct posthog_rs::ClientOptionsBuilder
impl posthog_rs::ClientOptionsBuilder
pub fn posthog_rs::ClientOptionsBuilder::api_key(&mut self, alloc::string::String) -> &mut Self
pub fn posthog_rs::ClientOptionsBuilder::capture_ai_compression(&mut self, posthog_rs::CaptureCompression) -> &mut Self
pub fn posthog_rs::ClientOptionsBuilder::capture_ai_max_queue_size(&mut self, usize) -> &mut Self
pub fn posthog_rs::ClientOptionsBuilder::capture_compression(&mut self, posthog_rs::CaptureCompression) -> &mut Self
pub fn posthog_rs::ClientOptionsBuilder::disable_geoip(&mut self, bool) -> &mut Self
pub fn posthog_rs::ClientOptionsBuilder::disabled(&mut self, bool) -> &mut Self
Expand Down Expand Up @@ -361,6 +369,7 @@ pub const posthog_rs::DEFAULT_HOST: &str
pub const posthog_rs::EU_INGESTION_ENDPOINT: &str
pub const posthog_rs::US_INGESTION_ENDPOINT: &str
pub fn posthog_rs::capture(posthog_rs::Event)
pub fn posthog_rs::capture_ai(posthog_rs::Event)
pub async fn posthog_rs::capture_exception<E>(&E) -> core::result::Result<(), posthog_rs::Error> where E: core::error::Error + ?core::marker::Sized
pub async fn posthog_rs::capture_exception_with<E>(&E, posthog_rs::CaptureExceptionOptions) -> core::result::Result<(), posthog_rs::Error> where E: core::error::Error + ?core::marker::Sized
pub async fn posthog_rs::client<C: core::convert::Into<posthog_rs::ClientOptions>>(C) -> posthog_rs::Client
Expand Down
8 changes: 8 additions & 0 deletions docs/migration-0.x-to-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ The regular `capture` and `capture_batch` methods remain fire-and-forget. They e

All event-producing SDK paths now use the same capture endpoint, including error tracking, `$feature_flag_called` events, historical migration, `before_send`, and terminal failures reported through `on_error`.

### AI events

Use the new `capture_ai` family for LLM analytics events (`$ai_generation`, `$ai_span`, `$ai_trace`, `$ai_embedding`, and the other `$ai_*` names PostHog's LLM analytics product defines). `capture_ai`, `capture_ai_batch`, `capture_ai_immediate`, `capture_ai_batch_immediate`, and the global `posthog_rs::capture_ai` mirror their analytics counterparts but post to `/i/v1/ai/events` on their own background lane, batched by size, with the backend's 8 MiB per-event ceiling applied locally. The lane has its own options: `capture_ai_compression` (unset sends AI bodies uncompressed; set `CaptureCompression::Zstd`, the best fit for large JSON) and `capture_ai_max_queue_size` (default 1000).

`capture` never reroutes by event name. Sending an AI event through `capture` worked on the V0 path because the backend diverted it; on the V1 analytics endpoint the backend will refuse it as a per-event `drop` once both lanes enforce their event sets, and it will not be ingested. Move those calls to `capture_ai`. Custom events that merely start with `$ai_` and are not PostHog AI event names stay on `capture`.

The backend decides which names belong on the AI lane and reports a misrouted or oversize event as a per-event `drop` inside a `200`. That verdict reaches an `on_error` hook (`CaptureFailure::endpoint()` says which lane) or the returned `CaptureSummary` for the immediate variants; without a hook the SDK logs one aggregate warning per batch.

### Compression

`CaptureCompression::Gzip`, `Deflate`, `Br`, and `Zstd` now all apply their corresponding `Content-Encoding`. In older default V0 builds, only gzip was supported and selecting another variant could send an uncompressed body. Check any proxy or WAF in front of PostHog before enabling Brotli or Zstandard.
Expand Down
Loading