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

feat: use GA version of metrics #1281

Merged
merged 5 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"access": "public"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
"@opentelemetry/api": "^1.3.0"
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/api": "^1.3.0",
"@types/mocha": "8.2.3",
"@types/node": "18.11.7",
"@types/sinon": "10.0.2",
Expand All @@ -59,9 +59,8 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/api-metrics": "^0.32.0",
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/sdk-metrics": "^0.32.0",
"@opentelemetry/core": "^1.8.0",
Flarna marked this conversation as resolved.
Show resolved Hide resolved
"@opentelemetry/sdk-metrics": "^1.8.0",
"systeminformation": "^5.0.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/opentelemetry-host-metrics#readme"
Expand Down
5 changes: 2 additions & 3 deletions packages/opentelemetry-host-metrics/src/BaseMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import * as api from '@opentelemetry/api';
import * as apiMetrics from '@opentelemetry/api-metrics';
import * as metrics from '@opentelemetry/sdk-metrics';

import { VERSION } from './version';
Expand Down Expand Up @@ -45,15 +44,15 @@ const DEFAULT_NAME = 'opentelemetry-host-metrics';
export abstract class BaseMetrics {
protected _logger = api.diag;
protected _maxTimeoutUpdateMS: number;
protected _meter: apiMetrics.Meter;
protected _meter: api.Meter;
private _name: string;

constructor(config: MetricsCollectorConfig) {
this._name = config.name || DEFAULT_NAME;
this._maxTimeoutUpdateMS =
config.maxTimeoutUpdateMS || DEFAULT_MAX_TIMEOUT_UPDATE_MS;
const meterProvider =
config.meterProvider! || apiMetrics.metrics.getMeterProvider();
config.meterProvider! || api.metrics.getMeterProvider();
if (!config.meterProvider) {
this._logger.warn('No meter provider, using default');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-host-metrics/src/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { BaseMetrics } from './BaseMetrics';
import * as api from '@opentelemetry/api-metrics';
import * as api from '@opentelemetry/api';
import * as enums from './enum';

import { getCpuUsageData, getMemoryData } from './stats/common';
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-host-metrics/test/metric.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

const SI = require('systeminformation');
import { MetricAttributes } from '@opentelemetry/api-metrics';
import { MetricAttributes } from '@opentelemetry/api';
Flarna marked this conversation as resolved.
Show resolved Hide resolved
import {
AggregationTemporality,
DataPoint,
Expand All @@ -33,7 +33,7 @@ const cpuJson = require('./mocks/cpu.json');
const networkJson = require('./mocks/network.json');

class TestMetricReader extends MetricReader {
public selectAggregationTemporality(): AggregationTemporality {
public override selectAggregationTemporality(): AggregationTemporality {
return AggregationTemporality.CUMULATIVE;
}
protected async onForceFlush(): Promise<void> {}
Expand Down
9 changes: 8 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
},
{
"groupName": "Otel Core experimental",
"matchPackageNames": ["@opentelemetry/sdk-node", "@opentelemetry/instrumentation", "@opentelemetry/instrumentation-grpc", "@opentelemetry/instrumentation-http", "@opentelemetry/instrumentation-fetch", "@opentelemetry/instrumentation-xml-http-request", "@opentelemetry/api-metrics", "@opentelemetry/sdk-metrics" ],
"matchPackageNames": [
"@opentelemetry/instrumentation",
"@opentelemetry/instrumentation-grpc",
"@opentelemetry/instrumentation-http",
"@opentelemetry/instrumentation-fetch",
"@opentelemetry/instrumentation-xml-http-request",
"@opentelemetry/sdk-node"
],
"rangeStrategy": "bump"
}
],
Expand Down