Crates.io | traqq |
lib.rs | traqq |
version | 0.1.3 |
source | src |
created_at | 2024-11-03 07:43:18.870648 |
updated_at | 2024-11-03 09:03:25.853281 |
description | High-performance event processing system for Redis data indexing |
homepage | |
repository | https://github.com/oeo/traqq |
max_upload_size | |
id | 1433452 |
size | 112,386 |
A high-performance event processing system that transforms JSON events into optimized Redis commands for real-time analytics, enabling complex queries without post-processing.
PC: Apple M2 Max 2023 64GB
See main.rs for a basic usage demonstration.
use traqq::prelude::*;
let config = TraqqConfig::default();
let event = IncomingEvent::from_json(serde_json::json!({
"event": "purchase",
"amount": 99.99,
"ip": "127.0.0.1",
"utm_source": "google",
"utm_medium": "cpc"
})).unwrap();
match ProcessedEvent::from_incoming(event, &config) {
Ok(processed) => processed.pretty_print(),
Err(e) => println!("Error: {}", e),
}
[dependencies]
traqq = "0.1.3"
# run unit tests
cargo test
# run tests w benchmarking output
cargo test -- --nocapture
# run example
cargo run
TraqqConfig {
time: TimeConfig {
store_hourly: true,
timezone: "America/New_York".to_string(),
},
mapping: MappingConfig {
bitmap: vec!["ip".to_string()],
add: vec!["event".to_string()],
add_value: vec![/* value metrics */],
},
limits: LimitsConfig {
max_field_length: 128,
max_value_length: 512,
max_combinations: 1000,
max_metrics_per_event: 1000,
},
}
<metric_type>:<bucket_type>:<timestamp>:<pattern>:<values>
PFADD bmp:d:1696118400:ip 127.0.0.1
INCR add:d:1696118400:event:purchase
INCRBY adv:d:1696118400:amount:event:purchase 99.99
TraqqConfig
, IncomingEvent
, ProcessedEvent
, RedisCommand
, RedisCommandType
constants.rs
, utils.rs
MIT