diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cd2665981..8c32bfc200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,9 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se * (user-facing): `baggageUtils.parsePairKeyValue` was an internal utility function that was unintentionally exported. It has been removed without replacement. * (user-facing): `TimeOriginLegacy` has been removed without replacement. * (user-facing): `isAttributeKey` was an internal utility function that was unintentionally exported. It has been removed without replacement. +* feat(resources)!: do not read environment variables from window in browsers [#5445](https://github.com/open-telemetry/opentelemetry-js/pull/5455) @pichlermarc + * (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore, please pass configuration options to constructors instead. + * Note: Node.js environment variable configuration continues to work as-is. ### :rocket: (Enhancement) diff --git a/packages/opentelemetry-resources/test/detectors/browser/EnvDetector.test.ts b/packages/opentelemetry-resources/test/detectors/browser/EnvDetector.test.ts new file mode 100644 index 0000000000..573700698e --- /dev/null +++ b/packages/opentelemetry-resources/test/detectors/browser/EnvDetector.test.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +import { envDetector } from '../../../src'; +import { describeBrowser } from '../../util'; +import { assertEmptyResource } from '../../util/resource-assertions'; + +describeBrowser('envDetector() on web browser', () => { + it('should return empty resource', async () => { + const resource = envDetector.detect(); + assertEmptyResource(resource); + }); +});