Expand description
An unofficial Spotflow Observability Platform client.
§Overview
This crate provides a simple API for logging messages to the Spotflow Observability Platform.
It could be used directly or as an integration with tracing crate.
For tracing it provides a tracing-subscriber Layer
.
Current implementation is std
and requires async
environment.
§Examples
let (spotflow_logger, spotflow_task, spotflow_stopper) = SpotflowLogger::builder()
// name of device to be displayed in Spotflow Observability Platform
.set_device_id("test1")
// spotflow ingest key from https://app.spotflow.io/ingest-keys
.set_password(mqtt_password)
.build();
// spawn task handling MQTT communication with spotflow platform
let spotflow_task = task::spawn(spotflow_task);
// register client with tracing-subscriber
tracing_subscriber::registry()
.with(LevelFilter::INFO)
.with(spotflow_logger)
.init();
tracing::info!("test message");
// send a request to finish `spotflow_task`
spotflow_stopper.stop().unwrap();
// join the `spotflow_task`
_ = spotflow_task.await;
§API
The entry point to this crate is SpotflowLogger::builder
, which creates a
SpotflowLoggerBuilder
instance.
§Unresolved Issues
Currently there are following issues:
-
Errors during log line send or processing are suppressed.
-
MQTT QoS is forced to be
AtMostOnce
. -
TRACE
log level is mapped toDEBUG
since spotflow does not supportTRACE
. -
Some large integral types like
u128
are not supported forcbor
. -
Tracing
span
andinstrument
are not supported. -
no_std
environment is not supported.
§Feature Flags
Following features are supported: