Skip to main content

grow_openobserve/
lib.rs

1// Skeleton created by sdk-kit 0.1.0; owned by this repository (edit freely).
2//! # grow-openobserve
3//!
4//! Rust SDK for [OpenObserve](https://grow-codes-packages.github.io/openobserve/) by Grow Codes.
5//!
6//! ```no_run
7//! # async fn demo() -> grow_openobserve::Result<()> {
8//! use grow_openobserve::{OpenObserveClient, OpenObserveConfig};
9//!
10//! let client = OpenObserveClient::new(OpenObserveConfig::from_env()?)?;
11//! let health = client.health().await?;
12//! println!("healthy: {}", health.healthy);
13//! println!("server: {}", client.server_version().await?);
14//! client.close().await;
15//! # Ok(())
16//! # }
17//! ```
18//!
19//! Modules: [`logs`] (ingest, search, streams and the logging adapters), [`traces`]
20//! ([`traces::init_tracing`] and the trace query client), [`admin`] (organizations, service
21//! accounts, passcode), plus the category libraries [`logging`] and [`tracing`].
22//!
23//! Features: `blocking` (a blocking client), `testing` (in-memory fakes and the conformance
24//! runner)
25//! , `tracing-layer` and `log-bridge` (logging adapters, on by default)
26//! , `tower` and `reqwest-middleware` (tracing instrumentation)
27//! .
28#![cfg_attr(docsrs, feature(doc_cfg))]
29
30pub mod core;
31
32pub mod admin;
33mod client;
34mod config;
35mod http;
36pub mod logs;
37pub mod traces;
38
39#[cfg(feature = "blocking")]
40#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
41pub mod blocking;
42
43#[cfg(feature = "testing")]
44#[cfg_attr(docsrs, doc(cfg(feature = "testing")))]
45pub mod testing;
46
47pub mod logging;
48pub mod tracing;
49
50pub use crate::core::{Error, ErrorCode, HealthStatus, Result, RetryPolicy, Secret};
51
52pub use crate::config::DEFAULT_URL;
53
54pub use crate::client::{LogClientOptions, LogProtocol, OpenObserveClient};
55
56pub use crate::config::{normalize_stream_name, DEFAULT_ORG, DEFAULT_STREAM, ENV_PREFIX};
57
58pub use crate::http::{
59    flatten_key, micros_to_system_time, ns_to_micros, sql_ident, sql_string, system_time_to_micros,
60    JsonObject, StreamType, Timestamp,
61};
62
63pub use crate::traces::init_tracing;
64
65/// The OpenTelemetry API crate this SDK is built on (use it for version-matched types such as
66/// `opentelemetry::trace::SpanKind`).
67pub use opentelemetry;
68/// The OpenTelemetry SDK crate this SDK is built on.
69pub use opentelemetry_sdk;
70
71pub use crate::config::OpenObserveConfig;
72
73pub use crate::config::OpenObserveConfigBuilder;
74
75/// Service-prefixed alias of [`Error`].
76pub type OpenObserveError = Error;