@redkern/node-red-prometheus 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 - 2026-12-02
4
+
5
+ Initial npm bootstrap publication from the 1.0.0 release candidate. Published under the `bootstrap` dist-tag, not
6
+ `latest`, to register the package for Trusted Publishing setup. This is not the production 1.0.0 release.
7
+
8
+ ## 1.0.0-rc.1 - 2026-11-20
9
+
10
+ First pre-release covering the full 1.0.0 scope of `docs/spec.md` (alpha.1 through rc.1). Distributed as a GitHub
11
+ Release tarball; the later 0.1.0 npm bootstrap is not the production 1.0.0 release.
12
+
13
+ - Palette-private prom-client registry with ensure-semantics, reference counting across deploys and contract
14
+ conflict detection (PRM-REG-1..5).
15
+ - `redkern-prom-metric-config`, `redkern-prom-metric` and `redkern-prom-exporter` node types (PRM-MET-1..6).
16
+ - Per-metric cardinality limit, label allowlists and `redkern_prom_dropped_series_total` (PRM-CARD-1..4).
17
+ - Exporter on the kit internal listener (port 9550, `/redkern/prom/metrics`, bearer token from
18
+ `REDKERN_PROM_METRICS_TOKEN`) or on the Node-RED admin API (PRM-EXP-1..5).
19
+ - Default Node.js metrics with optional `host` label and `nodered_flows_deploy_total` (PRM-DEF-1..3).
20
+ - Receiver for metrics of other redkern palettes over the kit protocol (PRM-REG-6).
21
+ - Grafana dashboard and PrometheusRule in `observability/` (PRM-MET-8).
22
+
23
+ Not included: `observeAge` (PRM-MET-7) waits for kit trace support; no migration from
24
+ `@yroshcha/node-red-contrib-nodered-metrics`. Deviations from the specification are listed in
25
+ `docs/spec.md`, section 13.
package/LICENSE ADDED
@@ -0,0 +1,188 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work (an example is provided in the Appendix
37
+ below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object form,
40
+ that is based on (or derived from) the Work and for which the editorial
41
+ revisions, annotations, elaborations, or other modifications represent, as a
42
+ whole, an original work of authorship. For the purposes of this License,
43
+ Derivative Works shall not include works that remain separable from, or
44
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
45
+ Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including the original
48
+ version of the Work and any modifications or additions to that Work or
49
+ Derivative Works thereof, that is intentionally submitted to Licensor for
50
+ inclusion in the Work by the copyright owner or by an individual or Legal
51
+ Entity authorized to submit on behalf of the copyright owner. For the
52
+ purposes of this definition, "submitted" means any form of electronic,
53
+ verbal, or written communication sent to the Licensor or its representatives,
54
+ including but not limited to communication on electronic mailing lists,
55
+ source code control systems, and issue tracking systems that are managed by,
56
+ or on behalf of, the Licensor for the purpose of discussing and improving the
57
+ Work, but excluding communication that is conspicuously marked or otherwise
58
+ designated in writing by the copyright owner as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
61
+ behalf of whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
65
+ License, each Contributor hereby grants to You a perpetual, worldwide,
66
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
67
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
68
+ sublicense, and distribute the Work and such Derivative Works in Source or
69
+ Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of this
72
+ License, each Contributor hereby grants to You a perpetual, worldwide,
73
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
74
+ section) patent license to make, have made, use, offer to sell, sell, import,
75
+ and otherwise transfer the Work, where such license applies only to those
76
+ patent claims licensable by such Contributor that are necessarily infringed
77
+ by their Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You institute
79
+ patent litigation against any entity (including a cross-claim or counterclaim
80
+ in a lawsuit) alleging that the Work or a Contribution incorporated within
81
+ the Work constitutes direct or contributory patent infringement, then any
82
+ patent licenses granted to You under this License for that Work shall
83
+ terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
86
+ Derivative Works thereof in any medium, with or without modifications, and
87
+ in Source or Object form, provided that You meet the following conditions:
88
+
89
+ (a) You must give any other recipients of the Work or Derivative Works a copy
90
+ of this License; and
91
+
92
+ (b) You must cause any modified files to carry prominent notices stating
93
+ that You changed the files; and
94
+
95
+ (c) You must retain, in the Source form of any Derivative Works that You
96
+ distribute, all copyright, patent, trademark, and attribution notices
97
+ from the Source form of the Work, excluding those notices that do not
98
+ pertain to any part of the Derivative Works; and
99
+
100
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
101
+ then any Derivative Works that You distribute must include a readable
102
+ copy of the attribution notices contained within such NOTICE file,
103
+ excluding those notices that do not pertain to any part of the
104
+ Derivative Works, in at least one of the following places: within a
105
+ NOTICE text file distributed as part of the Derivative Works; within the
106
+ Source form or documentation, if provided along with the Derivative
107
+ Works; or, within a display generated by the Derivative Works, if and
108
+ wherever such third-party notices normally appear. The contents of the
109
+ NOTICE file are for informational purposes only and do not modify the
110
+ License. You may add Your own attribution notices within Derivative
111
+ Works that You distribute, alongside or as an addendum to the NOTICE text
112
+ from the Work, provided that such additional attribution notices cannot
113
+ be construed as modifying the License.
114
+
115
+ You may add Your own copyright statement to Your modifications and may
116
+ provide additional or different license terms and conditions for use,
117
+ reproduction, or distribution of Your modifications, or for any such
118
+ Derivative Works as a whole, provided Your use, reproduction, and
119
+ distribution of the Work otherwise complies with the conditions stated in
120
+ this License.
121
+
122
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
123
+ Contribution intentionally submitted for inclusion in the Work by You to the
124
+ Licensor shall be under the terms and conditions of this License, without
125
+ any additional terms or conditions. Notwithstanding the above, nothing herein
126
+ shall supersede or modify the terms of any separate license agreement you
127
+ may have executed with Licensor regarding such Contributions.
128
+
129
+ 6. Trademarks. This License does not grant permission to use the trade names,
130
+ trademarks, service marks, or product names of the Licensor, except as
131
+ required for reasonable and customary use in describing the origin of the
132
+ Work and reproducing the content of the NOTICE file.
133
+
134
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
135
+ writing, Licensor provides the Work (and each Contributor provides its
136
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
137
+ KIND, either express or implied, including, without limitation, any
138
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
139
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
140
+ the appropriateness of using or redistributing the Work and assume any risks
141
+ associated with Your exercise of permissions under this License.
142
+
143
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
144
+ tort (including negligence), contract, or otherwise, unless required by
145
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
146
+ in writing, shall any Contributor be liable to You for damages, including
147
+ any direct, indirect, special, incidental, or consequential damages of any
148
+ character arising as a result of this License or out of the use or inability
149
+ to use the Work (including but not limited to damages for loss of goodwill,
150
+ work stoppage, computer failure or malfunction, or any and all other
151
+ commercial damages or losses), even if such Contributor has been advised of
152
+ the possibility of such damages.
153
+
154
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
155
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
156
+ acceptance of support, warranty, indemnity, or other liability obligations
157
+ and/or rights consistent with this License. However, in accepting such
158
+ obligations, You may act only on Your own behalf and on Your sole
159
+ responsibility, not on behalf of any other Contributor, and only if You agree
160
+ to indemnify, defend, and hold each Contributor harmless for any liability
161
+ incurred by, or claims asserted against, such Contributor by reason of your
162
+ accepting any such warranty or additional liability.
163
+
164
+ END OF TERMS AND CONDITIONS
165
+
166
+ APPENDIX: How to apply the Apache License to your work.
167
+
168
+ To apply the Apache License to your work, attach the following boilerplate
169
+ notice, with the fields enclosed by brackets "[]" replaced with your own
170
+ identifying information. (Don't include the brackets!) The text should be
171
+ enclosed in the appropriate comment syntax for the file format. We also
172
+ recommend that a file or class name and description of purpose be included on
173
+ the same "printed page" as the copyright notice for easier identification
174
+ within third-party archives.
175
+
176
+ Copyright [yyyy] [name of copyright owner]
177
+
178
+ Licensed under the Apache License, Version 2.0 (the "License");
179
+ you may not use this file except in compliance with the License.
180
+ You may obtain a copy of the License at
181
+
182
+ http://www.apache.org/licenses/LICENSE-2.0
183
+
184
+ Unless required by applicable law or agreed to in writing, software
185
+ distributed under the License is distributed on an "AS IS" BASIS,
186
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187
+ See the License for the specific language governing permissions and
188
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,178 @@
1
- # Temporary Holding Version
1
+ # @redkern/node-red-prometheus
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Prometheus metrics for Node-RED flows: counters, gauges, histograms and summaries with a per-metric cardinality limit,
4
+ a palette-private registry and a `/metrics` endpoint on a dedicated port. It also collects the metrics of the other
5
+ redkern palettes (gateway, snowflake, redis, kafka, scheduler) into the same endpoint.
6
+
7
+ Successor of `@yroshcha/node-red-contrib-nodered-metrics` (no automatic migration).
8
+
9
+ > **Status:** `0.1.0` bootstrap release under the `bootstrap` npm dist-tag; it is not `latest` or the production
10
+ > `1.0.0` release. Pre-releases remain GitHub Release tarballs.
11
+
12
+ ## Requirements
13
+
14
+ - Node.js 22 or newer
15
+ - Node-RED 4.1 or 5.x
16
+ - Prometheus 2.x or 3.x
17
+
18
+ ## Install
19
+
20
+ ```sh
21
+ cd ~/.node-red
22
+ npm install @redkern/node-red-prometheus@bootstrap
23
+ ```
24
+
25
+ Pre-release from a GitHub Release tarball:
26
+
27
+ ```sh
28
+ npm install https://github.com/redkern/node-red-prometheus/releases/download/v1.0.0-rc.1/redkern-node-red-prometheus-1.0.0-rc.1.tgz
29
+ ```
30
+
31
+ ## Nodes
32
+
33
+ | Node | Purpose |
34
+ | --- | --- |
35
+ | `redkern-prom-metric-config` (config) | One metric: type, Prometheus name, labels, buckets or percentiles, `maxSeriesPerMetric`, label allowlists |
36
+ | `redkern-prom-metric` | Writes the metric for each message (`inc`, `dec`, `set`, `observe`, `startTimer`, `stopTimer`) and forwards the message unchanged |
37
+ | `redkern-prom-exporter` | Serves `/metrics` on port 9550 (or on the admin API) with default Node.js metrics and the metrics of other redkern palettes |
38
+
39
+ See `examples/` (Import > Examples > @redkern/node-red-prometheus in the editor).
40
+
41
+ ### Writing metrics
42
+
43
+ - Types: counter (optionally with a companion `<name without _total>_duration_seconds` histogram), gauge, histogram,
44
+ summary (PRM-MET-1).
45
+ - Values and labels come from `msg`, `flow`, `global`, `env`, `num` or `str` (PRM-MET-3). JSONata is not supported.
46
+ - `step` (node name), `status` (default `success`) and `process` (flow tab name) are filled automatically when the
47
+ metric declares them (PRM-MET-4).
48
+ - `startTimer` stores a timestamp in `msg.redkern.prom.timers[<key>]`; `stopTimer` observes the elapsed seconds and
49
+ removes the key, so a part of a flow is timed without function nodes (PRM-MET-2).
50
+ - The node never stops the flow. A failed write (missing label, non-numeric value, unsupported action) is logged once
51
+ per node and the message is still sent (PRM-MET-6).
52
+
53
+ ### Cardinality
54
+
55
+ Each metric accepts at most `maxSeriesPerMetric` label combinations (default 1000). Existing series keep updating;
56
+ new ones above the limit are dropped, counted in `redkern_prom_dropped_series_total{metric}` and the metric node turns
57
+ yellow (PRM-CARD-1..3). An allowlist per label maps unknown values to `other` (PRM-CARD-4).
58
+
59
+ ### Registry semantics
60
+
61
+ - Metrics live in the palette's own `prom-client` registry; the global registry is untouched (PRM-REG-1).
62
+ - Config nodes with the same name and the same type, labels and buckets share one metric. Same name with a different
63
+ contract: the second config node's metric nodes are red (PRM-REG-5).
64
+ - Redeploying without changes keeps all series and counters (PRM-REG-3). Changing type, labels or buckets recreates the
65
+ metric with a warning; its series restart from zero (PRM-REG-4).
66
+
67
+ ### Exporter
68
+
69
+ | Setting | Source | Default |
70
+ | --- | --- | --- |
71
+ | Port | `REDKERN_PROM_INTERNAL_PORT` or `redkernPromExporterInternalPort` in settings.js | 9550 |
72
+ | Token | `REDKERN_PROM_METRICS_TOKEN` or `redkernPromExporterMetricsToken` | none (required for the dedicated port) |
73
+ | Palette switch | `REDKERN_PROM_ENABLED` or `redkernPromExporterEnabled` | `true` |
74
+
75
+ - **Dedicated port** (default, PRM-EXP-1): the `@redkern/node-red-kit` internal listener,
76
+ `GET http://<pod>:9550/redkern/prom/metrics`. The public `httpNode` port is never used.
77
+ - **Authentication** (PRM-EXP-4): Prometheus sends `Authorization: Bearer <token>`. The token (32-4096 printable
78
+ characters, not reused by other route classes) comes only from the environment or settings.js. Without it the exporter
79
+ is red in this mode; an invalid token or port disables the palette (kit rule).
80
+ - **Admin API** mode (PRM-EXP-2, PRM-EXP-3): the Node-RED port itself, `GET <httpAdminRoot>/redkern/prom/metrics`
81
+ with permission `redkern.prom.read`; requires `adminAuth`, answers 503 when no exporter is active. The body is the
82
+ 0.0.4 text format served as `text/plain` (see `docs/spec.md`, deviation В2).
83
+ - One exporter per instance; a second one is red and opens no port (PRM-EXP-5).
84
+ - **Default metrics** (PRM-DEF-1..3): process, heap, GC, event loop with the `nodered_` prefix, plus
85
+ `nodered_flows_deploy_total`. The optional `host` label is off by default (Kubernetes SD already adds `pod`).
86
+ - **Other palettes** (PRM-REG-6, PRM-REG-7): redkern palettes announce their metrics over `RED.events`; they appear in
87
+ this `/metrics` and the palettes stop needing their own scrape ports. A duplicate metric name is served once (this
88
+ palette first, then sources in announcement order) with a warning. Without this palette each one keeps serving its
89
+ own port, with the same metric names.
90
+ - `includeGlobalRegistry` adds the global registry of this palette's own prom-client copy (PRM-REG-2).
91
+
92
+ ## Deployment
93
+
94
+ Helm values fragment for the Node-RED pods:
95
+
96
+ ```yaml
97
+ env:
98
+ - name: REDKERN_PROM_INTERNAL_PORT
99
+ value: "9550"
100
+ - name: REDKERN_PROM_METRICS_TOKEN
101
+ valueFrom:
102
+ secretKeyRef: { name: node-red-metrics, key: token }
103
+ - name: UV_THREADPOOL_SIZE
104
+ value: "16"
105
+ ports:
106
+ - name: metrics
107
+ containerPort: 9550
108
+ ```
109
+
110
+ ServiceMonitor (the token is mandatory, so plain `prometheus.io/*` pod annotations are not enough):
111
+
112
+ ```yaml
113
+ apiVersion: monitoring.coreos.com/v1
114
+ kind: ServiceMonitor
115
+ metadata:
116
+ name: node-red
117
+ spec:
118
+ selector:
119
+ matchLabels: { app: node-red }
120
+ endpoints:
121
+ - port: metrics
122
+ path: /redkern/prom/metrics
123
+ authorization:
124
+ credentials: { name: node-red-metrics, key: token }
125
+ ```
126
+
127
+ The palette needs no preStop hook or probes of its own; keep the Node-RED ones.
128
+
129
+ ## Observability
130
+
131
+ `observability/grafana-dashboard.json` (palette health: dropped series, deploys, event loop, heap, GC, scrape) and
132
+ `observability/prometheus-rule.yaml` (alerts on dropped series and on a failing or missing scrape) (PRM-MET-8).
133
+ Adjust the `job` selector to your scrape job.
134
+
135
+ ## Relation to @yroshcha/node-red-contrib-nodered-metrics
136
+
137
+ There is no automatic migration. The node types have new names (`redkern-prom-metric-config`, `redkern-prom-metric`,
138
+ `redkern-prom-exporter`) and the old `msg.payload = { op, val, labels }` format is not supported. Both palettes can be
139
+ installed side by side: this one uses its own registry and port, so nothing is registered twice.
140
+
141
+ ## Performance
142
+
143
+ `npm run bench` runs the metric node inside a real Node-RED runtime against a bare pass-through node and renders
144
+ `/metrics` for a large registry. On a 2-vCPU cloud runner (Node 22, Node-RED 5.0.10, 50 000 messages × 5 rounds):
145
+
146
+ | scenario | msg/s | overhead per message |
147
+ | --- | ---: | ---: |
148
+ | bare pass-through node (baseline) | ~70 000 | - |
149
+ | counter `inc`, 4 labels (step, status, process, `msg.kind`) | ~63 000 | ~1-3 µs |
150
+ | histogram `observe` from `msg`, 2 labels | ~60 000 | ~1-3 µs |
151
+
152
+ `/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; prom-client's own serialization is most of it. A value read from `flow`/`global` context goes
154
+ through a promise, so its message is forwarded one microtask later; the benchmark shows no extra cost for it.
155
+ CI runs the benchmark with generous gates (`BENCH_MAX_OVERHEAD_US`, `BENCH_MAX_RENDER_MS`) to catch regressions.
156
+
157
+ ## Development
158
+
159
+ ```sh
160
+ npm ci
161
+ npm test # unit
162
+ npm run test:integration # real Node-RED runtime via node-red-node-test-helper
163
+ npm run test:coverage
164
+ npm run check:editor && npm run check:pack && npm run verify:requirements
165
+ npm run validate:node-red # node-red-dev validate
166
+ npm run bench # performance, see above
167
+ ```
168
+
169
+ The specification with verification methods and recorded deviations is in `docs/spec.md`.
170
+
171
+ ## Security and support
172
+
173
+ Report vulnerabilities through GitHub Private Vulnerability Reporting or to security@redkern.com; see
174
+ [SECURITY.md](SECURITY.md). For support use GitHub issues or support@redkern.com.
175
+
176
+ ## License
177
+
178
+ Apache-2.0
package/SECURITY.md ADDED
@@ -0,0 +1,18 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ The latest minor release of each supported major version receives security fixes.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Report vulnerabilities privately through GitHub Private Vulnerability Reporting on
10
+ `redkern/node-red-prometheus`, or by email to security@redkern.com. Do not open a public issue for an unpatched
11
+ vulnerability. You will get an acknowledgement within 5 working days.
12
+
13
+ ## Hardening notes
14
+
15
+ - Keep the exporter on the dedicated port (9550). Never expose it through an ingress.
16
+ - The dedicated port always requires the metrics token (`REDKERN_PROM_METRICS_TOKEN`); keep it in a Kubernetes Secret.
17
+ - The metrics token is redacted from palette logs; it must be unique and must not be reused by other route classes.
18
+ - Label values are exported verbatim: never put personal data, secrets or identifiers into labels.
@@ -0,0 +1,131 @@
1
+ [
2
+ {
3
+ "id": "7a1f0c2e5b3d4a10",
4
+ "type": "tab",
5
+ "label": "redkern prom: basics",
6
+ "disabled": false,
7
+ "info": ""
8
+ },
9
+ {
10
+ "id": "7a1f0c2e5b3d4a11",
11
+ "type": "comment",
12
+ "z": "7a1f0c2e5b3d4a10",
13
+ "name": "Count events by kind; scrape http://<pod>:9550/redkern/prom/metrics",
14
+ "info": "The exporter needs REDKERN_PROM_METRICS_TOKEN in the Node-RED environment; Prometheus sends it as a bearer token.\nWithout it, switch the exporter to the admin API mode.",
15
+ "x": 260,
16
+ "y": 40,
17
+ "wires": []
18
+ },
19
+ {
20
+ "id": "7a1f0c2e5b3d4a12",
21
+ "type": "inject",
22
+ "z": "7a1f0c2e5b3d4a10",
23
+ "name": "order",
24
+ "props": [
25
+ {
26
+ "p": "payload"
27
+ }
28
+ ],
29
+ "repeat": "",
30
+ "crontab": "",
31
+ "once": false,
32
+ "onceDelay": 0.1,
33
+ "topic": "",
34
+ "payload": "{\"kind\":\"order\"}",
35
+ "payloadType": "json",
36
+ "x": 130,
37
+ "y": 100,
38
+ "wires": [
39
+ [
40
+ "7a1f0c2e5b3d4a13"
41
+ ]
42
+ ]
43
+ },
44
+ {
45
+ "id": "7a1f0c2e5b3d4a13",
46
+ "type": "redkern-prom-metric",
47
+ "z": "7a1f0c2e5b3d4a10",
48
+ "name": "consume",
49
+ "metric": "7a1f0c2e5b3d4a20",
50
+ "operation": "inc",
51
+ "autoStep": true,
52
+ "step": "",
53
+ "stepType": "str",
54
+ "status": "success",
55
+ "statusType": "str",
56
+ "value": "1",
57
+ "valueType": "num",
58
+ "duration": "",
59
+ "durationType": "msg",
60
+ "durationUnit": "seconds",
61
+ "timer": "",
62
+ "labels": [
63
+ {
64
+ "name": "kind",
65
+ "value": "payload.kind",
66
+ "valueType": "msg"
67
+ }
68
+ ],
69
+ "x": 320,
70
+ "y": 100,
71
+ "wires": [
72
+ [
73
+ "7a1f0c2e5b3d4a14"
74
+ ]
75
+ ]
76
+ },
77
+ {
78
+ "id": "7a1f0c2e5b3d4a14",
79
+ "type": "debug",
80
+ "z": "7a1f0c2e5b3d4a10",
81
+ "name": "",
82
+ "active": true,
83
+ "tosidebar": true,
84
+ "console": false,
85
+ "tostatus": false,
86
+ "complete": "payload",
87
+ "targetType": "msg",
88
+ "x": 510,
89
+ "y": 100,
90
+ "wires": []
91
+ },
92
+ {
93
+ "id": "7a1f0c2e5b3d4a15",
94
+ "type": "redkern-prom-exporter",
95
+ "z": "7a1f0c2e5b3d4a10",
96
+ "name": "",
97
+ "mode": "internal",
98
+ "includeGlobalRegistry": false,
99
+ "defaultMetrics": true,
100
+ "prefix": "nodered_",
101
+ "x": 140,
102
+ "y": 180,
103
+ "wires": [],
104
+ "hostLabel": false
105
+ },
106
+ {
107
+ "id": "7a1f0c2e5b3d4a20",
108
+ "type": "redkern-prom-metric-config",
109
+ "name": "",
110
+ "metricType": "counter",
111
+ "metricName": "nodered_example_events_total",
112
+ "help": "Events processed by the example flow",
113
+ "labelNames": "step,status,process,kind",
114
+ "buckets": "",
115
+ "withDuration": false,
116
+ "durationBuckets": "",
117
+ "percentiles": "",
118
+ "maxAgeSeconds": "",
119
+ "ageBuckets": "",
120
+ "maxSeriesPerMetric": 100,
121
+ "allowlist": [
122
+ {
123
+ "label": "kind",
124
+ "values": [
125
+ "order",
126
+ "refund"
127
+ ]
128
+ }
129
+ ]
130
+ }
131
+ ]
@@ -0,0 +1,138 @@
1
+ [
2
+ {
3
+ "id": "5c2e8d1f3a4b6c10",
4
+ "type": "tab",
5
+ "label": "redkern prom: section timer",
6
+ "disabled": false,
7
+ "info": ""
8
+ },
9
+ {
10
+ "id": "5c2e8d1f3a4b6c11",
11
+ "type": "comment",
12
+ "z": "5c2e8d1f3a4b6c10",
13
+ "name": "Measure a part of the flow without function nodes",
14
+ "info": "Start timer writes msg.redkern.prom.timers; stop timer observes the elapsed seconds into the histogram.\nThe exporter is in the basics example.",
15
+ "x": 240,
16
+ "y": 40,
17
+ "wires": []
18
+ },
19
+ {
20
+ "id": "5c2e8d1f3a4b6c12",
21
+ "type": "inject",
22
+ "z": "5c2e8d1f3a4b6c10",
23
+ "name": "request",
24
+ "props": [
25
+ {
26
+ "p": "payload"
27
+ }
28
+ ],
29
+ "repeat": "",
30
+ "crontab": "",
31
+ "once": false,
32
+ "onceDelay": 0.1,
33
+ "topic": "",
34
+ "payload": "",
35
+ "payloadType": "date",
36
+ "x": 130,
37
+ "y": 100,
38
+ "wires": [
39
+ [
40
+ "5c2e8d1f3a4b6c13"
41
+ ]
42
+ ]
43
+ },
44
+ {
45
+ "id": "5c2e8d1f3a4b6c13",
46
+ "type": "redkern-prom-metric",
47
+ "z": "5c2e8d1f3a4b6c10",
48
+ "name": "start",
49
+ "metric": "5c2e8d1f3a4b6c20",
50
+ "operation": "startTimer",
51
+ "autoStep": true,
52
+ "step": "",
53
+ "stepType": "str",
54
+ "status": "success",
55
+ "statusType": "str",
56
+ "value": "1",
57
+ "valueType": "num",
58
+ "duration": "",
59
+ "durationType": "msg",
60
+ "durationUnit": "seconds",
61
+ "timer": "",
62
+ "labels": [],
63
+ "x": 290,
64
+ "y": 100,
65
+ "wires": [
66
+ [
67
+ "5c2e8d1f3a4b6c14"
68
+ ]
69
+ ]
70
+ },
71
+ {
72
+ "id": "5c2e8d1f3a4b6c14",
73
+ "type": "delay",
74
+ "z": "5c2e8d1f3a4b6c10",
75
+ "name": "slow work",
76
+ "pauseType": "random",
77
+ "timeout": "1",
78
+ "timeoutUnits": "seconds",
79
+ "rate": "1",
80
+ "nbRateUnits": "1",
81
+ "rateUnits": "second",
82
+ "randomFirst": "100",
83
+ "randomLast": "900",
84
+ "randomUnits": "milliseconds",
85
+ "drop": false,
86
+ "allowrate": false,
87
+ "outputs": 1,
88
+ "x": 440,
89
+ "y": 100,
90
+ "wires": [
91
+ [
92
+ "5c2e8d1f3a4b6c15"
93
+ ]
94
+ ]
95
+ },
96
+ {
97
+ "id": "5c2e8d1f3a4b6c15",
98
+ "type": "redkern-prom-metric",
99
+ "z": "5c2e8d1f3a4b6c10",
100
+ "name": "stop",
101
+ "metric": "5c2e8d1f3a4b6c20",
102
+ "operation": "stopTimer",
103
+ "autoStep": true,
104
+ "step": "",
105
+ "stepType": "str",
106
+ "status": "success",
107
+ "statusType": "str",
108
+ "value": "1",
109
+ "valueType": "num",
110
+ "duration": "",
111
+ "durationType": "msg",
112
+ "durationUnit": "seconds",
113
+ "timer": "",
114
+ "labels": [],
115
+ "x": 590,
116
+ "y": 100,
117
+ "wires": [
118
+ []
119
+ ]
120
+ },
121
+ {
122
+ "id": "5c2e8d1f3a4b6c20",
123
+ "type": "redkern-prom-metric-config",
124
+ "name": "",
125
+ "metricType": "histogram",
126
+ "metricName": "nodered_example_section_seconds",
127
+ "help": "Duration of the example section",
128
+ "labelNames": "",
129
+ "buckets": "0.1, 0.25, 0.5, 1, 2.5",
130
+ "withDuration": false,
131
+ "durationBuckets": "",
132
+ "percentiles": "",
133
+ "maxAgeSeconds": "",
134
+ "ageBuckets": "",
135
+ "maxSeriesPerMetric": 1000,
136
+ "allowlist": []
137
+ }
138
+ ]