Skip to content

Official Rust bindings for the Axiom API

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

axiomhq/axiom-rs

Repository files navigation

axiom-rs docs.rs build crates.io License

use axiom_rs::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Auto-configure the client from the environment variable AXIOM_TOKEN:
    let client = Client::new()?;

    client
        .ingest(
            "DATASET_NAME",
            vec![json!({
                "foo": "bar",
            })],
        )
        .await?;
    let _res = client
        .query(r#"['DATASET_NAME'] | where foo == "bar" | limit 100"#, None)
        .await?;
    Ok(())
}

Install

cargo add axiom-rs

Optional features

You can use the Cargo features:

  • default-tls: Provides TLS support to connect over HTTPS. Enabled by default.
  • native-tls: Enables TLS functionality provided by native-tls.
  • rustls-tls: Enables TLS functionality provided by rustls.
  • tokio: Enables usage with the tokio runtime. Enabled by default.
  • async-std: Enables usage with the async-std runtime.

Documentation

Read documentation on axiom.co/docs/guides/rust.

License

MIT or Apache