Skip to content

Commit

Permalink
Merge branch 'main' into grpc-err-monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
cjihrig authored Jan 27, 2025
2 parents ab7dd28 + bdc0e3a commit 67a99b2
Show file tree
Hide file tree
Showing 23 changed files with 244 additions and 251 deletions.
3 changes: 3 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ All notable changes to experimental packages in this project will be documented

### :house: (Internal)

* chore(instrumentation-grpc): remove unused findIndex() function [#5372](https://github.com/open-telemetry/opentelemetry-js/pull/5372) @cjihrig
* refactor(otlp-exporter-base): remove unnecessary isNaN() checks [#5374](https://github.com/open-telemetry/opentelemetry-js/pull/5374) @cjihrig

## 0.57.0

### :rocket: (Enhancement)
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-logs-otlp-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
],
"sideEffects": false,
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/resources": "1.30.0",
"@types/mocha": "10.0.10",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-logs-otlp-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/context-zone": "1.30.0",
"@opentelemetry/propagator-b3": "1.30.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,6 @@ import type { IgnoreMatcher } from './types';
export const URI_REGEX =
/(?:([A-Za-z0-9+.-]+):(?:\/\/)?)?(?<name>[A-Za-z0-9+.-]+):(?<port>[0-9+.-]+)$/;

// Equivalent to lodash _.findIndex
export const findIndex: <T>(args: T[], fn: (arg: T) => boolean) => number = (
args,
fn
) => {
let index = -1;
for (const arg of args) {
index++;
if (fn(arg)) {
return index;
}
}
return -1;
};

/**
* Convert a grpc status code to an opentelemetry SpanStatus code.
* @param status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/context-zone": "1.30.0",
"@opentelemetry/propagator-b3": "1.30.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
"@opentelemetry/api": "^1.3.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/sdk-metrics": "1.30.0",
"@types/mocha": "10.0.10",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/otlp-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"@opentelemetry/otlp-transformer": "0.57.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ export interface OtlpSharedConfiguration {
}

export function validateTimeoutMillis(timeoutMillis: number) {
if (
!Number.isNaN(timeoutMillis) &&
Number.isFinite(timeoutMillis) &&
timeoutMillis > 0
) {
if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {
return timeoutMillis;
}
throw new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ function parseAndValidateTimeoutFromEnv(
const envTimeout = process.env[timeoutEnvVar]?.trim();
if (envTimeout != null && envTimeout !== '') {
const definedTimeout = Number(envTimeout);
if (
!Number.isNaN(definedTimeout) &&
Number.isFinite(definedTimeout) &&
definedTimeout > 0
) {
if (Number.isFinite(definedTimeout) && definedTimeout > 0) {
return definedTimeout;
}
diag.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
mergeOtlpSharedConfigurationWithDefaults,
OtlpSharedConfiguration,
} from '../../../src';
import { validateTimeoutMillis } from '../../../src/configuration/shared-configuration';

export function testSharedConfigBehavior<T extends OtlpSharedConfiguration>(
sut: (
Expand Down Expand Up @@ -134,3 +135,15 @@ describe('mergeOtlpSharedConfigurationWithDefaults', function () {
concurrencyLimit: 2,
});
});

describe('validateTimeoutMillis', function () {
it('throws if timeout is not a positive number', () => {
const values = [null, '1', true, NaN, Infinity, -Infinity, -1, 0];

for (let i = 0; i < values.length; ++i) {
assert.throws(() => {
validateTimeoutMillis(values[i] as any);
}, /Configuration: timeoutMillis is invalid/);
}
});
});
2 changes: 1 addition & 1 deletion experimental/packages/sdk-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@opentelemetry/api": ">=1.4.0 <1.10.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/core": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/sdk-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"@opentelemetry/api": ">=1.4.0 <1.10.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@opentelemetry/api": ">=1.4.0 <1.10.0",
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/[email protected]",
"@types/mocha": "10.0.10",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/web-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@opentelemetry/semantic-conventions": "1.28.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/core": "7.26.7",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/api-events": "0.57.0",
"@opentelemetry/api-logs": "0.57.0",
Expand Down
Loading

0 comments on commit 67a99b2

Please sign in to comment.