diff --git a/CHANGELOG.md b/CHANGELOG.md index 67f7002d6..d4be24551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,8 +117,10 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se * feat(core)!: drop `getEnv()`, `getEnvWithoutDefaults()` [#5481](https://github.com/open-telemetry/opentelemetry-js/pull/5481) @pichlermarc * (user-facing): `getEnv()` has been replaced by `getStringFromEnv()`, `getNumberFromEnv()`, `getBooleanFromEnv()`, `getStringListFromEnv()` * these new functions do not include defaults, please inline any defaults if necessary (example: `getStringFromEnv("OTEL_FOO") ?? "my-default"`) + * to find the previously used defaults, please see [here](https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/packages/opentelemetry-core/src/utils/environment.ts#L154-L239) * (user-facing): `getEnvWithoutDefaults()` has been replaced by `getStringFromEnv()`, `getNumberFromEnv()`, `getBooleanFromEnv()`, `getStringListFromEnv()` * (user-facing): `DEFAULT_ENVIRONMENT` has been removed, please inline any defaults from now on + * to find the previously used defaults, please see [here](https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/packages/opentelemetry-core/src/utils/environment.ts#L154-L239) * (user-facing): `ENVIRONMENT` has been removed without replacement * (user-facing): `RAW_ENVIRONMENT` has been removed without replacement * (user-facing): `parseEnvironment` has been removed without replacement @@ -128,6 +130,11 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se * to register a global context manager, please use `context.setGlobalContextManager()` from `@opentelemetry/api` * feat!: set compilation target to ES2022 for all packages except `@opentelemetry/api`, `@opentelemetry/api-logs`, `@opentelemetry/api-events`, and `@opentelemetry/semantic-conventions` [#5456](https://github.com/open-telemetry/opentelemetry-js/pull/5456) @david-luna * (user-facing): drops browser runtimes which do not support ES2022 features +* feat(core)! drop unused constants [#5504](https://github.com/open-telemetry/opentelemetry-js/pull/5504) @pichlermarc + * (user-facing): `DEFAULT_ATTRIBUTE_VALUE_LENTGHT_LIMIT` has been removed, please use `Infinity` instead + * (user-facing): `DEFAULT_ATTRIBUTE_VALUE_COUNT_LIMIT` has been removed, please use `128` instead + * (user-facing): `DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT` has been removed, please use `128` instead + * (user-facing): `DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT` has been removed, please use `128` instead ### :rocket: (Enhancement) diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts index 3eeb4ad8a..0be041c38 100644 --- a/packages/opentelemetry-core/src/index.ts +++ b/packages/opentelemetry-core/src/index.ts @@ -72,12 +72,6 @@ export { unsuppressTracing, } from './trace/suppress-tracing'; export { TraceState } from './trace/TraceState'; -export { - DEFAULT_ATTRIBUTE_COUNT_LIMIT, - DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT, - DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, - DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT, -} from './utils/environment'; export { merge } from './utils/merge'; export { TimeoutError, callWithTimeout } from './utils/timeout'; export { isUrlIgnored, urlMatches } from './utils/url'; diff --git a/packages/opentelemetry-core/src/utils/environment.ts b/packages/opentelemetry-core/src/utils/environment.ts deleted file mode 100644 index e1257a9cd..000000000 --- a/packages/opentelemetry-core/src/utils/environment.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity; - -export const DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128; - -export const DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT = 128; -export const DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT = 128; diff --git a/packages/opentelemetry-sdk-trace-base/src/utility.ts b/packages/opentelemetry-sdk-trace-base/src/utility.ts index c7830968f..a4a8f452a 100644 --- a/packages/opentelemetry-sdk-trace-base/src/utility.ts +++ b/packages/opentelemetry-sdk-trace-base/src/utility.ts @@ -17,11 +17,10 @@ import { buildSamplerFromEnv, loadDefaultConfig } from './config'; import { Sampler } from './Sampler'; import { SpanLimits, TracerConfig, GeneralLimits } from './types'; -import { - DEFAULT_ATTRIBUTE_COUNT_LIMIT, - DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT, - getNumberFromEnv, -} from '@opentelemetry/core'; +import { getNumberFromEnv } from '@opentelemetry/core'; + +export const DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128; +export const DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity; /** * Function to merge Default configuration (as specified in './config') with diff --git a/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts index 9e33a97f3..f2f498ca6 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts @@ -27,8 +27,6 @@ import { AttributeValue, } from '@opentelemetry/api'; import { - DEFAULT_ATTRIBUTE_COUNT_LIMIT, - DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT, hrTimeDuration, hrTimeToMilliseconds, hrTimeToNanoseconds, @@ -45,6 +43,10 @@ import { BasicTracerProvider, Span, SpanProcessor } from '../../src'; import { SpanImpl } from '../../src/Span'; import { invalidAttributes, validAttributes } from './util'; import { Tracer } from '../../src/Tracer'; +import { + DEFAULT_ATTRIBUTE_COUNT_LIMIT, + DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT, +} from '../../src/utility'; const performanceTimeOrigin: HrTime = [1, 1];