Expand description
This module provides utilities for configuring and building an OpenTelemetry TracerProvider specifically tailored for use in AWS Lambda environments.
It includes:
HttpTracerProviderBuilder: A builder struct for configuring and initializing a TracerProvider.get_lambda_resource: A function to create a Resource with Lambda-specific attributes.
The module supports various configuration options, including:
- Custom HTTP clients for exporting traces
- Enabling/disabling logging layers
- Setting custom tracer names
- Configuring propagators and ID generators
- Choosing between simple and batch exporters
It also respects environment variables for certain configurations, such as the span processor type and the OTLP exporter protocol.
§Examples
use lambda_otel_utils::HttpTracerProviderBuilder;
use opentelemetry_sdk::trace::{TracerProvider, Tracer};
let tracer_provider: TracerProvider = HttpTracerProviderBuilder::default()
.with_stdout_client()
.enable_fmt_layer(true)
.with_tracer_name("my-service")
.with_default_text_map_propagator()
.with_default_id_generator()
.enable_global(true)
.build()?;This example demonstrates how to use the HttpTracerProviderBuilder to configure and build
a TracerProvider with custom settings for use in a Lambda function.
Structs§
- Builder for configuring and initializing a TracerProvider.
Functions§
- Retrieves the Lambda resource with the service name.