Skip to content

Trace-DB/tracedb-rust

TraceDB Rust SDK

fern shield crates.io shield

The official Rust SDK for the TraceDB v1 HTTP API.

This repository is generated by Fern and published as tracedb-sdk. The Rust crate name used in use statements is tracedb_sdk.

Install

Add the SDK to your project:

cargo add tracedb-sdk@0.1.1

Or declare it in Cargo.toml:

[dependencies]
tracedb-sdk = "0.1.1"

Quickstart

use tracedb_sdk::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ClientConfig {
        base_url: "http://127.0.0.1:8090".to_string(),
        token: Some("dev-token".to_string()),
        ..Default::default()
    };

    let client = ApiClient::new(config)?;
    let health = client.tracedb.health.get_health(None).await?;

    println!("{health:?}");
    Ok(())
}

The checked-in quickstart in tracedb-examples uses the same generated client surface and calls the v1 health endpoint.

Client Shape

ApiClient exposes grouped resource clients under client.tracedb. Endpoint methods accept a final Option<RequestOptions> argument for per-request headers, query parameters, timeouts, and retry overrides.

use tracedb_sdk::prelude::*;

let options = RequestOptions::new()
    .additional_header("x-request-id", "example-request")
    .timeout_seconds(30);

Authentication is configured through ClientConfig:

use tracedb_sdk::prelude::*;

let config = ClientConfig {
    base_url: "https://api.trace-db.com".to_string(),
    token: Some("<api-key-or-token>".to_string()),
    ..Default::default()
};
let client = ApiClient::new(config).expect("TraceDB client configuration is valid");

Errors

Endpoint methods return Result<T, ApiError>. Match on ApiError when you need to separate API responses from transport or client construction failures.

use tracedb_sdk::prelude::*;

match client.tracedb.health.get_health(None).await {
    Ok(health) => println!("{health:?}"),
    Err(ApiError::Http { status, message }) => {
        eprintln!("TraceDB API error {status}: {message}");
    }
    Err(error) => return Err(error.into()),
}

Release Boundary

tracedb-sdk = "0.1.1" is the v0.1.1 generated Rust SDK for the current TraceDB HTTP product surface. It does not claim managed-cloud production SLA, SQL compatibility, benchmark wins, or full runtime S3 rehydrate proof.

Generated Code

Most source in this repository is generated. Changes to generated SDK behavior should be made through the Fern/OpenAPI source in Trace-DB/tracedb-docs or Trace-DB/tracedb-protocol, then regenerated through the Fern pull-request workflow.

About

Official TraceDB Rust SDK

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages