Expand description
A SigV4-compatible HTTP client wrapper for OpenTelemetry OTLP exporters.
This crate provides a wrapper that adds AWS SigV4 signing capabilities to any OpenTelemetry HTTP client implementation. It’s particularly useful when sending telemetry data to AWS services that require SigV4 authentication. This crate is part of the serverless-otlp-forwarder project, which provides a comprehensive solution for OpenTelemetry telemetry collection in AWS Lambda environments.
§Features
reqwest- Includes reqwest as a dependency (enabled by default)
The client works with any HTTP client that implements the opentelemetry_http::HttpClient trait.
§Example
use aws_credential_types::Credentials;
use otlp_sigv4_client::SigV4ClientBuilder;
use opentelemetry_otlp::{HttpExporterBuilder, WithHttpConfig};
use reqwest::Client as ReqwestClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credentials = Credentials::new(
"access_key",
"secret_key",
None,
None,
"example",
);
let sigv4_client = SigV4ClientBuilder::new()
.with_client(ReqwestClient::new())
.with_credentials(credentials)
.with_region("us-west-2")
.with_service("xray")
.build()?;
let _exporter = HttpExporterBuilder::default()
.with_http_client(sigv4_client)
.build_span_exporter()?;
Ok(())
}Re-exports§
pub use signing::sign_request;
Modules§
- signing
- Request signing functionality for AWS SigV4
Structs§
- SigV4
Client - A decorator that adds SigV4 signing capabilities to any HttpClient implementation
- SigV4
Client Builder - Builder for configuring and creating a SigV4Client
Enums§
- SigV4
Error - Errors that can occur during SigV4 client operations
Type Aliases§
- Signing
Predicate - Type alias for the request signing predicate