Skip to content

Commit

Permalink
feat: upgrade to OTel 1.8.0 / 0.34.0 (#612)
Browse files Browse the repository at this point in the history
* feat: upgrade to sdk 1.8.0, experimental 0.34.0

* test: run mocha in parallel

* chore: lint

* chore: upgrade package-lock

* test: increase test timeout

* test: improvements to parallel

* chore: add protobufjs to deps
  • Loading branch information
seemk authored Nov 22, 2022
1 parent a0ec7b2 commit 1d94317
Show file tree
Hide file tree
Showing 11 changed files with 1,422 additions and 4,497 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ For more information, see [Correlating traces with logs](./docs/correlate-logs-t
By default the following instrumentations will automatically be enabled:

* [`@opentelemetry/instrumentation-amqplib`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-amqplib)
* [`@opentelemetry/instrumentation-aws-lambda`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-aws-lambda)
* [`@opentelemetry/instrumentation-aws-sdk`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-aws-sdk)
* [`@opentelemetry/instrumentation-bunyan`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-bunyan)
* [`@opentelemetry/instrumentation-cassandra-driver`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-cassandra)
Expand Down
6 changes: 3 additions & 3 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ For configuration options, see [advanced configuration](advanced-config.md#metri

## Usage (custom metrics)

Add `@opentelemetry/api-metrics` to your dependencies.
Add `@opentelemetry/api` to your dependencies.

```javascript
const { start } = require('@splunk/otel');
const { Resource } = require('@opentelemetry/resources');
const { metrics } = require('@opentelemetry/api-metrics');
const { metrics } = require('@opentelemetry/api');

// All fields are optional.
start({
Expand Down Expand Up @@ -118,7 +118,7 @@ getSignalFxClient().send({

```javascript
const { start } = require('@splunk/otel');
const { metrics } = require('@opentelemetry/api-metrics');
const { metrics } = require('@opentelemetry/api');

start({
serviceName: 'my-service',
Expand Down
5,786 changes: 1,360 additions & 4,426 deletions package-lock.json

Large diffs are not rendered by default.

112 changes: 53 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint:fix": "eslint . --ext .ts --fix",
"lint": "eslint . --ext .ts",
"lint:commits": "commitlint",
"test": "cross-env TEST_ALLOW_DOUBLE_START=y nyc ts-mocha --timeout 5000 -p tsconfig.json 'test/**/*.test.ts'",
"test": "cross-env TEST_ALLOW_DOUBLE_START=y nyc ts-mocha --timeout 60s --parallel --jobs 2 -p tsconfig.json 'test/**/*.test.ts'",
"prebuild:current": "node scripts/prebuild-current.js",
"prebuild:os": "node scripts/prebuild-os.js",
"profile:proto": "pbjs -t static-module -w commonjs -o src/profiling/proto/profile.js protos/pprof/profile.proto",
Expand Down Expand Up @@ -93,68 +93,62 @@
"dependencies": {
"@grpc/grpc-js": "^1.7.1",
"@grpc/proto-loader": "^0.7.3",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/api-metrics": "^0.33.0",
"@opentelemetry/context-async-hooks": "^1.7.0",
"@opentelemetry/core": "^1.7.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.33.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.33.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.33.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.33.0",
"@opentelemetry/instrumentation": "^0.33.0",
"@opentelemetry/instrumentation-amqplib": "^0.31.0",
"@opentelemetry/instrumentation-aws-lambda": "^0.33.0",
"@opentelemetry/instrumentation-aws-sdk": "^0.9.2",
"@opentelemetry/instrumentation-bunyan": "^0.30.0",
"@opentelemetry/instrumentation-cassandra-driver": "^0.30.0",
"@opentelemetry/instrumentation-connect": "^0.30.0",
"@opentelemetry/instrumentation-dataloader": "^0.2.0",
"@opentelemetry/instrumentation-dns": "^0.30.0",
"@opentelemetry/instrumentation-express": "^0.31.2",
"@opentelemetry/instrumentation-fastify": "^0.30.0",
"@opentelemetry/instrumentation-generic-pool": "^0.30.0",
"@opentelemetry/instrumentation-graphql": "^0.31.0",
"@opentelemetry/instrumentation-grpc": "^0.33.0",
"@opentelemetry/instrumentation-hapi": "^0.30.0",
"@opentelemetry/instrumentation-http": "^0.33.0",
"@opentelemetry/instrumentation-ioredis": "^0.32.1",
"@opentelemetry/instrumentation-knex": "^0.30.0",
"@opentelemetry/instrumentation-koa": "^0.32.0",
"@opentelemetry/instrumentation-memcached": "^0.30.0",
"@opentelemetry/instrumentation-mongodb": "^0.32.1",
"@opentelemetry/instrumentation-mysql": "^0.31.1",
"@opentelemetry/instrumentation-mysql2": "^0.32.0",
"@opentelemetry/instrumentation-nestjs-core": "^0.31.0",
"@opentelemetry/instrumentation-net": "^0.30.1",
"@opentelemetry/instrumentation-pg": "^0.31.1",
"@opentelemetry/instrumentation-pino": "^0.32.0",
"@opentelemetry/instrumentation-redis": "^0.33.0",
"@opentelemetry/instrumentation-redis-4": "^0.33.0",
"@opentelemetry/instrumentation-restify": "^0.30.0",
"@opentelemetry/instrumentation-router": "^0.30.0",
"@opentelemetry/instrumentation-tedious": "^0.4.0",
"@opentelemetry/instrumentation-winston": "^0.30.0",
"@opentelemetry/propagator-b3": "^1.7.0",
"@opentelemetry/resources": "^1.7.0",
"@opentelemetry/sdk-metrics": "^0.33.0",
"@opentelemetry/sdk-trace-base": "^1.7.0",
"@opentelemetry/sdk-trace-node": "^1.7.0",
"@opentelemetry/semantic-conventions": "^1.7.0",
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/context-async-hooks": "^1.8.0",
"@opentelemetry/core": "^1.8.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.34.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.34.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.34.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.34.0",
"@opentelemetry/instrumentation": "^0.34.0",
"@opentelemetry/instrumentation-amqplib": "^0.32.0",
"@opentelemetry/instrumentation-aws-sdk": "^0.10.0",
"@opentelemetry/instrumentation-bunyan": "^0.31.0",
"@opentelemetry/instrumentation-cassandra-driver": "^0.32.0",
"@opentelemetry/instrumentation-connect": "^0.31.0",
"@opentelemetry/instrumentation-dataloader": "^0.3.0",
"@opentelemetry/instrumentation-dns": "^0.31.0",
"@opentelemetry/instrumentation-express": "^0.32.0",
"@opentelemetry/instrumentation-fastify": "^0.31.0",
"@opentelemetry/instrumentation-generic-pool": "^0.31.0",
"@opentelemetry/instrumentation-graphql": "^0.33.0",
"@opentelemetry/instrumentation-grpc": "^0.34.0",
"@opentelemetry/instrumentation-hapi": "^0.31.0",
"@opentelemetry/instrumentation-http": "^0.34.0",
"@opentelemetry/instrumentation-ioredis": "^0.33.0",
"@opentelemetry/instrumentation-knex": "^0.31.0",
"@opentelemetry/instrumentation-koa": "^0.34.0",
"@opentelemetry/instrumentation-memcached": "^0.31.0",
"@opentelemetry/instrumentation-mongodb": "^0.33.0",
"@opentelemetry/instrumentation-mysql": "^0.32.0",
"@opentelemetry/instrumentation-mysql2": "^0.33.0",
"@opentelemetry/instrumentation-nestjs-core": "^0.32.0",
"@opentelemetry/instrumentation-net": "^0.31.0",
"@opentelemetry/instrumentation-pg": "^0.33.0",
"@opentelemetry/instrumentation-pino": "^0.33.0",
"@opentelemetry/instrumentation-redis": "^0.34.0",
"@opentelemetry/instrumentation-redis-4": "^0.34.0",
"@opentelemetry/instrumentation-restify": "^0.31.0",
"@opentelemetry/instrumentation-router": "^0.32.0",
"@opentelemetry/instrumentation-tedious": "^0.5.0",
"@opentelemetry/instrumentation-winston": "^0.31.0",
"@opentelemetry/propagator-b3": "^1.8.0",
"@opentelemetry/resources": "^1.8.0",
"@opentelemetry/sdk-metrics": "^1.8.0",
"@opentelemetry/sdk-trace-base": "^1.8.0",
"@opentelemetry/sdk-trace-node": "^1.8.0",
"@opentelemetry/semantic-conventions": "^1.8.0",
"nan": "^2.17.0",
"node-gyp-build": "^4.5.0",
"opentelemetry-instrumentation-elasticsearch": "^0.32.0",
"opentelemetry-instrumentation-kafkajs": "^0.32.0",
"opentelemetry-instrumentation-mongoose": "^0.32.0",
"opentelemetry-instrumentation-sequelize": "^0.32.0",
"opentelemetry-instrumentation-typeorm": "^0.32.0",
"opentelemetry-instrumentation-elasticsearch": "^0.34.0",
"opentelemetry-instrumentation-kafkajs": "^0.34.0",
"opentelemetry-instrumentation-mongoose": "^0.34.0",
"opentelemetry-instrumentation-sequelize": "^0.34.0",
"opentelemetry-instrumentation-typeorm": "^0.34.0",
"protobufjs": "^7.1.2",
"semver": "^7.3.8"
},
"peerDependencies": {
"@opentelemetry/api": "^1.2.0"
},
"peerDependenciesMeta": {
"@opentelemetry/api": {
"optional": true
}
"@opentelemetry/api": "^1.3.0"
}
}
1 change: 0 additions & 1 deletion src/instrumentations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { load } from './loader';

const bundledInstrumentations: [string, string][] = [
['@opentelemetry/instrumentation-amqplib', 'AmqplibInstrumentation'],
['@opentelemetry/instrumentation-aws-lambda', 'AwsLambdaInstrumentation'],
['@opentelemetry/instrumentation-aws-sdk', 'AwsInstrumentation'],
['@opentelemetry/instrumentation-bunyan', 'BunyanInstrumentation'],
[
Expand Down
2 changes: 1 addition & 1 deletion src/metrics/console_metric_exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
ResourceMetrics,
InstrumentType,
} from '@opentelemetry/sdk-metrics';
import { ValueType } from '@opentelemetry/api-metrics';
import { ValueType } from '@opentelemetry/api';
import {
ExportResult,
ExportResultCode,
Expand Down
3 changes: 1 addition & 2 deletions src/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { diag } from '@opentelemetry/api';
import { Counter, metrics, ValueType } from '@opentelemetry/api-metrics';
import { Counter, diag, metrics, ValueType } from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import {
MeterProvider,
Expand Down
2 changes: 1 addition & 1 deletion test/instrumentations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('instrumentations', () => {
const loadStub = sinon.stub(loader, 'load');
try {
const inst = instrumentations.getInstrumentations();
sinon.assert.callCount(loadStub, 37);
sinon.assert.callCount(loadStub, 36);
} finally {
loadStub.reset();
loadStub.restore();
Expand Down
2 changes: 1 addition & 1 deletion test/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as assert from 'assert';
import { Resource } from '@opentelemetry/resources';
import { metrics } from '@opentelemetry/api-metrics';
import { metrics } from '@opentelemetry/api';
import {
AggregationTemporality,
DataPointType,
Expand Down
2 changes: 1 addition & 1 deletion test/profiling/profiling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('profiling', () => {

// Stop flushes the exporters, hence the extra call count
assert.deepStrictEqual(sendCallCount, 2);
}).timeout(10_000);
});

it('exports heap profiles', async () => {
let sendCallCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/uri_parameter_capture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
SpanProcessor,
} from '@opentelemetry/sdk-trace-base';

const PORT = 9111;
const PORT = 9112;
const SERVER_URL = `http://localhost:${PORT}`;

describe('Capturing URI parameters', () => {
Expand Down

0 comments on commit 1d94317

Please sign in to comment.