Skip to content

Commit 1ab8704

Browse files
authored
Merge branch 'open-telemetry:main' into clintonb/synchronous-gauge
2 parents a30df7e + 3a426e8 commit 1ab8704

File tree

46 files changed

+106
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+106
-84
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ An entry into `CHANGELOG.md` or `experimental/CHANGELOG.md` is required for the
104104
- Changes to default settings
105105
- New components being added
106106

107-
It is reasonable to omit an entry to the changelog under these circuimstances:
107+
It is reasonable to omit an entry to the changelog under these circumstances:
108108

109109
- Updating test to remove flakiness or improve coverage
110110
- Updates to the CI/CD process

api/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install @opentelemetry/api @opentelemetry/sdk-trace-base
3636

3737
### Trace Your Application
3838

39-
In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [sdk registration methods][docs-sdk-registration].
39+
In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [SDK registration methods][docs-sdk-registration].
4040

4141
Once you have registered an SDK, you can start and end spans. A simple example of basic SDK registration and tracing a simple operation is below. The example should export spans to the console once per second. For more information, see the [tracing documentation][docs-tracing].
4242

api/test/common/metrics/Metric.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Metric', () => {
4242
const counter: Counter<Attributes> = {
4343
add(_value: number, _attribute: Attributes) {},
4444
};
45-
// @ts-expect-error Expacting the type of Attributes
45+
// @ts-expect-error Expecting the type of Attributes
4646
counter.add(1, { 'another-attribute': 'value' });
4747
});
4848
});
@@ -72,7 +72,7 @@ describe('Metric', () => {
7272
const counter: UpDownCounter<Attributes> = {
7373
add(_value: number, _attribute: Attributes) {},
7474
};
75-
// @ts-expect-error Expacting the type of Attributes
75+
// @ts-expect-error Expecting the type of Attributes
7676
counter.add(1, { 'another-attribute': 'value' });
7777
});
7878
});
@@ -102,7 +102,7 @@ describe('Metric', () => {
102102
const counter: Histogram<Attributes> = {
103103
record(_value: number, _attribute: Attributes) {},
104104
};
105-
// @ts-expect-error Expacting the type of Attributes
105+
// @ts-expect-error Expecting the type of Attributes
106106
counter.record(1, { 'another-attribute': 'value' });
107107
});
108108
});

doc/upgrade-guide.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Collector exporter packages and types are renamed:
107107

108108
- All plugins have been removed in favor of instrumentations.
109109

110-
- The `@opentelemetry/propagator-b3` package previously exported three propagators: `B3Propagator`,`B3SinglePropagator`, and `B3MultiPropagator`, but now only exports the `B3Propagator`. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header endcoding during construction: `new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })`. If you were previously using the `B3SinglePropagator` or `B3MultiPropagator` directly, you should update your code to use the `B3Propagator` with the appropriate configuration. See the [readme][otel-propagator-b3] for full details and usage.
110+
- The `@opentelemetry/propagator-b3` package previously exported three propagators: `B3Propagator`,`B3SinglePropagator`, and `B3MultiPropagator`, but now only exports the `B3Propagator`. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header encoding during construction: `new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })`. If you were previously using the `B3SinglePropagator` or `B3MultiPropagator` directly, you should update your code to use the `B3Propagator` with the appropriate configuration. See the [README][otel-propagator-b3] for full details and usage.
111111

112112
- Sampling configuration via environment variable has changed. If you were using `OTEL_SAMPLING_PROBABILITY` then you should replace it with `OTEL_TRACES_SAMPLER=parentbased_traceidratio` and `OTEL_TRACES_SAMPLER_ARG=<number>` where `<number>` is a number in the [0..1] range, e.g. "0.25". Default is 1.0 if unset.
113113

@@ -232,7 +232,7 @@ Some types exported from `"@opentelemetry/api"` have been changed to be more spe
232232

233233
## 0.15.0 to 0.16.0
234234

