Skip to main content

Module analytics

Module analytics 

Source
Expand description

Analytics service - public API for event logging

This module serves as the main entry point for analytics events.

DESIGN: This module has NO dependencies to avoid import cycles. Events are queued until attach_analytics_sink() is called during app initialization. The sink handles routing to Datadog and 1P event logging.

Re-exports§

pub use config::*;
pub use datadog::*;
pub use first_party_event_logger::*;
pub use first_party_event_logging_exporter::*;
pub use growthbook::*;
pub use metadata::*;
pub use sink::*;
pub use sink_killswitch::*;

Modules§

config
datadog
first_party_event_logger
first_party_event_logging_exporter
growthbook
metadata
sink
sink_killswitch

Traits§

AnalyticsSink
Sink interface for the analytics backend

Functions§

attach_analytics_sink
Attach the analytics sink that will receive all events. Queued events are drained asynchronously via microtask to avoid adding latency to the startup path.
log_event
Log an event to analytics backends (synchronous)
log_event_async
Log an event to analytics backends (asynchronous)
reset_for_testing
Reset analytics state for testing purposes only.
strip_proto_fields
Strip _PROTO_* keys from a payload destined for general-access storage. Used by sink.rs before Datadog fanout and first_party_event_logging_exporter for defensive stripping after hoisting known PROTO* keys.

Type Aliases§

AnalyticsMetadataPiiTagged
Marker type for values routed to PII-tagged proto columns
AnalyticsMetadataVerified
Marker type for verifying analytics metadata doesn’t contain sensitive data This type forces explicit verification that string values being logged don’t contain code snippets, file paths, or other sensitive information. Usage: my_string as AnalyticsMetadataVerified
LogEventMetadata
Log event metadata type