Expand description
§grow-openobserve
Rust SDK for OpenObserve by Grow Codes.
use grow_openobserve::{OpenObserveClient, OpenObserveConfig};
let client = OpenObserveClient::new(OpenObserveConfig::from_env()?)?;
let health = client.health().await?;
println!("healthy: {}", health.healthy);
println!("server: {}", client.server_version().await?);
client.close().await;Modules: logs (ingest, search, streams and the logging adapters), traces
(traces::init_tracing and the trace query client), admin (organizations, service
accounts, passcode), plus the category libraries logging and tracing.
Features: blocking (a blocking client), testing (in-memory fakes and the conformance
runner)
, tracing-layer and log-bridge (logging adapters, on by default)
, tower and reqwest-middleware (tracing instrumentation)
.
Re-exports§
pub use crate::core::Error;pub use crate::core::ErrorCode;pub use crate::core::HealthStatus;pub use crate::core::Result;pub use crate::core::RetryPolicy;pub use crate::core::Secret;pub use crate::traces::init_tracing;pub use opentelemetry;pub use opentelemetry_sdk;
Modules§
- admin
- Admin helpers: organizations, service accounts and the ingest-only passcode.
- blocking
blocking - Blocking wrapper (feature
blocking). Each client owns a tokio runtime with one worker thread, so background work (log batching, exports, retries’ timers) keeps running between blocking calls. - core
- Shared core: errors, configuration, secrets in config, redaction, retries and transport.
- logging
- Logging category (SPEC §4): records, batching, redaction, the
Loggerfacade, the query model and framework adapters. - logs
- Logs: ingestion (
_json,_multi,_bulk, OTLP), search (_search,_around,_values, histogram, polling tail), stream management and the category adapters (OpenObserveLogExporter,OpenObserveLogQuery). - testing
testing - Test support (feature
testing): in-memory fakes and the conformance runner (SPEC §6). - traces
- Traces:
init_tracing(OTLP exporters to/api/{org}/v1/traceswith Basic auth and thestream-nameheader) andOpenObserveTraceQuery, theTraceQueryClientfor OpenObserve. - tracing
- Tracing category (SPEC §5), built on the OpenTelemetry SDK: setup, span helpers, propagation, framework adapters and the trace query model.
Macros§
- attrs
- Builds an
Attributesmap:attrs! { "user" => "ada", "n" => 3 }.
Structs§
- LogClient
Options - Options of
OpenObserveClient::log_client. - Open
Observe Client - Async client for OpenObserve. Cheap to clone (clones share one connection pool).
- Open
Observe Config - Immutable client configuration; build it with
OpenObserveConfig::builderorOpenObserveConfig::from_env.Debugoutput redacts every credential. - Open
Observe Config Builder - Builder for
OpenObserveConfig. Values set here win over the environment.
Enums§
- LogProtocol
- Wire protocol of a
OpenObserveClient::log_client. - Stream
Type - Stream types of OpenObserve.
- Timestamp
- A point in time: a
SystemTimeor epoch microseconds (the exact_timestampof a row).
Constants§
- DEFAULT_
ORG - Organization used when none is configured.
- DEFAULT_
STREAM - Default log and traces stream (the server’s OTLP default).
- DEFAULT_
URL - Endpoint used when neither the builder nor the environment sets one.
- ENV_
PREFIX - Prefix of every Grow environment variable.
Functions§
- flatten_
key - Flattens an attribute key like the server does (
http.method→http_method). - micros_
to_ system_ time - Converts epoch microseconds to a
SystemTime. - normalize_
stream_ name - Server-side stream name normalization: lower case, every non
[a-z0-9_]character →_. - ns_
to_ micros - Converts a nanosecond value (number or exact decimal string) to microseconds;
0for anything unparsable. - sql_
ident - SQL identifier in double quotes (quotes doubled), e.g.
"default". - sql_
string - SQL string literal with single quotes doubled:
'it''s'. - system_
time_ to_ micros - Converts a
SystemTimeto epoch microseconds.
Type Aliases§
- Json
Object - A JSON object (one search row, one stream description, …).
- Open
Observe Error - Service-prefixed alias of
Error.