@boxyhq/metrics 0.2.9 → 0.2.11
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/dist/init.js +16 -14
- package/package.json +17 -17
package/dist/init.js
CHANGED
|
@@ -14,12 +14,9 @@ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
|
14
14
|
*/
|
|
15
15
|
function initializeMetrics(serviceInfo) {
|
|
16
16
|
if (process.env.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT || process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
[semantic_conventions_1.SemanticResourceAttributes.SERVICE_VERSION]: `${serviceInfo.version}`,
|
|
21
|
-
}),
|
|
22
|
-
});
|
|
17
|
+
/** exportIntervalMillis must be greater than exportTimeoutMillis */
|
|
18
|
+
const exportIntervalMillis = Number(process.env.OTEL_EXPORT_INTERVAL_MS) || 60000;
|
|
19
|
+
const exportTimeoutMillis = Number(process.env.OTEL_EXPORT_INTERVAL_MS) - 1000 || 30000;
|
|
23
20
|
let metricExporter;
|
|
24
21
|
if (process.env.OTEL_EXPORTER_OTLP_PROTOCOL === 'grpc' ||
|
|
25
22
|
process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL === 'grpc') {
|
|
@@ -28,14 +25,19 @@ function initializeMetrics(serviceInfo) {
|
|
|
28
25
|
else {
|
|
29
26
|
metricExporter = new exporter_metrics_otlp_http_1.OTLPMetricExporter();
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
const meterProvider = new sdk_metrics_1.MeterProvider({
|
|
29
|
+
resource: (0, resources_1.resourceFromAttributes)({
|
|
30
|
+
[semantic_conventions_1.ATTR_SERVICE_NAME]: `${serviceInfo.name}`,
|
|
31
|
+
[semantic_conventions_1.ATTR_SERVICE_VERSION]: `${serviceInfo.version}`,
|
|
32
|
+
}),
|
|
33
|
+
readers: [
|
|
34
|
+
new sdk_metrics_1.PeriodicExportingMetricReader({
|
|
35
|
+
exporter: metricExporter,
|
|
36
|
+
exportIntervalMillis,
|
|
37
|
+
exportTimeoutMillis,
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
});
|
|
39
41
|
api_1.metrics.setGlobalMeterProvider(meterProvider);
|
|
40
42
|
}
|
|
41
43
|
if (process.env.OTEL_EXPORTER_DEBUG) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxyhq/metrics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Internal SDK for OTel instrumentation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,25 +30,25 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/boxyhq/metrics#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@grpc/grpc-js": "1.
|
|
33
|
+
"@grpc/grpc-js": "1.14.0",
|
|
34
34
|
"@opentelemetry/api": "1.9.0",
|
|
35
|
-
"@opentelemetry/exporter-metrics-otlp-grpc": "0.
|
|
36
|
-
"@opentelemetry/exporter-metrics-otlp-http": "0.
|
|
37
|
-
"@opentelemetry/resources": "
|
|
38
|
-
"@opentelemetry/sdk-metrics": "
|
|
39
|
-
"@opentelemetry/semantic-conventions": "1.
|
|
35
|
+
"@opentelemetry/exporter-metrics-otlp-grpc": "0.208.0",
|
|
36
|
+
"@opentelemetry/exporter-metrics-otlp-http": "0.208.0",
|
|
37
|
+
"@opentelemetry/resources": "2.2.0",
|
|
38
|
+
"@opentelemetry/sdk-metrics": "2.2.0",
|
|
39
|
+
"@opentelemetry/semantic-conventions": "1.38.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@eslint/compat": "1.
|
|
43
|
-
"@tsconfig/recommended": "1.0.
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
45
|
-
"@typescript-eslint/parser": "8.
|
|
46
|
-
"env-cmd": "
|
|
47
|
-
"eslint": "9.
|
|
48
|
-
"eslint-config-prettier": "
|
|
49
|
-
"prettier": "3.
|
|
50
|
-
"release-it": "
|
|
42
|
+
"@eslint/compat": "1.4.1",
|
|
43
|
+
"@tsconfig/recommended": "1.0.11",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "8.46.3",
|
|
45
|
+
"@typescript-eslint/parser": "8.46.3",
|
|
46
|
+
"env-cmd": "11.0.0",
|
|
47
|
+
"eslint": "9.39.1",
|
|
48
|
+
"eslint-config-prettier": "10.1.8",
|
|
49
|
+
"prettier": "3.6.2",
|
|
50
|
+
"release-it": "19.0.6",
|
|
51
51
|
"ts-node": "10.9.2",
|
|
52
|
-
"typescript": "5.
|
|
52
|
+
"typescript": "5.9.3"
|
|
53
53
|
}
|
|
54
54
|
}
|