telemetry-rust
use INFO;
// middleware::axum is available if feature flag axum is on
use ;
async
async
async
AWS SDK instrumentation
AwsBuilderInstrument trait
Fully automated instrumentation of AWS SDK fluent builders with attributes extraction from both the request and response.
Available with aws-instrumentation feature flag.
let res = dynamo_client
.get_item
.table_name
.set_key
.instrument
.send
.await;
// Automatically extracts:
// - Request attributes from fluent builder: table name, consistent read, projection expression, etc.
// - Output attributes: consumed capacity, item found status, etc.
The trait automatically extracts relevant attributes from both the request (fluent builder) and response (operation output) following OpenTelemetry semantic conventions for AWS services.
AwsInstrument trait
Manual instrumentation of AWS SDK futures.
Available with aws-instrumentation feature flag.
// DynamoDB instrumentation
let res = dynamo_client
.get_item
.table_name
.index_name
.set_key
.send
.instrument
.await;
// SQS instrumentation
let res = sqs_client
.send_message
.queue_url
.message_body
.send
.instrument
.await;
// SNS instrumentation
let res = sns_client
.publish
.topic_arn
.message
.send
.instrument
.await;
// Firehose instrumentation
let res = firehose_client
.put_record
.delivery_stream_name
.record
.send
.instrument
.await;
AwsStreamInstrument trait
Manual instrumentation of AWS SDK pagination streams.
Available with aws-instrumentation feature flag.
let items = dynamodb_client
.query
.table_name
.index_name
.key_condition_expression
.expression_attribute_values
.into_paginator
.items
.send
.instrument
.
.await?;
Low level API
Creating new span:
// create new span in the current span's context using either a dedicated constructor
let aws_span = get_item.start;
// or a generic one
let aws_span = dynamodb.start;
// optionally, provide an explicit parent context
let context = current.context;
let aws_span = get_item.context.start;
// or set custom span attributes
let aws_span = get_item
.attribute
.attributes
.start;
Ending the span once AWS operation is complete:
let res = dynamo_client
.get_item
.table_name
.index_name
.set_key
.send
.await;
aws_span.end;
Only the following AWS targets are fully supported at the moment:
- DynamoDB
- SNS
- SQS
- Firehose
But a generic AwsSpanBuilder could be used to instrument any other AWS SDK:
let s3_span = client
.start;
AWS Lambda instrumentation
async
Context Propagation
The following context propagation formats are supported:
tracecontext: W3C Trace Context (default)baggage: W3C Baggageb3: B3 single header (requireszipkinfeature)b3multi: B3 multiple headers (requireszipkinfeature)xray: AWS X-Ray (requiresxrayfeature)
Publishing new version
New version could be published using cargo-release: