thinkingdata-core
Core implementation of the ThinkingData Analytics Rust SDK: the wire-format data model, input validation, diagnostics logging, and the log/batch/debug consumers ported from the official Go SDK.
You normally do not depend on this crate directly — use the
thinkingdata facade, which re-exports everything and adds
the CLI. Depend on thinkingdata-core when you want the library pieces without the CLI dependency
tree.
Modules
| Module | Contents |
|---|---|
data |
Data wire model (#account_id, #type, properties, …), DataType, preset-key hoisting, PRESET_PROPERTIES, IntoPropertyMap |
consumer |
Consumer (blocking) / AsyncConsumer (async) traits and the three consumers |
analytics |
TDAnalytics (blocking) and TDAnalyticsAsync facades with super & dynamic super properties |
log |
TDLogLevel, pluggable TDLogger |
utils |
key pattern validation, RFC 3339 rewriting (parse_time), TE v5.0 value limits (check_value_limits), jiff timestamps |
error |
TDError / Result |
Consumers
LogConsumer— NDJSON files for LogBus; daily/hourly rotation, size-based paging with index restore on restart; a streaming MPSC writer task owns all file I/O.BatchConsumer— buffered upload to/sync_server; gzip compression, three retries on non-200 responses, bounded failure cache, optional auto-flush timer; a single sender task serializes deliveries.DebugConsumer— per-event validation against/data_debug(dry-run supported); stringent mode enforces property keys and the documented value limits.
Feature flags
| Feature | API |
|---|---|
blocking (default) |
Consumer trait, TDAnalytics, blocking consumer methods |
async |
AsyncConsumer trait, TDAnalyticsAsync, *_async methods on Tokio streaming pipelines |
| both | every consumer implements both traits |
TE v5.0 validation
use ;
use PRESET_PROPERTIES;
check_value_limits?;
data.check_limits?; // #time format, ID length (<=128), and every value
See the bilingual guides for the full rule set: data rules and preset properties (中文 versions alongside).
Notes
- Timestamps are produced with
jiff;chronois intentionally not used. - TLS: rustls with the aws-lc-rs provider as the only TLS backend (reqwest 0.13 defaults); no native-tls/openssl backend is compiled in.
- Unit tests plus mock-receiver integration tests cover every consumer, the analytics facades and the crate-level feature combinations.
License
Apache-2.0