Vigia

Nâng cấp @opentelemetry/core từ 1.x lên 2.x

So sánh API công khai của @opentelemetry/core 1.30.1 và 2.11.0, được tính tự động từ kiểu TypeScript. Chữ ký thay đổi là thay đổi có thể không tương thích, không phải điều chắc chắn.

Tóm tắt

Đường dẫn import bị xóa0
Export bị xóa26
Chữ ký thay đổi5
Thành viên lớp hoặc interface bị xóa3
Thành viên lớp hoặc interface thay đổi1
Mới bị ngừng hỗ trợ4
Thay đổi yêu cầu (engines, phụ thuộc peer)1
Export mới7

Export bị xóa

importexportkindTrước
@opentelemetry/coregetEnvfunction(): Required<ENVIRONMENT>
@opentelemetry/coreVERSIONvariable"1.30.1"
@opentelemetry/coreisWrappedfunction(func: unknown): func is ShimWrapped
@opentelemetry/coreENVIRONMENTtype{ CONTAINER_NAME?: string | undefined; ECS_CONTAINER_METADATA_URI_V4?: string | undefined; ECS_CONTAINER_METADATA_URI?: string | undefined; HOSTNAME?: string | undefined; KUBERNETES_SERVICE_HOST?: string | undefined; NAMESPACE?: string | undefined; OTEL_EXPORTER_JAEGER_AGENT_HOST?: string | undefined; OTEL_EXPORTER_JAEGER_ENDPOINT?: string | undefined; OTEL_EXPORTER_JAEGER_PASSWORD?: string | undefined; OTEL_EXPORTER_JAEGER_USER?: string | undefined; OTEL_EXPORTER_OTLP_ENDPOINT?: string | undefined; OTEL_EXPORTER_OTLP_TRACES_ENDPOINT?: string | undefined; OTEL_EXPORTER_OTLP_METRICS_ENDPOINT?: …
@opentelemetry/coreIdGeneratorinterfaceinterface
@opentelemetry/coreShimWrappedinterfaceinterface
@opentelemetry/corehexToBase64function(hexStr: string): string
@opentelemetry/corehexToBinaryfunction(hexStr: string): Uint8Array<ArrayBufferLike>
@opentelemetry/corebaggageUtilsvariable{ getKeyPairs: (baggage: Baggage) => string[]; serializeKeyPairs: (keyPairs: string[]) => string; parseKeyPairsIntoRecord: (value?: string | undefined) => Record<string, string>; parsePairKeyValue: (entry: string) => ParsedBaggageKeyValue | undefined; }
@opentelemetry/coreisAttributeKeyfunction(key: unknown): key is string
@opentelemetry/coreAlwaysOnSamplerclassclass
@opentelemetry/coreRAW_ENVIRONMENTtype{ [key: string]: string | number | string[] | undefined; }
@opentelemetry/coreAlwaysOffSamplerclassclass
@opentelemetry/coreTimeOriginLegacyinterfaceinterface
@opentelemetry/coreparseEnvironmentfunction(values: RAW_ENVIRONMENT): ENVIRONMENT
@opentelemetry/coreRandomIdGeneratorclassclass
@opentelemetry/coreParentBasedSamplerclassclass
@opentelemetry/coreDEFAULT_ENVIRONMENTvariableRequired<ENVIRONMENT>
@opentelemetry/coreTracesSamplerValuesenumTracesSamplerValues
@opentelemetry/coregetEnvWithoutDefaultsfunction(): ENVIRONMENT
@opentelemetry/coreInstrumentationLibraryinterfaceinterface
@opentelemetry/coreTraceIdRatioBasedSamplerclassclass
@opentelemetry/coreDEFAULT_ATTRIBUTE_COUNT_LIMITvariable128
@opentelemetry/coreDEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMITvariablenumber
@opentelemetry/coreDEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMITvariable128
@opentelemetry/coreDEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMITvariable128

Chữ ký thay đổi

exportTrướcSau
@opentelemetry/core · SDK_INFO{ "telemetry.sdk.name": string; "process.runtime.name": string; "telemetry.sdk.language": string; "telemetry.sdk.version": string; }{ "telemetry.sdk.name": string; "process.runtime.name": string; "telemetry.sdk.language": "nodejs"; "telemetry.sdk.version": string; }
@opentelemetry/core · unrefTimer(timer: NodeJS.Timer): void(timer: number | { unref(): unknown; }): void
@opentelemetry/core · otperformanceany{ now(): number; readonly timeOrigin: number; }
@opentelemetry/core · isAttributeValue(val: unknown): val is SpanAttributeValue(val: unknown): val is AttributeValue
@opentelemetry/core · sanitizeAttributes(attributes: unknown): SpanAttributes(attributes: unknown): Attributes

Thành viên lớp hoặc interface bị xóa

memberimportTrước
TraceState._keys@opentelemetry/coreany
TraceState._clone@opentelemetry/coreany
TraceState._parse@opentelemetry/coreany

Thành viên lớp hoặc interface thay đổi

memberTrướcSau
BindOnceFuture.constructor<R, This = unknown, T extends (this: This, ...args: unknown[]) => R = () => R>(_callback: T, _that: This): BindOnceFuture<R, This, T><R, This = unknown, T extends (this: This, ...args: unknown[]) => R = () => R>(callback: T, that: This): BindOnceFuture<R, This, T>

Mới bị ngừng hỗ trợ

export@deprecated
@opentelemetry/core · unrefTimerplease copy this code to your implementation instead, this function will be removed in the next major version of this package.
@opentelemetry/core · _globalThisUse globalThis directly instead.
@opentelemetry/core · getTimeOriginUse `performance.timeOrigin` directly.
@opentelemetry/core · otperformanceUse performance directly.

Thay đổi yêu cầu (engines, phụ thuộc peer)

TrướcSau
engines.node>=14^18.19.0 || >=20.6.0
Export mới (7)
importexportkind
@opentelemetry/corehrTimeToSecondsfunction
@opentelemetry/coregetNumberFromEnvfunction
@opentelemetry/coregetStringFromEnvfunction
@opentelemetry/coregetBooleanFromEnvfunction
@opentelemetry/coregetStringListFromEnvfunction
@opentelemetry/corediagLogLevelFromStringfunction
@opentelemetry/coreparseKeyPairsIntoRecordfunction

Câu hỏi thường gặp

Nâng cấp @opentelemetry/core từ 1 lên 2 có những thay đổi không tương thích nào?

Giữa @opentelemetry/core 1.30.1 và 2.11.0, Vigia tìm thấy 26 export bị xóa, 5 chữ ký thay đổi và 4 thành viên lớp hoặc interface bị xóa hay thay đổi.

Những gì bị ngừng hỗ trợ trong @opentelemetry/core 2?

4 export hoặc thành viên mới bị đánh dấu ngừng hỗ trợ trong @opentelemetry/core 2.11.0.

Dành cho tác tử

GET https://vigia.coredls.cloud/v1/packages/npm/@opentelemetry/core/upgrade?from=1.30.1&to=2.11.0