Skip to content

Commit 196b7a1

Browse files
authored
chore(examples): lint examples/host-metrics using shared top-level eslint config (#2901)
Refs: #2891
1 parent cf8da86 commit 196b7a1

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed

examples/host-metrics/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
const baseConfig = require('../../eslint.config');
20+
21+
module.exports = {
22+
...baseConfig,
23+
env: {
24+
node: true,
25+
},
26+
};

examples/host-metrics/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

examples/host-metrics/node.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
'use strict';
218

319
const { HostMetrics } = require('@opentelemetry/host-metrics');
420
// const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
521
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
6-
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector');
22+
const {
23+
CollectorMetricExporter,
24+
} = require('@opentelemetry/exporter-collector');
725

826
const exporter = new CollectorMetricExporter({
927
headers: {},
@@ -26,10 +44,13 @@ const meterProvider = new MeterProvider({
2644
interval: 2000,
2745
});
2846

29-
const hostMetrics = new HostMetrics({ meterProvider, name: 'example-host-metrics' });
47+
const hostMetrics = new HostMetrics({
48+
meterProvider,
49+
name: 'example-host-metrics',
50+
});
3051
hostMetrics.start();
3152

3253
// keep running
3354
(function wait() {
3455
setTimeout(wait, 1000);
35-
}());
56+
})();

examples/host-metrics/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"description": "Example of using @opentelemetry/host-metrics",
66
"main": "index.js",
77
"scripts": {
8+
"lint": "eslint . --ext=ts,js,mjs",
9+
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
810
"start": "node node.js"
911
},
1012
"repository": {

0 commit comments

Comments
 (0)