Skip to main content

Crate grow_openobserve

Crate grow_openobserve 

Source
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.
blockingblocking
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 Logger facade, 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).
testingtesting
Test support (feature testing): in-memory fakes and the conformance runner (SPEC §6).
traces
Traces: init_tracing (OTLP exporters to /api/{org}/v1/traces with Basic auth and the stream-name header) and OpenObserveTraceQuery, the TraceQueryClient for 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 Attributes map: attrs! { "user" => "ada", "n" => 3 }.

Structs§

LogClientOptions
Options of OpenObserveClient::log_client.
OpenObserveClient
Async client for OpenObserve. Cheap to clone (clones share one connection pool).
OpenObserveConfig
Immutable client configuration; build it with OpenObserveConfig::builder or OpenObserveConfig::from_env. Debug output redacts every credential.
OpenObserveConfigBuilder
Builder for OpenObserveConfig. Values set here win over the environment.

Enums§

LogProtocol
Wire protocol of a OpenObserveClient::log_client.
StreamType
Stream types of OpenObserve.
Timestamp
A point in time: a SystemTime or epoch microseconds (the exact _timestamp of 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; 0 for 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 SystemTime to epoch microseconds.

Type Aliases§

JsonObject
A JSON object (one search row, one stream description, …).
OpenObserveError
Service-prefixed alias of Error.