Skip to content

Commit

Permalink
Merge branch 'main' into tm-esm-testing-1
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm authored Nov 14, 2023
2 parents e0be467 + 99db4bb commit 972c734
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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);
});
});
Expand Down Expand Up @@ -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(
Expand All @@ -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'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function createResolverSpan(
};

const span = tracer.startSpan(
SpanNames.RESOLVE,
`${SpanNames.RESOLVE} ${attributes[AttributeNames.FIELD_PATH]}`,
{
attributes,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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);
});

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 972c734

Please sign in to comment.