Skip to content

Commit 045f488

Browse files
authored
Merge branch 'main' into move-xray-propagator-3
2 parents 9d38291 + 87e25c5 commit 045f488

File tree

21 files changed

+296
-113
lines changed

21 files changed

+296
-113
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
1313

1414
* feat(sdk-trace-base): log resource attributes in ConsoleSpanExporter [#4605](https://github.com/open-telemetry/opentelemetry-js/pull/4605) @pichlermarc
1515
* feat(propagator-aws-xray): moved AWS Xray propagator from contrib [4603](https://github.com/open-telemetry/opentelemetry-js/pull/4603) @martinkuba
16+
* feat(resources): new experimental detector ServiceInstanceIdDetectorSync that sets the value for `service.instance.id` as random UUID.
1617

1718
### :bug: (Bug Fix)
1819

experimental/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ All notable changes to experimental packages in this project will be documented
1616
### :rocket: (Enhancement)
1717

1818
* feat(otlp-transformer): consolidate scope/resource creation in transformer [#4600](https://github.com/open-telemetry/opentelemetry-js/pull/4600)
19+
* feat(sdk-logs): print message when attributes are dropped due to attribute count limit [#4614](https://github.com/open-telemetry/opentelemetry-js/pull/4614) @HyunnoH
1920

2021
### :bug: (Bug Fix)
2122

23+
* fix(otlp-grpc-exporter-base): avoid TypeError on exporter shutdown [#4612](https://github.com/open-telemetry/opentelemetry-js/pull/4612)
24+
* fix(instrumentation): Don't use `require` to load `package.json` files
25+
2226
### :books: (Refine Doc)
2327

2428
### :house: (Internal)

experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ const testCollectorExporter = (params: TestParams) => {
224224
setTimeout(() => {
225225
const result = responseSpy.args[0][0] as core.ExportResult;
226226
assert.strictEqual(result.code, core.ExportResultCode.FAILED);
227-
assert.strictEqual(
227+
assert.match(
228228
responseSpy.args[0][0].error.details,
229-
'Deadline exceeded'
229+
/Deadline exceeded.*/
230230
);
231231
done();
232232
}, 300);

experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ const testCollectorExporter = (params: TestParams) => {
231231
setTimeout(() => {
232232
const result = responseSpy.args[0][0] as core.ExportResult;
233233
assert.strictEqual(result.code, core.ExportResultCode.FAILED);
234-
assert.strictEqual(
234+
assert.match(
235235
responseSpy.args[0][0].error.details,
236-
'Deadline exceeded'
236+
/Deadline exceeded.*/
237237
);
238238
done();
239239
}, 300);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
**Note: This is an experimental package under active development. New releases may include breaking changes.**
77

88
This module provides auto instrumentation for web using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
9-
(Note: This instrumentation does **not** instrument [Node.js' fetch](https://nodejs.org/api/globals.html#fetch). See [this issue](https://github.com/open-telemetry/opentelemetry-js/issues/4333).)
9+
(Note: This instrumentation does **not** instrument [Node.js' fetch](https://nodejs.org/api/globals.html#fetch). See [`@opentelemetry/instrumentation-undici`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-undici/) for that.)
1010

1111
## Installation
1212

experimental/packages/opentelemetry-instrumentation/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"@babel/core": "7.23.6",
8686
"@babel/preset-env": "7.22.20",
8787
"@opentelemetry/api": "1.8.0",
88-
"@opentelemetry/api-logs": "0.47.0",
8988
"@opentelemetry/sdk-metrics": "1.23.0",
9089
"@types/mocha": "10.0.6",
9190
"@types/node": "18.6.5",

experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { InstrumentationModuleDefinition } from '../../types';
3030
import { diag } from '@opentelemetry/api';
3131
import type { OnRequireFn } from 'require-in-the-middle';
3232
import { Hook } from 'require-in-the-middle';
33+
import { readFileSync } from 'fs';
3334

3435
/**
3536
* Base abstract class for instrumenting node plugins
@@ -160,8 +161,10 @@ export abstract class InstrumentationBase<T = any>
160161

161162
private _extractPackageVersion(baseDir: string): string | undefined {
162163
try {
163-
// eslint-disable-next-line @typescript-eslint/no-var-requires
164-
const version = require(path.join(baseDir, 'package.json')).version;
164+
const json = readFileSync(path.join(baseDir, 'package.json'), {
165+
encoding: 'utf8',
166+
});
167+
const version = JSON.parse(json).version;
165168
return typeof version === 'string' ? version : undefined;
166169
} catch (error) {
167170
diag.warn('Failed extracting version', baseDir);

0 commit comments

Comments
 (0)