Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update core dependencies stable ^1.3.1 experimental ^0.29.2 #1042

Merged
merged 9 commits into from
Jun 8, 2022
6 changes: 3 additions & 3 deletions metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/instrumentation-amqplib": "^0.29.0",
"@opentelemetry/instrumentation-aws-lambda": "^0.31.0",
"@opentelemetry/instrumentation-aws-sdk": "^0.7.0",
Expand All @@ -58,9 +58,9 @@
"@opentelemetry/instrumentation-fastify": "^0.27.0",
"@opentelemetry/instrumentation-generic-pool": "^0.28.0",
"@opentelemetry/instrumentation-graphql": "^0.28.0",
"@opentelemetry/instrumentation-grpc": "^0.28.0",
"@opentelemetry/instrumentation-grpc": "^0.29.2",
"@opentelemetry/instrumentation-hapi": "^0.28.0",
"@opentelemetry/instrumentation-http": "^0.28.0",
"@opentelemetry/instrumentation-http": "^0.29.2",
"@opentelemetry/instrumentation-ioredis": "^0.29.0",
"@opentelemetry/instrumentation-knex": "^0.28.0",
"@opentelemetry/instrumentation-koa": "^0.29.0",
Expand Down
6 changes: 3 additions & 3 deletions metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
"webpack-merge": "5.8.0"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/instrumentation-document-load": "^0.28.0",
"@opentelemetry/instrumentation-fetch": "^0.28.0",
"@opentelemetry/instrumentation-fetch": "^0.29.2",
"@opentelemetry/instrumentation-user-interaction": "^0.29.0",
"@opentelemetry/instrumentation-xml-http-request": "^0.28.0"
"@opentelemetry/instrumentation-xml-http-request": "^0.29.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
"@material-ui/lab": "4.0.0-alpha.60",
"@opentelemetry/context-zone": "^1.0.0",
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.28.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.29.2",
"@opentelemetry/exporter-zipkin": "^1.0.0",
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/instrumentation-document-load": "^0.28.0",
"@opentelemetry/instrumentation-fetch": "^0.28.0",
"@opentelemetry/instrumentation-xml-http-request": "^0.28.0",
"@opentelemetry/instrumentation-fetch": "^0.29.2",
"@opentelemetry/instrumentation-xml-http-request": "^0.29.2",
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/sdk-trace-base": "^1.0.0",
"@opentelemetry/sdk-trace-web": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/api-metrics": "^0.28.0",
"@opentelemetry/api-metrics": "^0.29.2",
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/sdk-metrics-base": "^0.28.0",
"@opentelemetry/sdk-metrics-base": "^0.29.2",
"systeminformation": "^5.0.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/opentelemetry-host-metrics#readme"
Expand Down
100 changes: 43 additions & 57 deletions packages/opentelemetry-host-metrics/src/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,77 +164,63 @@ export class HostMetrics extends BaseMetrics {
* Creates metrics
*/
protected _createMetrics(): void {
this._meter.createObservableCounter(
enums.METRIC_NAMES.CPU_TIME,
observableResult => {
const cpuUsageData = this._getCpuUsageData();
this._updateCpuTime(observableResult, cpuUsageData);
},
{
this._meter
.createObservableCounter(enums.METRIC_NAMES.CPU_TIME, {
description: 'Cpu time in seconds',
unit: 's',
}
);
this._meter.createObservableGauge(
enums.METRIC_NAMES.CPU_UTILIZATION,
observableResult => {
})
.addCallback(observableResult => {
const cpuUsageData = this._getCpuUsageData();
this._updateCpuUtilisation(observableResult, cpuUsageData);
},
{
this._updateCpuTime(observableResult, cpuUsageData);
});
this._meter
.createObservableGauge(enums.METRIC_NAMES.CPU_UTILIZATION, {
description: 'Cpu usage time 0-1',
}
);
this._meter.createObservableGauge(
enums.METRIC_NAMES.MEMORY_USAGE,
observableResult => {
})
.addCallback(observableResult => {
const cpuUsageData = this._getCpuUsageData();
this._updateCpuUtilisation(observableResult, cpuUsageData);
});
this._meter
.createObservableGauge(enums.METRIC_NAMES.MEMORY_USAGE, {
description: 'Memory usage in bytes',
})
.addCallback(observableResult => {
const memoryUsageData = this._getMemoryData();
this._updateMemUsage(observableResult, memoryUsageData);
},
{
description: 'Memory usage in bytes',
}
);
this._meter.createObservableGauge(
enums.METRIC_NAMES.MEMORY_UTILIZATION,
observableResult => {
});
this._meter
.createObservableGauge(enums.METRIC_NAMES.MEMORY_UTILIZATION, {
description: 'Memory usage 0-1',
})
.addCallback(observableResult => {
const memoryUsageData = this._getMemoryData();
this._updateMemUtilization(observableResult, memoryUsageData);
},
{
description: 'Memory usage 0-1',
}
);
this._meter.createObservableCounter(
enums.METRIC_NAMES.NETWORK_DROPPED,
async observableResult => {
});
this._meter
.createObservableCounter(enums.METRIC_NAMES.NETWORK_DROPPED, {
description: 'Network dropped packets',
})
.addCallback(async observableResult => {
const networkData = await this._getNetworkData();
this._updateNetworkDropped(observableResult, networkData);
},
{
description: 'Network dropped packets',
}
);
this._meter.createObservableCounter(
enums.METRIC_NAMES.NETWORK_ERRORS,
async observableResult => {
});
this._meter
.createObservableCounter(enums.METRIC_NAMES.NETWORK_ERRORS, {
description: 'Network errors counter',
})
.addCallback(async observableResult => {
const networkData = await this._getNetworkData();
this._updateNetworkErrors(observableResult, networkData);
},
{
description: 'Network errors counter',
}
);
this._meter.createObservableCounter(
enums.METRIC_NAMES.NETWORK_IO,
async observableResult => {
});
this._meter
.createObservableCounter(enums.METRIC_NAMES.NETWORK_IO, {
description: 'Network transmit and received bytes',
})
.addCallback(async observableResult => {
const networkData = await this._getNetworkData();
this._updateNetworkIO(observableResult, networkData);
},
{
description: 'Network transmit and received bytes',
}
);
});
}

/**
Expand Down
15 changes: 9 additions & 6 deletions packages/opentelemetry-host-metrics/test/metric.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const SI = require('systeminformation');
import { MetricAttributes } from '@opentelemetry/api-metrics';
import {
AggregationTemporality,
DataPoint,
Histogram,
MeterProvider,
Expand All @@ -32,6 +33,9 @@ const cpuJson = require('./mocks/cpu.json');
const networkJson = require('./mocks/network.json');

class TestMetricReader extends MetricReader {
public selectAggregationTemporality(): AggregationTemporality {
return AggregationTemporality.CUMULATIVE;
}
protected async onForceFlush(): Promise<void> {}
protected async onShutdown(): Promise<void> {}
}
Expand Down Expand Up @@ -214,12 +218,11 @@ async function getRecords(
metricReader: MetricReader,
name: string
): Promise<MetricData> {
const resourceMetrics = await metricReader.collect();
assert(resourceMetrics != null);
assert.strictEqual(resourceMetrics.instrumentationLibraryMetrics.length, 1);
const instrumentationLibraryMetrics =
resourceMetrics.instrumentationLibraryMetrics[0];
const metricDataList = instrumentationLibraryMetrics.metrics.filter(
const collectionResult = await metricReader.collect();
assert(collectionResult != null);
assert.strictEqual(collectionResult.resourceMetrics.scopeMetrics.length, 1);
const scopeMetrics = collectionResult.resourceMetrics.scopeMetrics[0];
const metricDataList = scopeMetrics.metrics.filter(
metric => metric.descriptor.name === name
);
assert.strictEqual(metricDataList.length, 1);
Expand Down
10 changes: 5 additions & 5 deletions packages/opentelemetry-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
},
"dependencies": {
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/exporter-jaeger": "^1.0.0",
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/sdk-trace-node": "^1.0.0",
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/sdk-trace-base": "^1.0.0",
"@opentelemetry/exporter-jaeger": "^1.3.1",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/sdk-trace-node": "^1.3.1",
"@opentelemetry/resources": "^1.3.1",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@opentelemetry/semantic-conventions": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-amqplib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"dependencies": {
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/semantic-conventions": "^1.0.0",
"@types/amqplib": "^0.5.17"
},
Expand Down
10 changes: 5 additions & 5 deletions plugins/node/instrumentation-fs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/context-async-hooks": "1.2.0",
"@opentelemetry/resources": "1.2.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-node": "1.2.0",
"@opentelemetry/context-async-hooks": "^1.3.1",
"@opentelemetry/resources": "^1.3.1",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@opentelemetry/sdk-trace-node": "^1.3.1",
"@types/mocha": "7.0.2",
"@types/node": "14.17.9",
"@types/sinon": "^10.0.11",
Expand All @@ -60,7 +60,7 @@
},
"dependencies": {
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/semantic-conventions": "^1.0.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-fs#readme"
Expand Down
6 changes: 3 additions & 3 deletions plugins/node/instrumentation-tedious/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/context-async-hooks": "1.2.0",
"@opentelemetry/context-async-hooks": "^1.3.1",
"@opentelemetry/contrib-test-utils": "^0.30.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@types/mocha": "7.0.2",
"@types/node": "16.11.21",
"gts": "3.1.0",
Expand All @@ -63,7 +63,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/semantic-conventions": "^1.0.0",
"@types/tedious": "^4.0.6"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/core": "1.2.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-node": "1.2.0",
"@opentelemetry/core": "^1.3.1",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@opentelemetry/sdk-trace-node": "^1.3.1",
"@types/mocha": "7.0.2",
"@types/node": "16.11.21",
"gts": "3.1.0",
Expand All @@ -59,7 +59,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/propagator-aws-xray": "^1.1.0",
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/semantic-conventions": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"dependencies": {
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/semantic-conventions": "^1.0.0",
"@opentelemetry/propagation-utils": "^0.28.0"
},
Expand All @@ -60,7 +60,7 @@
"@aws-sdk/types": "3.78.0",
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/contrib-test-utils": "^0.30.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@types/mocha": "8.2.3",
"@types/node": "16.11.21",
"@types/sinon": "10.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/context-async-hooks": "1.2.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-node": "1.2.0",
"@opentelemetry/context-async-hooks": "^1.3.1",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@opentelemetry/sdk-trace-node": "^1.3.1",
"@types/mocha": "7.0.2",
"@types/node": "16.11.21",
"@types/sinon": "10.0.2",
Expand All @@ -65,7 +65,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@types/bunyan": "1.8.7"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-bunyan#readme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/context-async-hooks": "1.2.0",
"@opentelemetry/context-async-hooks": "^1.3.1",
"@opentelemetry/contrib-test-utils": "^0.30.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-node": "1.2.0",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@opentelemetry/sdk-trace-node": "^1.3.1",
"@types/mocha": "7.0.2",
"@types/node": "16.11.21",
"@types/semver": "7.3.8",
Expand All @@ -65,7 +65,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/semantic-conventions": "^1.0.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-cassandra#readme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/context-async-hooks": "1.2.0",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/sdk-trace-node": "1.2.0",
"@opentelemetry/context-async-hooks": "^1.3.1",
"@opentelemetry/sdk-trace-base": "^1.3.1",
"@opentelemetry/sdk-trace-node": "^1.3.1",
"@types/mocha": "7.0.2",
"@types/node": "16.11.21",
"connect": "3.7.0",
Expand All @@ -60,7 +60,7 @@
},
"dependencies": {
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/instrumentation": "^0.28.0",
"@opentelemetry/instrumentation": "^0.29.2",
"@opentelemetry/semantic-conventions": "^1.0.0",
"@types/connect": "3.4.35"
},
Expand Down
Loading