@redkern/node-red-prometheus 0.1.0 → 1.0.0
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/CHANGELOG.md +9 -2
- package/README.md +6 -7
- package/lib/default-metrics.js +2 -2
- package/lib/palette.js +1 -1
- package/lib/receiver.js +2 -2
- package/lib/registry.js +2 -2
- package/nodes/locales/en-US/prometheus.html +2 -2
- package/nodes/locales/en-US/prometheus.json +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0 - 2026-12-04
|
|
4
|
+
|
|
5
|
+
First stable release of the Prometheus palette: palette-private metrics registry, cardinality controls, authenticated
|
|
6
|
+
exporter, Node-RED runtime metrics, and the dashboard and alert rules described in the 1.0.0 specification. Uses the
|
|
7
|
+
maintained `@prometheus-io/client` package instead of deprecated `prom-client`.
|
|
8
|
+
|
|
3
9
|
## 0.1.0 - 2026-12-02
|
|
4
10
|
|
|
5
|
-
Initial npm bootstrap publication from the 1.0.0 release candidate. Published
|
|
6
|
-
|
|
11
|
+
Initial npm bootstrap publication from the 1.0.0 release candidate. Published with the `bootstrap` dist-tag to
|
|
12
|
+
register the package for Trusted Publishing setup; npm also assigned `latest` to 0.1.0. This is not the production
|
|
13
|
+
1.0.0 release.
|
|
7
14
|
|
|
8
15
|
## 1.0.0-rc.1 - 2026-11-20
|
|
9
16
|
|
package/README.md
CHANGED
|
@@ -6,12 +6,11 @@ redkern palettes (gateway, snowflake, redis, kafka, scheduler) into the same end
|
|
|
6
6
|
|
|
7
7
|
Successor of `@yroshcha/node-red-contrib-nodered-metrics` (no automatic migration).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
> `1.0.0` release. Pre-releases remain GitHub Release tarballs.
|
|
9
|
+
Pre-releases remain GitHub Release tarballs.
|
|
11
10
|
|
|
12
11
|
## Requirements
|
|
13
12
|
|
|
14
|
-
- Node.js 22 or
|
|
13
|
+
- Node.js 22, 24 or 26+
|
|
15
14
|
- Node-RED 4.1 or 5.x
|
|
16
15
|
- Prometheus 2.x or 3.x
|
|
17
16
|
|
|
@@ -19,7 +18,7 @@ Successor of `@yroshcha/node-red-contrib-nodered-metrics` (no automatic migratio
|
|
|
19
18
|
|
|
20
19
|
```sh
|
|
21
20
|
cd ~/.node-red
|
|
22
|
-
npm install @redkern/node-red-prometheus
|
|
21
|
+
npm install @redkern/node-red-prometheus
|
|
23
22
|
```
|
|
24
23
|
|
|
25
24
|
Pre-release from a GitHub Release tarball:
|
|
@@ -58,7 +57,7 @@ yellow (PRM-CARD-1..3). An allowlist per label maps unknown values to `other` (P
|
|
|
58
57
|
|
|
59
58
|
### Registry semantics
|
|
60
59
|
|
|
61
|
-
- Metrics live in the palette's own
|
|
60
|
+
- Metrics live in the palette's own `@prometheus-io/client` registry; the global registry is untouched (PRM-REG-1).
|
|
62
61
|
- Config nodes with the same name and the same type, labels and buckets share one metric. Same name with a different
|
|
63
62
|
contract: the second config node's metric nodes are red (PRM-REG-5).
|
|
64
63
|
- Redeploying without changes keeps all series and counters (PRM-REG-3). Changing type, labels or buckets recreates the
|
|
@@ -87,7 +86,7 @@ yellow (PRM-CARD-1..3). An allowlist per label maps unknown values to `other` (P
|
|
|
87
86
|
this `/metrics` and the palettes stop needing their own scrape ports. A duplicate metric name is served once (this
|
|
88
87
|
palette first, then sources in announcement order) with a warning. Without this palette each one keeps serving its
|
|
89
88
|
own port, with the same metric names.
|
|
90
|
-
- `includeGlobalRegistry` adds the global registry of this palette's own
|
|
89
|
+
- `includeGlobalRegistry` adds the global registry of this palette's own client copy (PRM-REG-2).
|
|
91
90
|
|
|
92
91
|
## Deployment
|
|
93
92
|
|
|
@@ -150,7 +149,7 @@ installed side by side: this one uses its own registry and port, so nothing is r
|
|
|
150
149
|
| histogram `observe` from `msg`, 2 labels | ~60 000 | ~1-3 µs |
|
|
151
150
|
|
|
152
151
|
`/metrics` with 10 000 user series, default metrics and 3 other palettes × 200 families (~3 MiB of text) renders in
|
|
153
|
-
~60-80 ms p50/p95;
|
|
152
|
+
~60-80 ms p50/p95; the client's own serialization is most of it. A value read from `flow`/`global` context goes
|
|
154
153
|
through a promise, so its message is forwarded one microtask later; the benchmark shows no extra cost for it.
|
|
155
154
|
CI runs the benchmark with generous gates (`BENCH_MAX_OVERHEAD_US`, `BENCH_MAX_RENDER_MS`) to catch regressions.
|
|
156
155
|
|
package/lib/default-metrics.js
CHANGED
|
@@ -5,7 +5,7 @@ const os = require('node:os');
|
|
|
5
5
|
// PRM-DEF-1, PRM-DEF-2, PRM-DEF-3: process/runtime metrics collected into a registry separate from user metrics, so an
|
|
6
6
|
// exporter can switch them off, change the prefix or the host label without touching user series.
|
|
7
7
|
//
|
|
8
|
-
//
|
|
8
|
+
// The client's default metrics install PerformanceObservers that are never disconnected, so one
|
|
9
9
|
// registry is created per (prefix, hostLabel) and reused for the life of the process.
|
|
10
10
|
|
|
11
11
|
const cache = new Map();
|
|
@@ -15,7 +15,7 @@ function hostName() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @param {{ promClient: typeof import('
|
|
18
|
+
* @param {{ promClient: typeof import('@prometheus-io/client'), prefix: string, hostLabel: boolean, deployCount: () => number }} options
|
|
19
19
|
*/
|
|
20
20
|
function defaultMetricsRegistry({ promClient, prefix, hostLabel, deployCount }) {
|
|
21
21
|
const key = JSON.stringify([prefix, hostLabel]);
|
package/lib/palette.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const kit = require('@redkern/node-red-kit');
|
|
4
|
-
const promClient = require('
|
|
4
|
+
const promClient = require('@prometheus-io/client');
|
|
5
5
|
const { createMetricRegistry } = require('./registry.js');
|
|
6
6
|
const { createReceiver } = require('./receiver.js');
|
|
7
7
|
const { defaultMetricsRegistry } = require('./default-metrics.js');
|
package/lib/receiver.js
CHANGED
|
@@ -107,7 +107,7 @@ function createReceiver({ RED, warn, warnOnce }) {
|
|
|
107
107
|
/**
|
|
108
108
|
* Appends every source's text after the palette's own output, skipping metric families that are
|
|
109
109
|
* already present. Text is concatenated, not merged with Registry.merge, so palettes may use
|
|
110
|
-
* different
|
|
110
|
+
* different Prometheus client versions.
|
|
111
111
|
* @param {string[]} ownTexts texts that always win, in order
|
|
112
112
|
*/
|
|
113
113
|
async render(ownTexts) {
|
|
@@ -125,7 +125,7 @@ function createReceiver({ RED, warn, warnOnce }) {
|
|
|
125
125
|
}
|
|
126
126
|
if (kept.length) parts.push(`${kept.join('\n')}\n`);
|
|
127
127
|
};
|
|
128
|
-
// Fast path for this palette's own
|
|
128
|
+
// Fast path for this palette's own client output: every family has a TYPE line, so the names are
|
|
129
129
|
// read without splitting the text, which is the largest part of a scrape. Split only on a collision.
|
|
130
130
|
for (const text of ownTexts) {
|
|
131
131
|
const names = [...text.matchAll(/^# TYPE ([a-zA-Z_:][a-zA-Z0-9_:]*) /gm)].map((match) => match[1]);
|
package/lib/registry.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { createCardinalityGuard } = require('./cardinality.js');
|
|
4
4
|
|
|
5
|
-
// PRM-REG-1, PRM-REG-3, PRM-REG-4, PRM-REG-5: a palette-private
|
|
5
|
+
// PRM-REG-1, PRM-REG-3, PRM-REG-4, PRM-REG-5: a palette-private Prometheus client Registry with
|
|
6
6
|
// ensure-semantics, owner reference counting and deferred removal across deploys.
|
|
7
7
|
|
|
8
8
|
const METRIC_NAME = /^[a-zA-Z_:][a-zA-Z0-9_:]*$/;
|
|
@@ -87,7 +87,7 @@ function contractOf(definition) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* @param {{ promClient: typeof import('
|
|
90
|
+
* @param {{ promClient: typeof import('@prometheus-io/client'), warn: (key: string, message: string) => void }} options
|
|
91
91
|
*/
|
|
92
92
|
function createMetricRegistry({ promClient, warn }) {
|
|
93
93
|
const registry = new promClient.Registry();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="redkern-prom-metric-config">
|
|
2
2
|
<p>Defines one Prometheus metric: counter, gauge, histogram or summary, with its labels and cardinality limit.</p>
|
|
3
3
|
<h3>Details</h3>
|
|
4
|
-
<p>Metrics live in the palette's own registry, not in the
|
|
4
|
+
<p>Metrics live in the palette's own registry, not in the client global registry, so other palettes cannot clash with them.</p>
|
|
5
5
|
<p>Several config nodes with the same <b>Prometheus name</b> share one metric when their type, labels and buckets match.
|
|
6
6
|
A config node with the same name but a different contract shows a red status on the metric nodes that use it.</p>
|
|
7
7
|
<p>A redeploy without changes keeps the metric's series and counters. Changing the type, labels, buckets or percentiles
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<p><b>Collect default metrics</b> adds process, heap, GC and event-loop metrics with the <code>nodered_</code> prefix and
|
|
68
68
|
<code>nodered_flows_deploy_total</code>. <b>Add host label</b> duplicates the <code>pod</code> label from Kubernetes
|
|
69
69
|
service discovery and is off by default.</p>
|
|
70
|
-
<p><b>Include
|
|
70
|
+
<p><b>Include Prometheus client global registry</b> adds the global registry of this palette's own client copy.</p>
|
|
71
71
|
<h3>References</h3>
|
|
72
72
|
<ul>
|
|
73
73
|
<li><a href="https://github.com/redkern/node-red-prometheus#deployment">Scrape configuration and Helm values</a></li>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"timer": "Timer key",
|
|
45
45
|
"labels": "Extra labels",
|
|
46
46
|
"mode": "Serve on",
|
|
47
|
-
"includeGlobalRegistry": "Include
|
|
47
|
+
"includeGlobalRegistry": "Include Prometheus client global registry",
|
|
48
48
|
"defaultMetrics": "Collect default metrics",
|
|
49
49
|
"prefix": "Prefix",
|
|
50
50
|
"hostLabel": "Add host label"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redkern/node-red-prometheus",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Prometheus metrics palette for Node-RED: counters, gauges, histograms and summaries with cardinality limits, a private registry and a dedicated exporter port",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": "^22 || ^24 || >=26"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"lib/",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"bench": "node --unhandled-rejections=strict scripts/bench.js"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@
|
|
62
|
-
"
|
|
61
|
+
"@prometheus-io/client": "0.16.1",
|
|
62
|
+
"@redkern/node-red-kit": "^1.1.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"c8": "12.0.0",
|