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

fix(host-metrics): macOS bundling fix #2071

Merged
merged 45 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2c6d8cf
fix: semcov alignment & reduce import bundle
Netail Mar 29, 2024
60e0933
fix: types?
Netail Apr 2, 2024
65aabe7
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 2, 2024
ae578fc
fix: ci/cd
Netail Apr 2, 2024
ce92ffe
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 2, 2024
e818ba5
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 3, 2024
2484ef6
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 4, 2024
1106e97
docs: specify semantic conventions
Netail Apr 4, 2024
8f65520
revert some changes
Netail Apr 5, 2024
08506a4
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 8, 2024
63cc39d
fix: small type improvement
Netail Apr 9, 2024
03e2237
docs: add small comment
Netail Apr 9, 2024
9cbe462
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 10, 2024
a2aaa4b
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 11, 2024
744ea1d
fix: feedback
Netail Apr 16, 2024
cc8aafe
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 16, 2024
d1c1fca
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 18, 2024
a3b898f
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 20, 2024
a8196e4
fix: feedback
Netail Apr 20, 2024
304dc98
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 24, 2024
9f81a2d
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 27, 2024
769de9e
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 29, 2024
4fd1f8f
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 29, 2024
9c30315
Merge branch 'main' into fix/host-metrics-bundling
Netail Apr 30, 2024
83c58a3
Merge branch 'main' into fix/host-metrics-bundling
Netail May 1, 2024
2ac772e
Merge branch 'main' into fix/host-metrics-bundling
Netail May 2, 2024
343733e
Merge branch 'main' into fix/host-metrics-bundling
Netail May 3, 2024
fd50fe5
Merge branch 'main' into fix/host-metrics-bundling
Netail May 5, 2024
38b80b1
Merge branch 'main' into fix/host-metrics-bundling
Netail May 7, 2024
b642766
Merge branch 'main' into fix/host-metrics-bundling
Netail May 8, 2024
5e6370a
Merge branch 'main' into fix/host-metrics-bundling
Netail May 17, 2024
deb3257
Merge branch 'main' into fix/host-metrics-bundling
Netail May 21, 2024
5922334
fix: feedback
Netail May 22, 2024
06ac5e7
Merge branch 'main' into fix/host-metrics-bundling
Netail May 22, 2024
a3f9a61
Merge branch 'main' into fix/host-metrics-bundling
Netail May 22, 2024
fc23083
Merge branch 'main' into fix/host-metrics-bundling
Netail May 24, 2024
f675811
fix: remove subpath
Netail May 24, 2024
9c14d64
Merge branch 'main' into fix/host-metrics-bundling
Netail May 30, 2024
72ba6f9
feedback
Netail May 30, 2024
4c0c3c9
lint
Netail May 30, 2024
f0a7187
Merge branch 'main' into fix/host-metrics-bundling
Netail May 30, 2024
c0fbc8b
remove node import prefix
Netail May 30, 2024
5338456
lint
Netail May 30, 2024
3df9163
eof
Netail May 30, 2024
79555fc
Merge branch 'main' into fix/host-metrics-bundling
Netail May 31, 2024
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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess with the change suggested by @pichlermarc in ./src/stats/si.ts

- import { networkStats } from 'systeminformation/lib/network';
+ import { networkStats } from 'systeminformation';

this file is no needed. I see the .d.ts file from systeminformation exporting networkStats function already

Copy link
Contributor Author

@Netail Netail Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I use import { networkStats } from 'systeminformation';, it still tries to import the underlying cpu.js file, thus throwing an error on macOS. :( By targeting the file directly it won't.

The systeminformation/lib/cpu.js file tries to import osx-temperature-sensor for macOS, which you additionally have to install for macOS temperatures as it's not included in the dependencies, however osx-temp-sensor package breaks something else. But the cpu.js file isn't even used for host-metrics, so installing this package besides systeminformation is unecessary

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';
}
4 changes: 2 additions & 2 deletions 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"
}
}
trentm marked this conversation as resolved.
Show resolved Hide resolved
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';
legendecas marked this conversation as resolved.
Show resolved Hide resolved

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
Loading