Skip to content

Commit cc7aa3c

Browse files
authored
feat(exporter-zipkin)!: do not read environment variables from window (#5465)
1 parent 52d0331 commit cc7aa3c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
9393
* (user-facing): `baggageUtils.parsePairKeyValue` was an internal utility function that was unintentionally exported. It has been removed without replacement.
9494
* (user-facing): `TimeOriginLegacy` has been removed without replacement.
9595
* (user-facing): `isAttributeKey` was an internal utility function that was unintentionally exported. It has been removed without replacement.
96+
* feat(exporter-zipkin)!: do not read environment variables from window in browsers [#5465](https://github.com/open-telemetry/opentelemetry-js/pull/5465) @pichlermarc
97+
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore, please pass configuration options to constructors instead.
9698
* feat(resource)!: Remove resource class export in favor of functions and types only to aid in cross-version compatibility [#5421](https://github.com/open-telemetry/opentelemetry-js/pull/5421)
9799
* Renames `Resource` class to `ResourceImpl` and makes it package-private
98100
* Renames `IResource` interface to `Resource`

packages/opentelemetry-exporter-zipkin/src/zipkin.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*/
1616

1717
import { diag } from '@opentelemetry/api';
18-
import { ExportResult, ExportResultCode, getEnv } from '@opentelemetry/core';
18+
import {
19+
ExportResult,
20+
ExportResultCode,
21+
getStringFromEnv,
22+
} from '@opentelemetry/core';
1923
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
2024
import { prepareSend } from './platform/index';
2125
import * as zipkinTypes from './types';
@@ -42,7 +46,10 @@ export class ZipkinExporter implements SpanExporter {
4246
private _sendingPromises: Promise<unknown>[] = [];
4347

4448
constructor(config: zipkinTypes.ExporterConfig = {}) {
45-
this._urlStr = config.url || getEnv().OTEL_EXPORTER_ZIPKIN_ENDPOINT;
49+
this._urlStr =
50+
config.url ||
51+
(getStringFromEnv('OTEL_EXPORTER_ZIPKIN_ENDPOINT') ??
52+
'http://localhost:9411/api/v2/spans');
4653
this._send = prepareSend(this._urlStr, config.headers);
4754
this._serviceName = config.serviceName;
4855
this._statusCodeTagName =

0 commit comments

Comments
 (0)