File tree 1 file changed +9
-4
lines changed
examples/opentelemetry-tracing/src
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,15 @@ async fn main() -> Result<(), BoxError> {
24
24
. init ( ) ;
25
25
26
26
// Initialize the Lambda runtime and add OpenTelemetry tracing
27
- let runtime = Runtime :: new ( service_fn ( echo) ) . layer ( OtelLayer :: new ( || {
28
- // Make sure that the trace is exported before the Lambda runtime is frozen
29
- tracer_provider. force_flush ( ) ;
30
- } ) ) ;
27
+ let runtime = Runtime :: new ( service_fn ( echo) ) . layer (
28
+ // Create a tracing span for each Lambda invocation
29
+ OtelLayer :: new ( || {
30
+ // Make sure that the trace is exported before the Lambda runtime is frozen
31
+ tracer_provider. force_flush ( ) ;
32
+ } )
33
+ // Set the "faas.trigger" attribute of the span (defaults to "http" otherwise)
34
+ . with_trigger ( "datasource" ) ,
35
+ ) ;
31
36
runtime. run ( ) . await ?;
32
37
Ok ( ( ) )
33
38
}
You can’t perform that action at this time.
0 commit comments