grow_jaeger/lib.rs
1// Skeleton created by sdk-kit 0.1.0; owned by this repository (edit freely).
2//! # grow-jaeger
3//!
4//! Rust SDK for [Jaeger](https://grow-codes-packages.github.io/jaeger/) by Grow Codes.
5//!
6//! ```no_run
7//! # async fn demo() -> grow_jaeger::Result<()> {
8//! use grow_jaeger::tracing::{traced, TracingConfig, TraceSearchQuery};
9//! use grow_jaeger::{init_tracing, JaegerClient, JaegerConfig};
10//!
11//! // Export spans to Jaeger over OTLP (http/protobuf on 4318 unless configured otherwise).
12//! let tracing = init_tracing(TracingConfig::new("checkout"))?;
13//! traced("charge-card", async { Ok::<_, std::io::Error>(()) }).await.ok();
14//! tracing.shutdown().await?;
15//!
16//! // Read them back through the query API (16686).
17//! let client = JaegerClient::new(JaegerConfig::from_env()?)?;
18//! let summaries = client.query().search_traces(&TraceSearchQuery::service("checkout")).await?;
19//! println!("{} traces", summaries.len());
20//! client.close().await;
21//! # Ok(())
22//! # }
23//! ```
24//!
25//! Modules: [`JaegerClient`] (health, version, sampling strategy), [`JaegerQueryClient`]
26//! (`get_trace`, `find_traces`, `search_traces`, `list_services`, `list_operations`,
27//! `get_operations`, `get_dependencies`), [`init_tracing`] (OTLP preset, presets, remote
28//! sampling), [`JaegerRemoteSampler`] and the [`tracing`] category helpers.
29//!
30//! Features: `blocking` (a blocking client), `testing` (in-memory fakes and the conformance
31//! runner)
32//! , `tower` and `reqwest-middleware` (tracing instrumentation)
33//! .
34#![cfg_attr(docsrs, feature(doc_cfg))]
35
36pub mod core;
37
38mod client;
39mod config;
40pub mod normalize;
41mod query;
42mod sampler;
43mod setup;
44
45#[cfg(feature = "blocking")]
46#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
47pub mod blocking;
48
49#[cfg(feature = "testing")]
50#[cfg_attr(docsrs, doc(cfg(feature = "testing")))]
51pub mod testing;
52
53pub mod tracing;
54
55pub use crate::core::{Error, ErrorCode, HealthStatus, Result, RetryPolicy, Secret};
56
57pub use crate::config::{DEFAULT_SAMPLING_URL, DEFAULT_URL};
58
59pub use crate::query::{
60 GetTraceOptions, JaegerQueryClient, ListOperationsOptions, Operation,
61 DEFAULT_DEPENDENCY_LOOKBACK, DEFAULT_GET_TRACE_WINDOW, DEFAULT_SEARCH_WINDOW,
62};
63
64pub use crate::sampler::{
65 parse_sampling_strategy, JaegerRemoteSampler, OperationStrategy, RateLimiter,
66 RemoteSamplerOptions, SamplingStrategy, StrategyType, DEFAULT_INITIAL_SAMPLING_RATE,
67 DEFAULT_SAMPLING_POLL_INTERVAL,
68};
69
70pub use crate::setup::{
71 init_tracing, init_tracing_with_options, init_tracing_with_remote_sampler, jaeger_exporter,
72 resolve_endpoint, tracing_config_from_env, JaegerTracingHandle, JaegerTracingOptions,
73 RemoteSampling, SamplingPreset, DEFAULT_OTLP_GRPC_ENDPOINT, DEFAULT_OTLP_HTTP_ENDPOINT,
74 DEFAULT_TRACING_PROTOCOL,
75};
76
77pub use crate::client::{JaegerBuildInfo, JaegerClient};
78
79pub use crate::config::JaegerConfig;
80
81pub use crate::config::JaegerConfigBuilder;
82
83/// Service-prefixed alias of [`Error`].
84pub type JaegerError = Error;