From 28ea3b6d9d4ddb3b6d635a7d7b26b0721cf448db Mon Sep 17 00:00:00 2001 From: ANUSHA LINGAMNENI <147006476+alingamn@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:54:12 -0800 Subject: [PATCH 1/4] feat(instrumentation-aws-sdk)!: Capture full ARN for span attribute messaging.destination.name for SNS topics (#1727) * Capture full ARN for SNS topics in messaging.destination Problem: The use of topic names instead of ARNs in `messaging.destination` omits essential account information, making topic localization cumbersome. Solution: Adopt full ARNs as the value for `messaging.destination`, preserving both topic name and account details, aligning with current SNS ServiceExtension approach. Closes #1716 * Add new span attribute instead of modifying the existing attribute --------- Co-authored-by: Marc Pichler --- .../src/services/sns.ts | 3 +++ .../test/sns.test.ts | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts index 9652719e83..0ff16558f0 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts @@ -42,6 +42,9 @@ export class SnsServiceExtension implements ServiceExtension { const { TopicArn, TargetArn, PhoneNumber } = request.commandInput; spanAttributes[SemanticAttributes.MESSAGING_DESTINATION] = this.extractDestinationName(TopicArn, TargetArn, PhoneNumber); + // ToDO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when implemented + spanAttributes['messaging.destination.name'] = + TopicArn || TargetArn || PhoneNumber || 'unknown'; spanName = `${ PhoneNumber diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sns.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sns.test.ts index ce6ce9c885..36fa27e3d8 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sns.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sns.test.ts @@ -84,6 +84,9 @@ describe('SNS - v2', () => { expect( publishSpan.attributes[SemanticAttributes.MESSAGING_DESTINATION] ).toBe(topicName); + expect(publishSpan.attributes['messaging.destination.name']).toBe( + fakeARN + ); expect(publishSpan.attributes[SemanticAttributes.RPC_METHOD]).toBe( 'Publish' ); @@ -111,6 +114,9 @@ describe('SNS - v2', () => { expect( publishSpan.attributes[SemanticAttributes.MESSAGING_DESTINATION] ).toBe(PhoneNumber); + expect(publishSpan.attributes['messaging.destination.name']).toBe( + PhoneNumber + ); }); it('inject context propagation', async () => { @@ -159,6 +165,9 @@ describe('SNS - v2', () => { expect( createTopicSpan.attributes[SemanticAttributes.MESSAGING_DESTINATION] ).toBeUndefined(); + expect( + createTopicSpan.attributes['messaging.destination.name'] + ).toBeUndefined(); expect(createTopicSpan.kind).toBe(SpanKind.CLIENT); }); }); @@ -186,9 +195,11 @@ describe('SNS - v3', () => { describe('publish', () => { it('topic arn', async () => { const topicV3Name = 'dummy-sns-v3-topic'; + const topicV3ARN = `arn:aws:sns:us-east-1:000000000:${topicV3Name}`; + await sns.publish({ Message: 'sns message', - TopicArn: `arn:aws:sns:us-east-1:000000000:${topicV3Name}`, + TopicArn: topicV3ARN, }); const publishSpans = getTestSpans().filter( @@ -203,6 +214,9 @@ describe('SNS - v3', () => { expect( publishSpan.attributes[SemanticAttributes.MESSAGING_DESTINATION] ).toBe(topicV3Name); + expect(publishSpan.attributes['messaging.destination.name']).toBe( + topicV3ARN + ); expect(publishSpan.attributes[SemanticAttributes.RPC_METHOD]).toBe( 'Publish' ); From ea73a67f0337f6f22ea89642b5eeea851a285118 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 13 Nov 2023 22:16:07 +0100 Subject: [PATCH 2/4] chore(deps): update commitlint monorepo to v18 (#1788) Co-authored-by: Daniel Dyla --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ad0e87338c..4b14fb2426 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "devDependencies": { - "@commitlint/cli": "16.0.2", - "@commitlint/config-conventional": "16.0.0", + "@commitlint/cli": "18.4.1", + "@commitlint/config-conventional": "18.4.0", "@typescript-eslint/eslint-plugin": "5.8.1", "@typescript-eslint/parser": "5.8.1", "eslint": "8.7.0", From eee50d811785c9f6baffba0567c861d8e997235b Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 14 Nov 2023 10:02:03 +0100 Subject: [PATCH 3/4] chore(deps): update grafana/grafana docker tag to v10 (#1674) --- .../examples/docker/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-mysql/examples/docker/docker-compose.yaml b/plugins/node/opentelemetry-instrumentation-mysql/examples/docker/docker-compose.yaml index 88cc5e4c0e..b95dabc9ad 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/examples/docker/docker-compose.yaml +++ b/plugins/node/opentelemetry-instrumentation-mysql/examples/docker/docker-compose.yaml @@ -59,7 +59,7 @@ services: # Grafana grafana: - image: grafana/grafana:9.0.1 + image: grafana/grafana:10.2.0 container_name: grafana volumes: - ./grafana/grafana.ini:/etc/grafana/grafana.ini From 99db4bb89d717b65c6f91461e466882b09677852 Mon Sep 17 00:00:00 2001 From: Diogo Torres Date: Tue, 14 Nov 2023 19:13:10 +0000 Subject: [PATCH 4/4] chore(graphql): update span name to show the resolver name (#1796) Co-authored-by: Daniel Dyla --- .../src/utils.ts | 2 +- .../test/graphql.test.ts | 12 +++++++----- .../test/helper.ts | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts index 9e183fb2a9..04085fbe5d 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts @@ -129,7 +129,7 @@ function createResolverSpan( }; const span = tracer.startSpan( - SpanNames.RESOLVE, + `${SpanNames.RESOLVE} ${attributes[AttributeNames.FIELD_PATH]}`, { attributes, }, diff --git a/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts b/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts index a9e379592d..d570a38e1a 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts @@ -613,7 +613,7 @@ describe('graphql', () => { await graphql({ schema: simpleSchemaWithResolver, source: '{ hello }' }); const resovleSpans = exporter .getFinishedSpans() - .filter(span => span.name === SpanNames.RESOLVE); + .filter(span => span.name === `${SpanNames.RESOLVE} hello`); assert.deepStrictEqual(resovleSpans.length, 1); const resolveSpan = resovleSpans[0]; assert(resolveSpan.attributes[AttributeNames.FIELD_PATH] === 'hello'); @@ -633,7 +633,7 @@ describe('graphql', () => { await graphql({ schema, source: '{ hello }', rootValue }); const resovleSpans = exporter .getFinishedSpans() - .filter(span => span.name === SpanNames.RESOLVE); + .filter(span => span.name === `${SpanNames.RESOLVE} hello`); assert.deepStrictEqual(resovleSpans.length, 1); const resolveSpan = resovleSpans[0]; assert(resolveSpan.attributes[AttributeNames.FIELD_PATH] === 'hello'); @@ -653,7 +653,7 @@ describe('graphql', () => { await graphql({ schema, source: '{ hello }', rootValue }); const resovleSpans = exporter .getFinishedSpans() - .filter(span => span.name === SpanNames.RESOLVE); + .filter(span => span.name === `${SpanNames.RESOLVE} hello`); assert.deepStrictEqual(resovleSpans.length, 0); }); @@ -682,7 +682,7 @@ describe('graphql', () => { await graphql({ schema, source: '{ hello }', rootValue, fieldResolver }); const resovleSpans = exporter .getFinishedSpans() - .filter(span => span.name === SpanNames.RESOLVE); + .filter(span => span.name === `${SpanNames.RESOLVE} hello`); assert.deepStrictEqual(resovleSpans.length, 1); const resolveSpan = resovleSpans[0]; assert(resolveSpan.attributes[AttributeNames.FIELD_PATH] === 'hello'); @@ -1355,7 +1355,9 @@ describe('graphql', () => { const spans = exporter.getFinishedSpans(); // single resolve span with error and event for exception - const resolveSpans = spans.filter(s => s.name === SpanNames.RESOLVE); + const resolveSpans = spans.filter( + s => s.name === `${SpanNames.RESOLVE} hello` + ); assert.deepStrictEqual(resolveSpans.length, 1); const resolveSpan = resolveSpans[0]; assert.deepStrictEqual(resolveSpan.status.code, SpanStatusCode.ERROR); diff --git a/plugins/node/opentelemetry-instrumentation-graphql/test/helper.ts b/plugins/node/opentelemetry-instrumentation-graphql/test/helper.ts index e7f564096b..56ebe30fda 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/test/helper.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/test/helper.ts @@ -28,7 +28,10 @@ export function assertResolveSpan( parentSpanId?: string ) { const attrs = span.attributes; - assert.deepStrictEqual(span.name, SpanNames.RESOLVE); + assert.deepStrictEqual( + span.name, + `${SpanNames.RESOLVE} ${attrs[AttributeNames.FIELD_PATH]}` + ); assert.deepStrictEqual(attrs[AttributeNames.FIELD_NAME], fieldName); assert.deepStrictEqual(attrs[AttributeNames.FIELD_PATH], fieldPath); assert.deepStrictEqual(attrs[AttributeNames.FIELD_TYPE], fieldType);