Skip to content

Commit

Permalink
fix(host-metrics): macOS bundling fix (#2071)
Browse files Browse the repository at this point in the history
  • Loading branch information
Netail authored Jun 3, 2024
1 parent 7272ca8 commit 7d6ddea
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 128 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions packages/opentelemetry-host-metrics/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare module 'systeminformation/lib/network' {
export { networkStats } from 'systeminformation';
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"dependencies": {
"@opentelemetry/sdk-metrics": "^1.8.0",
"systeminformation": "^5.21.20"
"systeminformation": "5.22.9"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/opentelemetry-host-metrics#readme"
}
13 changes: 6 additions & 7 deletions packages/opentelemetry-host-metrics/src/BaseMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import * as api from '@opentelemetry/api';
import * as metrics from '@opentelemetry/sdk-metrics';
import { Meter, diag, metrics } from '@opentelemetry/api';
import { MeterProvider } from '@opentelemetry/sdk-metrics';

import { PACKAGE_NAME, PACKAGE_VERSION } from './version';

Expand All @@ -24,7 +24,7 @@ import { PACKAGE_NAME, PACKAGE_VERSION } from './version';
*/
export interface MetricsCollectorConfig {
// Meter Provider
meterProvider?: metrics.MeterProvider;
meterProvider?: MeterProvider;
// Character to be used to join metrics - default is "."
metricNameSeparator?: string;
// Name of component
Expand All @@ -39,14 +39,13 @@ const DEFAULT_NAME = PACKAGE_NAME;
* Base Class for metrics
*/
export abstract class BaseMetrics {
protected _logger = api.diag;
protected _meter: api.Meter;
protected _logger = diag;
protected _meter: Meter;
private _name: string;

constructor(config: MetricsCollectorConfig) {
this._name = config.name || DEFAULT_NAME;
const meterProvider =
config.meterProvider || api.metrics.getMeterProvider();
const meterProvider = config.meterProvider || metrics.getMeterProvider();
if (!config.meterProvider) {
this._logger.warn('No meter provider, using default');
}
Expand Down
Loading

0 comments on commit 7d6ddea

Please sign in to comment.