fluidattacks-tracks 0.0.1

Rust library for usage analytics
Documentation

fluidattacks-tracks

crates.io

This library provides a convenient way to report usage analytics from any Rust application.

All publish operations run in a background thread, and errors are silently swallowed so that tracking failures never interrupt your application's normal flow.

Usage

[dependencies]
fluidattacks-tracks = "0.1"
use chrono::Utc;
use fluidattacks_tracks::Tracks;
use fluidattacks_tracks::resources::event::{Action, Event, Mechanism};

let client = Tracks::new();
client.event.create(Event {
    action: Action::Create,
    author: "author@example.com".to_string(),
    date: Utc::now(),
    mechanism: Mechanism::Api,
    metadata: fluidattacks_tracks::serde_json::json!({"foo": "bar"}),
    object: "object".to_string(),
    object_id: "object_id".to_string(),
    author_anonymous: None,
    author_ip: None,
    author_role: None,
    author_user_agent: None,
    session_id: None,
});

The API endpoint is configured via the FT_API_URL environment variable, defaulting to https://tracks.fluidattacks.com/.