@boxyhq/metrics 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/init.js +5 -2
- package/package.json +15 -12
package/README.md
CHANGED
|
@@ -3,3 +3,14 @@
|
|
|
3
3
|
<a href="https://www.npmjs.com/package/@boxyhq/metrics"><img src="https://img.shields.io/npm/v/@boxyhq/metrics.svg" alt="npm" ></a>
|
|
4
4
|
|
|
5
5
|
Package for OTel instrumentation
|
|
6
|
+
|
|
7
|
+
## Running Tests
|
|
8
|
+
|
|
9
|
+
Tests helps us to ensure that the telemetry export works as expected after every OTEL dependency update.
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
npm i
|
|
13
|
+
# Copy test/.env.example to test/.env and set the values
|
|
14
|
+
cp test/.env.example test/.env
|
|
15
|
+
npm run test:manual
|
|
16
|
+
```
|
package/dist/init.js
CHANGED
|
@@ -28,14 +28,17 @@ function initializeMetrics(serviceInfo) {
|
|
|
28
28
|
else {
|
|
29
29
|
metricExporter = new exporter_metrics_otlp_http_1.OTLPMetricExporter();
|
|
30
30
|
}
|
|
31
|
+
/** exportIntervalMillis must be greater than exportTimeoutMillis */
|
|
32
|
+
const exportIntervalMillis = Number(process.env.OTEL_EXPORT_INTERVAL_MS) || 60000;
|
|
33
|
+
const exportTimeoutMillis = Number(process.env.OTEL_EXPORT_INTERVAL_MS) - 1000 || 30000;
|
|
31
34
|
meterProvider.addMetricReader(new sdk_metrics_1.PeriodicExportingMetricReader({
|
|
32
35
|
exporter: metricExporter,
|
|
33
|
-
exportIntervalMillis
|
|
36
|
+
exportIntervalMillis,
|
|
37
|
+
exportTimeoutMillis,
|
|
34
38
|
}));
|
|
35
39
|
api_1.metrics.setGlobalMeterProvider(meterProvider);
|
|
36
40
|
}
|
|
37
41
|
if (process.env.OTEL_EXPORTER_DEBUG) {
|
|
38
|
-
api_1.diag.disable();
|
|
39
42
|
api_1.diag.setLogger(new api_1.DiagConsoleLogger(), api_1.DiagLogLevel.DEBUG);
|
|
40
43
|
}
|
|
41
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxyhq/metrics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Internal SDK for OTel instrumentation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc -p tsconfig.json",
|
|
12
12
|
"prepublishOnly": "npm run build",
|
|
13
|
-
"lint": "eslint -c .eslintrc.json --ext .ts ./"
|
|
13
|
+
"lint": "eslint -c .eslintrc.json --ext .ts ./",
|
|
14
|
+
"test:manual": "env-cmd -f ./test/.env ts-node --project tsconfig.json test/index.ts"
|
|
14
15
|
},
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
@@ -27,19 +28,21 @@
|
|
|
27
28
|
"homepage": "https://github.com/boxyhq/metrics#readme",
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@opentelemetry/api": "1.4.1",
|
|
30
|
-
"@opentelemetry/exporter-metrics-otlp-grpc": "0.
|
|
31
|
-
"@opentelemetry/exporter-metrics-otlp-http": "0.
|
|
32
|
-
"@opentelemetry/resources": "1.
|
|
33
|
-
"@opentelemetry/sdk-metrics": "1.
|
|
34
|
-
"@opentelemetry/semantic-conventions": "1.
|
|
31
|
+
"@opentelemetry/exporter-metrics-otlp-grpc": "0.40.0",
|
|
32
|
+
"@opentelemetry/exporter-metrics-otlp-http": "0.40.0",
|
|
33
|
+
"@opentelemetry/resources": "1.14.0",
|
|
34
|
+
"@opentelemetry/sdk-metrics": "1.14.0",
|
|
35
|
+
"@opentelemetry/semantic-conventions": "1.14.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@tsconfig/recommended": "1.0.2",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
39
|
-
"@typescript-eslint/parser": "5.
|
|
40
|
-
"
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "5.60.0",
|
|
40
|
+
"@typescript-eslint/parser": "5.60.0",
|
|
41
|
+
"env-cmd": "10.1.0",
|
|
42
|
+
"eslint": "8.43.0",
|
|
41
43
|
"eslint-config-prettier": "8.8.0",
|
|
42
|
-
"prettier": "2.8.
|
|
43
|
-
"
|
|
44
|
+
"prettier": "2.8.8",
|
|
45
|
+
"ts-node": "10.9.1",
|
|
46
|
+
"typescript": "5.1.3"
|
|
44
47
|
}
|
|
45
48
|
}
|