Skip to content

Commit

Permalink
FileSpanExporter.ts fix,
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Orlovsky committed Oct 4, 2024
1 parent ed63798 commit f607b8b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/exporters/FileSpanExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export class FileSpanExporter extends FileExporter<ReadableSpan> {
attributes: span.attributes,
status: span.status,
events: span.events,
resource: span.resource,
resource: {
attributes: span.resource.attributes
}
};
}
}
1 change: 1 addition & 0 deletions test/instrumentations/amqplib/amqplibTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function getExpectedSpan({
return {
traceId: expect.any(String),
id: expect.any(String),
parentId: expect.any(String),
timestamp: expect.any(Number),
duration: expect.any(Number),
name: nameSpanAttr,
Expand Down
18 changes: 15 additions & 3 deletions test/instrumentations/http/http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TEST_TIMEOUT = 20_000;
const INSTRUMENTATION_NAME = 'http';

const expectedResourceAttributes = {
attributes: {
attributes: {
'framework': expect.toBeOneOf(['node', 'express']),
'lumigo.distro.version': expect.stringMatching(/1\.\d+\.\d+/),
'process.environ': expect.any(String),
Expand All @@ -27,7 +27,13 @@ const expectedResourceAttributes = {
'telemetry.sdk.language': 'nodejs',
'telemetry.sdk.name': 'opentelemetry',
'telemetry.sdk.version': expect.any(String),
}
'process.executable.path': expect.any(String),
'process.command_args': expect.any(Array),
'process.owner': expect.any(String),
'process.command': expect.any(String),
},
asyncAttributesPending: expect.any(Boolean),
_syncAttributes: expect.any(Object),
};

describe('Instrumentation tests for the http package', function () {
Expand Down Expand Up @@ -248,7 +254,13 @@ describe('Instrumentation tests for the http package', function () {
'http.status_text': 'OK',
'http.url': 'htt',
'lumigo.execution_tags.foo': 'bar',
'lumigo.execution_tags.date': 1234567
'lumigo.execution_tags.date': 1234567,
'net.host.name': 'localhost',
"net.transport": "ip_tcp",
"net.host.ip": "::1",
"net.host.port": expect.any(Number),
"net.peer.ip": "::1",
"net.peer.port": expect.any(Number),
}
);

Expand Down
4 changes: 1 addition & 3 deletions test/instrumentations/ioredis/ioredisTestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export function getExpectedSpan({
name,
kind: SpanKind.CLIENT,
resource: {
_attributes: resourceAttributes,
asyncAttributesPending: expect.any(Boolean),
_syncAttributes: expect.any(Object),
attributes: resourceAttributes,
},
attributes,
status: {
Expand Down
4 changes: 1 addition & 3 deletions test/instrumentations/kafkajs/kafkaJsTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ export function getExpectedSpan({ spanKind, resourceAttributes, host, topic, mes
name: topic,
kind: spanKind,
resource: {
_attributes: resourceAttributes,
asyncAttributesPending: expect.any(Boolean),
_syncAttributes: expect.any(Object),
attributes: resourceAttributes,
},
attributes: {
'messaging.destination': topic,
Expand Down
6 changes: 2 additions & 4 deletions test/instrumentations/mongodb/mongodbTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export function getExpectedSpan(nameSpanAttr, resourceAttributes, dbStatement) {
name: nameSpanAttr,
kind: SpanKind.CLIENT,
resource: {
_attributes: resourceAttributes,
asyncAttributesPending: expect.any(Boolean),
_syncAttributes: expect.any(Object),
attributes: resourceAttributes,
},
attributes: {
'db.system': 'mongodb',
Expand Down Expand Up @@ -65,7 +63,7 @@ export function getExpectedSpanWithParent(
name: nameSpanAttr,
kind: SpanKind.CLIENT,
resource: {
_attributes: resourceAttributes,
attributes: resourceAttributes,
},
attributes: {
'db.system': 'mongodb',
Expand Down
4 changes: 1 addition & 3 deletions test/instrumentations/prisma/prismaTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export function getExpectedSpan({ name, resourceAttributes, attributes }) {
name: name,
kind: SpanKind.INTERNAL,
resource: {
_attributes: resourceAttributes,
asyncAttributesPending: expect.any(Boolean),
_syncAttributes: expect.any(Object),
attributes: resourceAttributes,
},
attributes: attributes,
status: {
Expand Down
4 changes: 1 addition & 3 deletions test/instrumentations/redis/redisTestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export function getExpectedSpan({
name: nameSpanAttr,
kind: SpanKind.CLIENT,
resource: {
_attributes: resourceAttributes,
asyncAttributesPending: expect.any(Boolean),
_syncAttributes: expect.any(Object),
attributes: resourceAttributes,
},
attributes: {
'db.system': 'redis',
Expand Down

0 comments on commit f607b8b

Please sign in to comment.