pub struct Client { /* private fields */ }Expand description
A lightweight Trackio REST client for posting metrics to local or remote Trackio dashboards.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Trackio client using environment variables for configuration.
Recognized env vars:
TRACKIO_SERVER_URL(default: http://127.0.0.1:7860)TRACKIO_PROJECTTRACKIO_RUNTRACKIO_WRITE_TOKENTRACKIO_TIMEOUT_MSTRACKIO_MAX_BATCHTRACKIO_FLUSH_INTERVAL_MS
pub fn with_project(self, p: &str) -> Self
pub fn with_run(self, r: &str) -> Self
pub fn with_base_url(self, u: &str) -> Self
Sourcepub fn log(&self, metrics: Value, step: Option<i64>, ts: Option<String>)
pub fn log(&self, metrics: Value, step: Option<i64>, ts: Option<String>)
Logs a single metric dictionary into the in-memory buffer.
Auto-flushes when max_batch is reached.
Sourcepub fn flush(&self) -> Result<(), TrackioError>
pub fn flush(&self) -> Result<(), TrackioError>
Flush all buffered metrics to the Trackio server.
Sourcepub fn close(&self) -> Result<(), TrackioError>
pub fn close(&self) -> Result<(), TrackioError>
Flush remaining metrics and stop background tasks (if any).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more