Skip to content

Commit 66e0292

Browse files
committed
Merge branch 'develop'
2 parents 2f52da0 + 42bf8f0 commit 66e0292

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ Alternatively, you can also manually install the node permanently into your embe
2020
npm install node-red-contrib-prometheus-exporter
2121
```
2222

23-
*Note: Until we have officially released the library, it needs to be installed via downloading this repository into your project.*
24-
2523
## How to use
2624

2725
### Configure a metric

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-prometheus-exporter",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A NodeRED node which allows exporting Prometheus metrics from within flows.",
55
"keywords": ["node-red", "prometheus", "telegraf"],
66
"main": "index.js",

prometheus-exporter/prometheus-exporter.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ module.exports = function (RED) {
3636
metricOp = DEFAULT_OPS[this.metricConfig.mtype];
3737
}
3838
// apply specific value
39-
if (Number.isInteger(msg.payload.val)) {
40-
metricVal = msg.payload.val;
41-
} else {
39+
if (msg.payload.val === undefined || msg.payload.val === null) {
4240
// no value is only allowed for counter
4341
if (this.metricConfig.mtype !== 'counter') {
4442
done('Missing val for metric type ' + this.metricConfig.mtype);
4543
}
44+
} else {
45+
if (isNaN(Number(msg.payload.val))) {
46+
done('Invalid val for metric type ' + this.metricConfig.mtype);
47+
} else {
48+
metricVal = Number(msg.payload.val);
49+
}
4650
}
4751
// apply labels
4852
if (msg.payload.labels) {

0 commit comments

Comments
 (0)