File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
plugins/node/opentelemetry-instrumentation-aws-lambda Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,13 @@ import {
4040} from '@opentelemetry/api' ;
4141import {
4242 SEMATTRS_FAAS_EXECUTION ,
43- SEMRESATTRS_CLOUD_ACCOUNT_ID ,
4443 SEMRESATTRS_FAAS_ID ,
4544} from '@opentelemetry/semantic-conventions' ;
45+ import {
46+ ATTR_FAAS_INVOCATION_ID ,
47+ ATTR_CLOUD_ACCOUNT_ID ,
48+ ATTR_CLOUD_RESOURCE_ID ,
49+ } from '@opentelemetry/semantic-conventions/incubating' ;
4650import { ATTR_FAAS_COLDSTART } from '@opentelemetry/semantic-conventions/incubating' ;
4751
4852import {
@@ -238,11 +242,12 @@ export class AwsLambdaInstrumentation extends InstrumentationBase<AwsLambdaInstr
238242 kind : SpanKind . SERVER ,
239243 attributes : {
240244 [ SEMATTRS_FAAS_EXECUTION ] : context . awsRequestId ,
245+ [ ATTR_FAAS_INVOCATION_ID ] : context . awsRequestId ,
241246 [ SEMRESATTRS_FAAS_ID ] : context . invokedFunctionArn ,
242- [ SEMRESATTRS_CLOUD_ACCOUNT_ID ] :
243- AwsLambdaInstrumentation . _extractAccountId (
244- context . invokedFunctionArn
245- ) ,
247+ [ ATTR_CLOUD_RESOURCE_ID ] : context . invokedFunctionArn ,
248+ [ ATTR_CLOUD_ACCOUNT_ID ] : AwsLambdaInstrumentation . _extractAccountId (
249+ context . invokedFunctionArn
250+ ) ,
246251 [ ATTR_FAAS_COLDSTART ] : requestIsColdStart ,
247252 } ,
248253 } ,
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import {
3838 SEMATTRS_FAAS_EXECUTION ,
3939 SEMRESATTRS_FAAS_NAME ,
4040} from '@opentelemetry/semantic-conventions' ;
41+ import { ATTR_FAAS_INVOCATION_ID } from '@opentelemetry/semantic-conventions/incubating' ;
4142import {
4243 Context as OtelContext ,
4344 context ,
@@ -63,6 +64,10 @@ const assertSpanSuccess = (span: ReadableSpan) => {
6364 span . attributes [ SEMATTRS_FAAS_EXECUTION ] ,
6465 'aws_request_id'
6566 ) ;
67+ assert . strictEqual (
68+ span . attributes [ ATTR_FAAS_INVOCATION_ID ] ,
69+ 'aws_request_id'
70+ ) ;
6671 assert . strictEqual ( span . attributes [ 'faas.id' ] , 'my_arn' ) ;
6772 assert . strictEqual ( span . status . code , SpanStatusCode . UNSET ) ;
6873 assert . strictEqual ( span . status . message , undefined ) ;
@@ -75,6 +80,10 @@ const assertSpanFailure = (span: ReadableSpan) => {
7580 span . attributes [ SEMATTRS_FAAS_EXECUTION ] ,
7681 'aws_request_id'
7782 ) ;
83+ assert . strictEqual (
84+ span . attributes [ ATTR_FAAS_INVOCATION_ID ] ,
85+ 'aws_request_id'
86+ ) ;
7887 assert . strictEqual ( span . attributes [ 'faas.id' ] , 'my_arn' ) ;
7988 assert . strictEqual ( span . status . code , SpanStatusCode . ERROR ) ;
8089 assert . strictEqual ( span . status . message , 'handler error' ) ;
You can’t perform that action at this time.
0 commit comments