@tryghost/metrics 0.2.0 → 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/lib/GhostMetrics.js +9 -3
- package/package.json +5 -3
package/lib/GhostMetrics.js
CHANGED
|
@@ -62,6 +62,8 @@ class GhostMetrics {
|
|
|
62
62
|
msg: `Metric ${name}: ${jsonStringifySafe(value)}`,
|
|
63
63
|
level: 30 // Magic number, log level for info
|
|
64
64
|
});
|
|
65
|
+
|
|
66
|
+
return Promise.resolve();
|
|
65
67
|
};
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -78,7 +80,8 @@ class GhostMetrics {
|
|
|
78
80
|
auth: {
|
|
79
81
|
username: this.elasticsearch.username,
|
|
80
82
|
password: this.elasticsearch.password
|
|
81
|
-
}
|
|
83
|
+
},
|
|
84
|
+
requestTimeout: 5000
|
|
82
85
|
});
|
|
83
86
|
|
|
84
87
|
this.shippers.elasticsearch = (name, value) => {
|
|
@@ -91,7 +94,7 @@ class GhostMetrics {
|
|
|
91
94
|
value.metadata = this.metadata;
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
elasticSearch.index(value, `metrics-${name}`);
|
|
97
|
+
return elasticSearch.index(value, `metrics-${name}`);
|
|
95
98
|
};
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -101,9 +104,12 @@ class GhostMetrics {
|
|
|
101
104
|
* @param {any} value Value of metric, will be co-erced to an object before being shipped
|
|
102
105
|
*/
|
|
103
106
|
metric(name, value) {
|
|
107
|
+
const promises = [];
|
|
104
108
|
for (const metricShipper of Object.values(this.shippers)) {
|
|
105
|
-
metricShipper(name, value);
|
|
109
|
+
promises.push(metricShipper(name, value));
|
|
106
110
|
}
|
|
111
|
+
|
|
112
|
+
return Promise.allSettled(promises).then(() => null);
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/metrics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"repository": "https://github.com/TryGhost/framework/tree/main/packages/metrics",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"sinon": "11.1.2"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tryghost/
|
|
29
|
+
"@tryghost/elasticsearch": "^0.1.2",
|
|
30
|
+
"@tryghost/pretty-stream": "^0.1.1",
|
|
31
|
+
"@tryghost/root-utils": "^0.3.6"
|
|
30
32
|
},
|
|
31
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "f0f282290dd7605bb54e8cc67553157791990074"
|
|
32
34
|
}
|