From ea50f051308597162939bf978a5b4fc4b7054507 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Tue, 9 Jan 2024 18:32:46 -0500 Subject: [PATCH 1/3] chore(otel-core): replace deprecated spanAttributes --- package-lock.json | 30 ++++--------------- packages/opentelemetry-core/package.json | 6 ++-- .../src/common/attributes.ts | 8 ++--- .../src/trace/sampler/ParentBasedSampler.ts | 4 +-- 4 files changed, 15 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13764f4017..5a1c6d4721 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2074,14 +2074,12 @@ "@protobuf-ts/runtime-rpc": "2.9.3", "@types/mocha": "10.0.6", "@types/node": "18.6.5", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "codecov": "3.8.3", "cross-var": "1.1.0", "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "7.5.4", "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -2100,8 +2098,7 @@ "dependencies": { "@opentelemetry/core": "1.18.1", "@opentelemetry/instrumentation": "0.45.1", - "@opentelemetry/semantic-conventions": "1.18.1", - "semver": "^7.5.2" + "@opentelemetry/semantic-conventions": "1.18.1" }, "devDependencies": { "@opentelemetry/api": "1.7.0", @@ -2112,7 +2109,6 @@ "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/request-promise-native": "1.0.21", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "@types/superagent": "4.1.24", "axios": "1.5.1", @@ -2383,14 +2379,12 @@ "@opentelemetry/exporter-jaeger": "1.18.1", "@types/mocha": "10.0.6", "@types/node": "18.6.5", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "codecov": "3.8.3", "cross-var": "1.1.0", "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "7.5.4", "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", @@ -2839,8 +2833,7 @@ "@opentelemetry/core": "1.18.1", "@opentelemetry/resources": "1.18.1", "@opentelemetry/sdk-metrics": "1.18.1", - "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2" + "require-in-the-middle": "^7.1.1" }, "devDependencies": { "@opencensus/core": "0.1.0", @@ -30909,7 +30902,7 @@ "@opentelemetry/semantic-conventions": "1.18.1" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.8.0", + "@opentelemetry/api": ">=1.1.0 <1.8.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -30936,7 +30929,7 @@ "node": ">=18" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.8.0" + "@opentelemetry/api": ">=1.1.0 <1.8.0" } }, "packages/opentelemetry-core/node_modules/terser-webpack-plugin": { @@ -31587,8 +31580,7 @@ "@opentelemetry/core": "1.18.1", "@opentelemetry/propagator-b3": "1.18.1", "@opentelemetry/propagator-jaeger": "1.18.1", - "@opentelemetry/sdk-trace-base": "1.18.1", - "semver": "^7.5.2" + "@opentelemetry/sdk-trace-base": "1.18.1" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -31596,7 +31588,6 @@ "@opentelemetry/semantic-conventions": "1.18.1", "@types/mocha": "10.0.6", "@types/node": "18.6.5", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "codecov": "3.8.3", "cross-var": "1.1.0", @@ -35573,7 +35564,7 @@ "@opentelemetry/core": { "version": "file:packages/opentelemetry-core", "requires": { - "@opentelemetry/api": ">=1.0.0 <1.8.0", + "@opentelemetry/api": ">=1.1.0 <1.8.0", "@opentelemetry/semantic-conventions": "1.18.1", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -36549,14 +36540,12 @@ "@protobuf-ts/runtime-rpc": "2.9.3", "@types/mocha": "10.0.6", "@types/node": "18.6.5", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "codecov": "3.8.3", "cross-var": "1.1.0", "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "7.5.4", "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -36576,7 +36565,6 @@ "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/request-promise-native": "1.0.21", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "@types/superagent": "4.1.24", "axios": "1.5.1", @@ -36588,7 +36576,6 @@ "nyc": "15.1.0", "request": "2.88.2", "request-promise-native": "1.0.9", - "semver": "^7.5.2", "sinon": "15.1.2", "superagent": "8.0.9", "ts-mocha": "10.0.0", @@ -37386,14 +37373,12 @@ "@opentelemetry/semantic-conventions": "1.18.1", "@types/mocha": "10.0.6", "@types/node": "18.6.5", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "codecov": "3.8.3", "cross-var": "1.1.0", "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "7.5.4", "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", @@ -37490,14 +37475,12 @@ "@opentelemetry/semantic-conventions": "1.18.1", "@types/mocha": "10.0.6", "@types/node": "18.6.5", - "@types/semver": "7.5.6", "@types/sinon": "10.0.20", "codecov": "3.8.3", "cross-var": "1.1.0", "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "^7.5.2", "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -37891,7 +37874,6 @@ "mocha": "10.2.0", "nyc": "15.1.0", "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2", "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index ac390d84e9..75ab627fd5 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -64,7 +64,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.8.0", + "@opentelemetry/api": ">=1.1.0 <1.8.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -88,11 +88,11 @@ "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.8.0" + "@opentelemetry/api": ">=1.1.0 <1.8.0" }, "dependencies": { "@opentelemetry/semantic-conventions": "1.18.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core", "sideEffects": false -} +} \ No newline at end of file diff --git a/packages/opentelemetry-core/src/common/attributes.ts b/packages/opentelemetry-core/src/common/attributes.ts index 0726acd581..d2636090c2 100644 --- a/packages/opentelemetry-core/src/common/attributes.ts +++ b/packages/opentelemetry-core/src/common/attributes.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import { diag, SpanAttributeValue, SpanAttributes } from '@opentelemetry/api'; +import { diag, AttributeValue, Attributes } from '@opentelemetry/api'; -export function sanitizeAttributes(attributes: unknown): SpanAttributes { - const out: SpanAttributes = {}; +export function sanitizeAttributes(attributes: unknown): Attributes { + const out: Attributes = {}; if (typeof attributes !== 'object' || attributes == null) { return out; @@ -46,7 +46,7 @@ export function isAttributeKey(key: unknown): key is string { return typeof key === 'string' && key.length > 0; } -export function isAttributeValue(val: unknown): val is SpanAttributeValue { +export function isAttributeValue(val: unknown): val is AttributeValue { if (val == null) { return true; } diff --git a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts index a3abf53bf4..dcfe3a253c 100644 --- a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts +++ b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts @@ -20,7 +20,7 @@ import { Link, Sampler, SamplingResult, - SpanAttributes, + Attributes, SpanKind, TraceFlags, trace, @@ -66,7 +66,7 @@ export class ParentBasedSampler implements Sampler { traceId: string, spanName: string, spanKind: SpanKind, - attributes: SpanAttributes, + attributes: Attributes, links: Link[] ): SamplingResult { const parentContext = trace.getSpanContext(context); From d02b80bf7111ef8994388d197aca6ea3557608bb Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Wed, 10 Jan 2024 12:01:01 -0500 Subject: [PATCH 2/3] update changelog --- CHANGELOG_NEXT.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG_NEXT.md b/CHANGELOG_NEXT.md index 1ecdcaf9eb..1865224d25 100644 --- a/CHANGELOG_NEXT.md +++ b/CHANGELOG_NEXT.md @@ -2,6 +2,8 @@ ### :boom: Breaking Change +* chore(otel-core): replace deprecated SpanAttributes [#4408](https://github.com/open-telemetry/opentelemetry-js/pull/4408) @JamieDanielson + ### :rocket: (Enhancement) ### :books: (Refine Doc) From 6e9e47dc34e1a94b7f3dc5976c383a7fb9773a72 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Tue, 16 Jan 2024 17:04:23 -0500 Subject: [PATCH 3/3] keep new line at bottom of package.json --- packages/opentelemetry-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 75ab627fd5..30a3ef0bac 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -95,4 +95,4 @@ }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core", "sideEffects": false -} \ No newline at end of file +}