opentelemetry_lambda_extension/
lib.rs

1//! AWS Lambda Extension for OpenTelemetry signal collection and export.
2//!
3//! This extension integrates with the AWS Lambda Extensions API (via the
4//! `lambda_extension` crate) to collect OpenTelemetry traces, metrics, and
5//! logs from Lambda functions and export them to configured backends.
6//!
7//! # Example
8//!
9//! ```no_run
10//! use opentelemetry_lambda_extension::{Config, RuntimeBuilder};
11//!
12//! #[tokio::main]
13//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
14//!     let config = Config::load()?;
15//!     let runtime = RuntimeBuilder::new().config(config).build();
16//!     runtime.run().await?;
17//!     Ok(())
18//! }
19//! ```
20
21#![forbid(unsafe_code)]
22#![warn(missing_docs)]
23
24pub mod aggregator;
25pub mod config;
26pub mod context;
27pub mod conversion;
28pub mod error;
29pub mod exporter;
30pub mod flush;
31pub mod receiver;
32pub mod resource;
33pub mod runtime;
34pub mod service;
35pub mod telemetry;
36pub mod tracing;
37
38pub use aggregator::{BatchedSignal, SignalAggregator};
39pub use config::{
40    Compression, Config, CorrelationConfig, ExporterConfig, FlushConfig, FlushStrategy, Protocol,
41    ReceiverConfig, TelemetryApiConfig,
42};
43pub use context::{
44    InvocationContextManager, PlatformEvent, PlatformEventType, RequestId, SpanContext,
45};
46pub use conversion::{MetricsConverter, SpanConverter, TelemetryProcessor};
47pub use error::{ExtensionError, Result};
48pub use exporter::{ExportError, ExportResult, OtlpExporter};
49pub use flush::{FlushManager, FlushReason};
50pub use receiver::{FlushError, HealthResponse, OtlpReceiver, ReceiverHandle, Signal};
51pub use resource::{ResourceBuilder, detect_resource};
52pub use runtime::{ExtensionRuntime, RuntimeBuilder, RuntimeError};
53pub use service::{EventsService, ExtensionState, TelemetryService};
54pub use telemetry::{
55    ReportMetrics, ReportRecord, RuntimeDoneRecord, StartRecord, TelemetryError, TelemetryEvent,
56    TelemetryListener, TelemetrySubscription, TelemetryType,
57};
58pub use tracing::{W3CTraceContext, XRayTraceHeader};
59
60pub use opentelemetry_configuration::{
61    OtelGuard, OtelSdkBuilder, OtelSdkConfig, Protocol as OtelProtocol, SdkError,
62};