235-
[PR-1863](https://github.com/open-telemetry/opentelemetry-js/pull/1863) removed public attributes `keepAlive` and `httpAgentOptions` from nodejs `CollectorTraceExporter` and `CollectorMetricExporter`
235+
[PR-1863](https://github.com/open-telemetry/opentelemetry-js/pull/1863) removed public attributes `keepAlive` and `httpAgentOptions` from Node.js `CollectorTraceExporter` and `CollectorMetricExporter`
236236

237237
## 0.14.0 to 0.15.0
238238

experimental/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ All notable changes to experimental packages in this project will be documented
1010

1111
### :bug: (Bug Fix)
1212

13+
* fix(exporter-*-otlp-*): use parseHeaders() to ensure header-values are not 'undefined' #4540
14+
* Fixes a bug where passing `undefined` as a header value would crash the end-user app after the export timeout elapsed.
15+
1316
### :books: (Refine Doc)
1417

1518
### :house: (Internal)

experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import type {
2121
import type { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
2222
import type { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer';
2323
import { getEnv, baggageUtils } from '@opentelemetry/core';
24-
import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base';
24+
import {
25+
OTLPExporterNodeBase,
26+
parseHeaders,
27+
} from '@opentelemetry/otlp-exporter-base';
2528
import { createExportLogsServiceRequest } from '@opentelemetry/otlp-transformer';
2629

2730
import { getDefaultUrl } from '../config';
@@ -50,7 +53,7 @@ export class OTLPLogExporter
5053
...baggageUtils.parseKeyPairsIntoRecord(
5154
getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS
5255
),
53-
...config.headers,
56+
...parseHeaders(config?.headers),
5457
};
5558
}
5659

experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
OTLPExporterConfigBase,
2020
appendResourcePathToUrl,
2121
appendRootPathToUrlIfNeeded,
22+
parseHeaders,
2223
} from '@opentelemetry/otlp-exporter-base';
2324
import {
2425
OTLPProtoExporterNodeBase,
@@ -57,7 +58,7 @@ export class OTLPLogExporter
5758
...baggageUtils.parseKeyPairsIntoRecord(
5859
getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS
5960
),
60-
...config.headers,
61+
...parseHeaders(config?.headers),
6162
};
6263
}
6364
convert(logs: ReadableLogRecord[]): IExportLogsServiceRequest {

experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616

1717
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
1818
import { getEnv, baggageUtils } from '@opentelemetry/core';
19-
import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base';
19+
import {
20+
OTLPExporterNodeBase,
21+
parseHeaders,
22+
} from '@opentelemetry/otlp-exporter-base';
2023
import {
2124
OTLPExporterNodeConfigBase,
2225
appendResourcePathToUrl,
@@ -49,7 +52,7 @@ export class OTLPTraceExporter
4952
...baggageUtils.parseKeyPairsIntoRecord(
5053
getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS
5154
),
52-
...config.headers,
55+
...parseHeaders(config?.headers),
5356
};
5457
}
5558

experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
OTLPExporterNodeConfigBase,
2121
appendResourcePathToUrl,
2222
appendRootPathToUrlIfNeeded,
23+
parseHeaders,
2324
} from '@opentelemetry/otlp-exporter-base';
2425
import {
2526
OTLPProtoExporterNodeBase,
@@ -52,7 +53,7 @@ export class OTLPTraceExporter
5253
...baggageUtils.parseKeyPairsIntoRecord(
5354
getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS
5455
),
55-
...config.headers,
56+
...parseHeaders(config?.headers),
5657
};
5758
}
5859

experimental/packages/opentelemetry-browser-detector/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ start().then(()=> console.log("Instrumentation started"));
5151

5252
The browser identification attributes will be added to the resource spans when traces are created.
5353
These attributes include platform, brands, mobile, language if the browser supports
54-
the userAgentData api, otherwise it will contain only the user_agent informations
54+
the userAgentData api, otherwise it will contain only the user_agent information

experimental/packages/opentelemetry-browser-detector/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type UserAgentData = {
2020
};
2121

2222
export const BROWSER_ATTRIBUTES = {
23-
PLATFORM: 'browser.platform', //TODO replace with SemantecConventions attribute when available
23+
PLATFORM: 'browser.platform', //TODO replace with SemanticConventions attribute when available
2424
BRANDS: 'browser.brands',
2525
MOBILE: 'browser.mobile',
2626
LANGUAGE: 'browser.language',

experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
IExportMetricsServiceResponse,
3434
} from '@opentelemetry/otlp-transformer';
3535
import { VERSION } from './version';
36+
import { parseHeaders } from '@opentelemetry/otlp-exporter-base';
3637

3738
const USER_AGENT = {
3839
'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,
@@ -49,7 +50,7 @@ class OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase<
4950
...baggageUtils.parseKeyPairsIntoRecord(
5051
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
5152
),
52-
...config?.headers,
53+
...parseHeaders(config?.headers),
5354
};
5455
super(
5556
config,

experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
OTLPExporterNodeConfigBase,
2424
appendResourcePathToUrl,
2525
appendRootPathToUrlIfNeeded,
26+
parseHeaders,
2627
} from '@opentelemetry/otlp-exporter-base';
2728
import {
2829
createExportMetricsServiceRequest,
@@ -48,7 +49,7 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase<
4849
...baggageUtils.parseKeyPairsIntoRecord(
4950
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
5051
),
51-
...config?.headers,
52+
...parseHeaders(config?.headers),
5253
};
5354
}
5455

experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
OTLPExporterNodeConfigBase,
2727
appendResourcePathToUrl,
2828
appendRootPathToUrlIfNeeded,
29+
parseHeaders,
2930
} from '@opentelemetry/otlp-exporter-base';
3031
import {
3132
createExportMetricsServiceRequest,
@@ -51,7 +52,7 @@ class OTLPMetricExporterNodeProxy extends OTLPProtoExporterNodeBase<
5152
...baggageUtils.parseKeyPairsIntoRecord(
5253
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
5354
),
54-
...config?.headers,
55+
...parseHeaders(config?.headers),
5556
};
5657
}
5758

experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ describe('fetch', () => {
654654
clearData();
655655
});
656656

657-
it('applies attributes when the request is succesful', async () => {
657+
it('applies attributes when the request is successful', async () => {
658658
await prepare(url, span => {
659659
span.setAttribute(CUSTOM_ATTRIBUTE_KEY, 'custom value');
660660
});

experimental/packages/opentelemetry-instrumentation-grpc/src/clientUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export function patchResponseStreamEvents(span: Span, call: EventEmitter) {
152152
}
153153

154154
/**
155-
* Execute grpc client call. Apply completitionspan properties and end the
155+
* Execute grpc client call. Apply completion span properties and end the
156156
* span on callback or receiving an emitted event.
157157
*/
158158
export function makeGrpcClientRemoteCall(

experimental/packages/opentelemetry-instrumentation-grpc/test/helper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export async function startServer(proto: any, port: number) {
136136
server.addService(proto.GrpcTester.service, {
137137
// An error is emitted every time
138138
// request.num <= MAX_ERROR_STATUS = (status.UNAUTHENTICATED)
139-
// in those cases, erro.code = request.num
139+
// in those cases, error.code = request.num
140140

141141
// This method returns the request
142142
// This method returns the request

experimental/packages/opentelemetry-instrumentation-http/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following options are deprecated:
6767
| Options | Type | Description |
6868
| ------- | ---- | ----------- |
6969
| `ignoreIncomingPaths` | `IgnoreMatcher[]` | Http instrumentation will not trace all incoming requests that match paths |
70-
| `ignoreOutgoingUrls` | `IgnoreMatcher[]` | Http instrumentation will not trace all outgoing requests that match urls |
70+
| `ignoreOutgoingUrls` | `IgnoreMatcher[]` | Http instrumentation will not trace all outgoing requests that match URLs |
7171

7272
## Useful links
7373

experimental/packages/opentelemetry-instrumentation-http/src/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export const getOutgoingRequestMetricAttributes = (
373373
spanAttributes[SemanticAttributes.HTTP_METHOD];
374374
metricAttributes[SemanticAttributes.NET_PEER_NAME] =
375375
spanAttributes[SemanticAttributes.NET_PEER_NAME];
376-
//TODO: http.url attribute, it should susbtitute any parameters to avoid high cardinality.
376+
//TODO: http.url attribute, it should substitute any parameters to avoid high cardinality.
377377
return metricAttributes;
378378
};
379379

@@ -514,7 +514,7 @@ export const getIncomingRequestMetricAttributes = (
514514
spanAttributes[SemanticAttributes.NET_HOST_NAME];
515515
metricAttributes[SemanticAttributes.HTTP_FLAVOR] =
516516
spanAttributes[SemanticAttributes.HTTP_FLAVOR];
517-
//TODO: http.target attribute, it should susbtitute any parameters to avoid high cardinality.
517+
//TODO: http.target attribute, it should substitute any parameters to avoid high cardinality.
518518
return metricAttributes;
519519
};
520520

experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ describe('HttpInstrumentation', () => {
555555
});
556556

557557
for (const arg of ['string', {}, new Date()]) {
558-
it(`should be tracable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
558+
it(`should be traceable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
559559
arg
560560
)}`, async () => {
561561
try {
@@ -1101,10 +1101,10 @@ describe('HttpInstrumentation', () => {
11011101

11021102
it('should set rpc metadata for incoming http request', async () => {
11031103
server = http.createServer((request, response) => {
1104-
const rpcMemadata = getRPCMetadata(context.active());
1105-
assert(typeof rpcMemadata !== 'undefined');
1106-
assert(rpcMemadata.type === RPCType.HTTP);
1107-
assert(rpcMemadata.span.setAttribute('key', 'value'));
1104+
const rpcMetadata = getRPCMetadata(context.active());
1105+
assert(typeof rpcMetadata !== 'undefined');
1106+
assert(rpcMetadata.type === RPCType.HTTP);
1107+
assert(rpcMetadata.span.setAttribute('key', 'value'));
11081108
response.end('Test Server Response');
11091109
});
11101110
await new Promise<void>(resolve => server.listen(serverPort, resolve));

experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ describe('HttpsInstrumentation', () => {
465465
});
466466

467467
for (const arg of ['string', {}, new Date()]) {
468-
it(`should be tracable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
468+
it(`should be traceable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
469469
arg
470470
)}`, async () => {
471471
try {

experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ describe('Utility', () => {
311311
);
312312
});
313313

314-
it('should succesfully process without middleware stack', () => {
314+
it('should successfully process without middleware stack', () => {
315315
const request = {
316316
socket: {},
317317
} as IncomingMessage;

experimental/packages/opentelemetry-instrumentation/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,13 @@ registerInstrumentations({
216216
The `registerInstrumentations()` API allows to specify which `TracerProvider` and/or `MeterProvider` to use by the given options object.
217217
If nothing is specified the global registered provider is used. Usually this is what most users want therefore it's recommended to keep this default.
218218

219-
There might be usecase where someone has the need for more providers within an application. Please note that special care must be takes in such setups
219+
There might be use case where someone has the need for more providers within an application. Please note that special care must be takes in such setups
220220
to avoid leaking information from one provider to the other because there are a lot places where e.g. the global `ContextManager` or `Propagator` is used.
221221

222-
## Instrumentation for ES Modules In NodeJS (experimental)
222+
## Instrumentation for ES Modules In Node.js (experimental)
223223

224-
As the module loading mechanism for ESM is different than CJS, you need to select a custom loader so instrumentation can load hook on the esm module it want to patch. To do so, you must provide the `--experimental-loader=@opentelemetry/instrumentation/hook.mjs` flag to the `node` binary. Alternatively you can set the `NODE_OPTIONS` environment variable to `NODE_OPTIONS="--experimental-loader=@opentelemetry/instrumentation/hook.mjs"`.
225-
As the ESM module loader from NodeJS is experimental, so is our support for it. Feel free to provide feedback or report issues about it.
224+
As the module loading mechanism for ESM is different than CJS, you need to select a custom loader so instrumentation can load hook on the ESM module it want to patch. To do so, you must provide the `--experimental-loader=@opentelemetry/instrumentation/hook.mjs` flag to the `node` binary. Alternatively you can set the `NODE_OPTIONS` environment variable to `NODE_OPTIONS="--experimental-loader=@opentelemetry/instrumentation/hook.mjs"`.
225+
As the ESM module loader from Node.js is experimental, so is our support for it. Feel free to provide feedback or report issues about it.
226226

227227
**Note**: ESM Instrumentation is not yet supported for Node 20.
228228

experimental/packages/opentelemetry-sdk-node/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ An array of span processors to register to the tracer provider.
132132

133133
### traceExporter
134134

135-
Configure a trace exporter. If an exporter is configured, it will be used with a [BatchSpanProcessor](../../../packages/opentelemetry-sdk-trace-base/src/platform/node/export/BatchSpanProcessor.ts). If an exporter OR span processor is not configured programatically, this package will auto setup the default `otlp` exporter with `http/protobuf` protocol with a `BatchSpanProcessor`.
135+
Configure a trace exporter. If an exporter is configured, it will be used with a [BatchSpanProcessor](../../../packages/opentelemetry-sdk-trace-base/src/platform/node/export/BatchSpanProcessor.ts). If an exporter OR span processor is not configured programmatically, this package will auto setup the default `otlp` exporter with `http/protobuf` protocol with a `BatchSpanProcessor`.
136136

137137
### spanLimits
138138

experimental/packages/opentelemetry-sdk-node/test/TracerProviderWithEnvExporter.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('set up trace exporter with env exporters', () => {
132132
assert(listOfProcessors === undefined);
133133
delete env.OTEL_TRACES_EXPORTER;
134134
});
135-
it('log warning that sdk will not be initalized when exporter is set to none', async () => {
135+
it('log warning that sdk will not be initialized when exporter is set to none', async () => {
136136
env.OTEL_TRACES_EXPORTER = 'none';
137137
new TracerProviderWithEnvExporters();
138138

experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ describe('setup exporter from env', () => {
951951
assert(activeProcessor instanceof NoopSpanProcessor);
952952
delete env.OTEL_TRACES_EXPORTER;
953953
});
954-
it('log warning that sdk will not be initalized when exporter is set to none', async () => {
954+
it('log warning that sdk will not be initialized when exporter is set to none', async () => {
955955
env.OTEL_TRACES_EXPORTER = 'none';
956956
const sdk = new NodeSDK();
957957
sdk.start();

experimental/packages/otlp-exporter-base/src/util.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export function parseHeaders(
3535
if (typeof value !== 'undefined') {
3636
headers[key] = String(value);
3737
} else {
38-
diag.warn(`Header "${key}" has wrong value and will be ignored`);
38+
diag.warn(
39+
`Header "${key}" has invalid value (${value}) and will be ignored`
40+
);
3941
}
4042
});
4143
return headers;

0 commit comments

Comments
 (0)