7 releases
0.0.12 | Feb 18, 2024 |
---|---|
0.0.11 | Feb 14, 2024 |
0.0.5 | Aug 22, 2023 |
#7 in #observation
121 downloads per month
595KB
13K
SLoC
observation-tools-client
Export, visualize, and inspect data from anywhere in your program.
lib.rs
:
Quickstart
Observation Tools helps you quickly inspect complex data without needing to build your own visualization tools.
Integrating Observation Tools into your program takes about 5 minutes. You need to:
- Create a project
- Install a client library
- Export your data
- Visualize your data
Organizing your data
We use four different concepts to organize your data:
- Artifacts are individual pieces of data, e.g. an image
- Artifact groups help organize artifacts and can define how artifacts can be visualized together.
- Runs are the top level artifact groups. The normally correspond to one program execution or http request.
- Projects allow you to define common settings used across runs.
Create a project
All data uploaded to Observation Tools is associated with a project. Projects have a unique ID that you'll use to initialize the client in the next step.
To create a project, do the following:
- Sign in to the dashboard
- Click "Create project"
You should see your project's ID on the following screen. You can also find it on the "Settings" page. Project IDs are not sensitive, so you can embed them in your source code.
Install a client library
We have client libraries for a few different languages:
Language | Package | Version |
---|---|---|
Rust | observation-tools |
|
JavaScript experimental | @observation-tools/client |
Don't see the language you're looking for? Let us know! File a feature request or email us.
Install the Rust client with the following command:
cargo add observation-tools
Export your data
To start exporting data from your program, we need to set up a client for your project and create a run. After that, we can create groups to organize artifacts during different parts of our program and export artifacts:
use observation_tools_client::artifacts::Point2Builder;
use observation_tools_client::artifacts::Segment2Builder;
use observation_tools_client::Client;
use observation_tools_client::ClientOptions;
use observation_tools_client::TokenGenerator;
let client = Client::new(
std::env::var("OBSERVATION_TOOLS_PROJECT_ID")?,
ClientOptions::default(),
)?;
/// The name of the run will show up in the UI. You can optionally add key-value metadata to
/// all objects, see [`builders::UserMetadataBuilder::add_metadata`].
let run_uploader = client.create_run("getting-started-example")?;
/// ArtifactGroups are represented as "uploaders"
let uploader_2d = run_uploader.child_uploader_2d("shapes")?;
uploader_2d.create_object2(
"segment2",
Segment2Builder::new(Point2Builder::new(-1.0, 1.0), Point2Builder::new(1.0, -1.0)),
)?;
println!("See the output at: {}", run_uploader.viewer_url());
For more information on the types of data you can upload, see the
documentation for the artifacts
module.
Visualize your data
To view the exported data, you can either find the run on the dashboard or generate a direct url with groups::RunUploader::viewer_url
.
Examples
For more examples, check out the examples directory in the repository.
Dependencies
~34–51MB
~829K SLoC