diff --git a/examples/basic-tracer-node/package.json b/examples/basic-tracer-node/package.json index e666818..37f2bca 100644 --- a/examples/basic-tracer-node/package.json +++ b/examples/basic-tracer-node/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@azure/monitor-opentelemetry-exporter": "^1.0.0-preview.2", - "@opentelemetry/api": "^0.8.1", + "@opentelemetry/api": "^0.9.0", "@opentelemetry/tracing": "^0.9.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" diff --git a/package.json b/package.json index f78ece2..d1d2c57 100644 --- a/package.json +++ b/package.json @@ -12,18 +12,18 @@ "publish": "lerna run publish" }, "devDependencies": { - "@opentelemetry/api": "^0.8.3", + "@opentelemetry/api": "^0.9.0", "@opentelemetry/tracing": "^0.9.0", "@types/mocha": "^7.0.2", - "@types/node": "^14.0.13", + "@types/node": "^14.0.14", "@typescript-eslint/eslint-plugin": "^2.34.0", - "c8": "^7.1.2", + "c8": "^7.2.0", "eslint": "^6.8.0", "eslint-config-airbnb-typescript": "^7.2.0", "eslint-config-prettier": "^6.10.1", "eslint-plugin-import": "^2.21.2", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^3.1.2", + "eslint-plugin-prettier": "^3.1.4", "lerna": "^3.22.1", "mocha": "^7.2.0", "nock": "^12.0.3", diff --git a/packages/azure-opentelemetry-exporter/src/utils/spanUtils.ts b/packages/azure-opentelemetry-exporter/src/utils/spanUtils.ts index 6ad8720..71f6f9a 100644 --- a/packages/azure-opentelemetry-exporter/src/utils/spanUtils.ts +++ b/packages/azure-opentelemetry-exporter/src/utils/spanUtils.ts @@ -61,7 +61,10 @@ function createPropertiesFromSpan(span: ReadableSpan): Properties { id: link.context.spanId, })); - properties[MS_LINKS] = links; + if (links.length > 0) { + properties[MS_LINKS] = JSON.stringify(links); + } + return properties; } diff --git a/packages/azure-opentelemetry-exporter/test/utils/spanUtils.test.ts b/packages/azure-opentelemetry-exporter/test/utils/spanUtils.test.ts index df6d6bb..1bdb1e6 100644 --- a/packages/azure-opentelemetry-exporter/test/utils/spanUtils.test.ts +++ b/packages/azure-opentelemetry-exporter/test/utils/spanUtils.test.ts @@ -81,7 +81,6 @@ describe('spanUtils.ts', () => { 'extra.attribute': 'foo', [grpc.GRPC_ERROR_MESSAGE]: 'some error message', [grpc.GRPC_ERROR_NAME]: 'some error name', - [ai.MS_LINKS]: [], }; const expectedBaseData: Partial = { @@ -135,7 +134,6 @@ describe('spanUtils.ts', () => { 'extra.attribute': 'foo', [grpc.GRPC_ERROR_MESSAGE]: 'some error message', [grpc.GRPC_ERROR_NAME]: 'some error name', - [ai.MS_LINKS]: [], }; const expectedBaseData: Partial = { @@ -186,7 +184,6 @@ describe('spanUtils.ts', () => { }; const expectedProperties: Properties = { 'extra.attribute': 'foo', - [ai.MS_LINKS]: [], }; const expectedBaseData: Partial = { @@ -234,7 +231,6 @@ describe('spanUtils.ts', () => { }; const expectedProperties: Properties = { 'extra.attribute': 'foo', - [ai.MS_LINKS]: [], }; const expectedBaseData: Partial = { @@ -289,7 +285,6 @@ describe('spanUtils.ts', () => { }; const expectedProperties: Properties = { 'extra.attribute': 'foo', - [ai.MS_LINKS]: [], }; const expectedBaseData: RequestData = { @@ -339,7 +334,6 @@ describe('spanUtils.ts', () => { }; const expectedProperties: Properties = { 'extra.attribute': 'foo', - [ai.MS_LINKS]: [], }; const expectedBaseData: RemoteDependencyData = {