| Crates.io | avx-telemetry |
| lib.rs | avx-telemetry |
| version | 0.1.0 |
| created_at | 2025-11-23 07:05:13.772676+00 |
| updated_at | 2025-11-23 07:05:13.772676+00 |
| description | Observability and distributed tracing for Avila Experience Fabric - Structured logging, metrics, and scientific time series |
| homepage | https://arxis.avilaops.com |
| repository | https://github.com/avilaops/arxis |
| max_upload_size | |
| id | 1946210 |
| size | 166,892 |
Observability and tracing layer for Avila Experience Fabric
Production-grade observability for Rust applications. Integrates structured logging, distributed tracing, metrics collection, and scientific time series analysis from avila-telemetry.
avila-telemetry for time series anomaly detection[dependencies]
avx-telemetry = "0.1"
# For HTTP middleware
avx-telemetry = { version = "0.1", features = ["middleware"] }
use avx_telemetry::init_tracing;
fn main() {
// Initialize with default settings
init_tracing();
tracing::info!("Application started");
}
use tracing::{info, warn, error};
#[tracing::instrument]
fn process_data(user_id: &str, count: usize) {
info!(user_id, count, "Processing data");
if count > 1000 {
warn!(count, threshold = 1000, "High data volume");
}
}
// Output (JSON):
// {"level":"INFO","fields":{"user_id":"123","count":500},"message":"Processing data"}
use axum::{Router, routing::get};
use avx_telemetry::middleware::TraceLayer;
#[tokio::main]
async fn main() {
avx_telemetry::init_tracing();
let app = Router::new()
.route("/", get(handler))
.layer(TraceLayer::new());
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
}
async fn handler() -> &'static str {
"Hello, AVX!"
}
Each request automatically gets:
Combine with avila-telemetry for scientific-grade analysis:
use avx_telemetry::TimeSeries;
use avila_telemetry::AnomalyDetector;
#[tracing::instrument]
fn analyze_metrics(values: Vec<f64>) {
let ts = TimeSeries::new(values);
let detector = AnomalyDetector::new(3.0, 1.5);
if let Ok(anomalies) = detector.detect_zscore(&ts) {
if !anomalies.is_empty() {
tracing::warn!(
count = anomalies.len(),
"Anomalies detected in metrics"
);
}
}
}
use avx_telemetry::{TracingConfig, Format};
let config = TracingConfig {
format: Format::Pretty,
level: "debug",
..Default::default()
};
avx_telemetry::init_with_config(config);
let config = TracingConfig {
format: Format::Json,
level: "info",
output_file: Some("logs/app.log"),
..Default::default()
};
Create hierarchical traces:
use tracing::{info_span, info};
fn handle_request(user_id: &str) {
let _span = info_span!("handle_request", user_id).entered();
authenticate(user_id);
fetch_data(user_id);
process_response();
}
#[tracing::instrument]
fn authenticate(user_id: &str) {
info!("Authenticating user");
}
Output shows parent-child relationship:
handle_request{user_id="123"}
├─ authenticate{user_id="123"}
├─ fetch_data{user_id="123"}
└─ process_response
use avx_telemetry::metrics;
// Counters
metrics::counter!("requests_total", 1);
// Gauges
metrics::gauge!("active_connections", 42.0);
// Histograms
let start = std::time::Instant::now();
// ... do work ...
metrics::histogram!("request_duration_ms", start.elapsed().as_millis() as f64);
Works seamlessly with other AVX components:
use avx_gateway::Gateway;
use avx_telemetry::middleware::TraceLayer;
let gateway = Gateway::builder()
.with_telemetry(TraceLayer::new())
.build();
middleware: HTTP tracing middleware for axum/towermetrics: Metrics collection and exportavx-telemetry is part of the Avila Experience (AVX) platform:
See the examples/ directory:
cargo run --example basic_tracing
cargo run --example http_middleware --features middleware
cargo run --example time_series_integration
MIT OR Apache-2.0
See LICENSE-MIT and LICENSE-APACHE for details.