NORTHSET
Proof-of-Pass Receipt — M-014
CONTRIBUTOR SELF-RUN — NOT MAINTAINER VERIFICATION
Project
Work
Verification execution
runtime: northset-oss executor v0
human operator: aeziz
Code
- base
7c54cc43cc5443e79d92ff4b9b732c2b091b6517- recorded patch commit
6e2083494d2cb088ee5bb9fb82bc05deb16a684e
declared metadata; not execution-bound- patch diff SHA-256
sha256:48a2c9ae72581cf4767ec4bc01ed2b1468ebf12aef9973f6e4ecf49c4803b666
bound to executed patch bytes
Environment
- image reference
- node:22-bookworm
- repository digest
node@sha256:a25c9934ff6382cd4f08b6bc26c82bf4ea69b1e6f8dabfb2ead457374127c365- network
- phaseA:bridge,phaseB:none
Declared checks
Execution summary
1/1 declared command returned exit 0 in the recorded environment
npm run test-unitexit 0 · 5.6s
unclassified executor time (derived residual) 1m07s
run wall (derived from recorded timestamps) 1m12s
PASS — 1/1 declared command
Every command listed returned exit 0 in the declared environment. Only the listed commands are in scope. Unlisted test, lint, typecheck, build, coverage, compiler, full-suite, and CI gates are not implied or recorded.
Public scope interpretation
Contributor self-run record of Northset’s own contribution; not the maintainer’s verification. The declared network-off check runs `npm run test-unit` on node:22-bookworm after a disclosed online install. It does not run lint, type-check, or the full upstream CI gates.
Record details
- payment
- none · not merge-contingent
- redactions
- 1 email
- Bundle contents digest
sha256:8d24baf5c1f7ed157ee0f9b4d268e7f55afead025ca21e85095a986ef174209f- Signed asset SHA-256
sha256:1121a9aa74a20a29854bd9130157cc6dd628d5ebfe27ff55c53e0e99348f2cfe- Signed provenance recorded
- verified 2026-07-14T14:21:48Z
NOT INCLUDED
- Does not prove code quality
- Does not prove security
- Contributor self-run record of Northset’s own contribution; not the maintainer’s verification.
- The declared network-off check runs `npm run test-unit` on node:22-bookworm after a disclosed online install. It does not run lint, type-check, or the full upstream CI gates.
Signed bundle
Verify this receipt
gh attestation verify run-record-M-014.tar.gz --repo northset-oss/verification-pilot --signer-workflow northset-oss/verification-pilot/.github/workflows/attest-bundle.ymlAttestation confirms that Northset's signing workflow produced this exact bundle. The signer does not witness the recorded run, and verification does not turn it into maintainer verification.
QR → receipt pageCommitted patch.diff
diff --git a/index.d.ts b/index.d.ts
index 8c0ebb2..fe41cc4 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -323,6 +323,7 @@ export interface CounterConfiguration<
T extends string,
> extends MetricConfiguration<T> {
collect?: CollectFunction<Counter<T>>;
+ useCounterValueAsExemplar?: boolean;
}
export interface IncreaseDataWithExemplar<T extends string> {
diff --git a/lib/counter.js b/lib/counter.js
index 7835c8d..b6ce480 100644
--- a/lib/counter.js
+++ b/lib/counter.js
@@ -24,7 +24,7 @@ const Exemplar = require('./exemplar');
class Counter extends Metric {
constructor(config) {
- super(config);
+ super(config, { useCounterValueAsExemplar: false });
this.type = 'counter';
this.defaultLabels = {};
this.defaultValue = 1;
@@ -93,7 +93,11 @@ class Counter extends Metric {
entry.exemplar ??= new Exemplar();
entry.exemplar.validateExemplarLabelSet(exemplarLabels);
entry.exemplar.labelSet = exemplarLabels;
- entry.exemplar.value = value ? value : 1;
+ entry.exemplar.value = this.useCounterValueAsExemplar
+ ? entry.value
+ : value
+ ? value
+ : 1;
entry.exemplar.timestamp = nowTimestamp();
}
diff --git a/test/exemplarsTest.js b/test/exemplarsTest.js
index 0ad6588..344d523 100644
--- a/test/exemplarsTest.js
+++ b/test/exemplarsTest.js
@@ -60,6 +60,34 @@ describe('Exemplars', () => {
);
});
+ it('should optionally use the counter value for exemplars', async () => {
+ const counterWithTotal = new Counter({
+ name: 'counter_total_exemplar_test',
+ help: 'help',
+ enableExemplars: true,
+ useCounterValueAsExemplar: true,
+ registers: [],
+ });
+ const counterWithIncrement = new Counter({
+ name: 'counter_increment_exemplar_test',
+ help: 'help',
+ enableExemplars: true,
+ registers: [],
+ });
+
+ counterWithTotal.inc({ exemplarLabels: { traceId: 'x' } });
+ counterWithTotal.inc({ exemplarLabels: { traceId: 'x' } });
+ counterWithIncrement.inc({ exemplarLabels: { traceId: 'x' } });
+ counterWithIncrement.inc({ exemplarLabels: { traceId: 'x' } });
+
+ const totalValues = await counterWithTotal.get();
+ const incrementValues = await counterWithIncrement.get();
+ expect(totalValues.values[0].value).toEqual(2);
+ expect(totalValues.values[0].exemplar.value).toEqual(2);
+ expect(incrementValues.values[0].value).toEqual(2);
+ expect(incrementValues.values[0].exemplar.value).toEqual(1);
+ });
+
it('should make histogram with exemplars on multiple buckets', async () => {
const histogramInstance = new Histogram({
name: 'histogram_exemplar_test',
Redacted stdout
=== cmd 1: npm run test-unit ===
> @[REDACTED:email] test-unit
> jest
Redacted stderr
=== cmd 1: npm run test-unit ===
PASS test/histogramTest.js
PASS test/summaryTest.js
PASS test/registerTest.js
PASS test/utilTest.js
PASS test/gaugeTest.js
PASS test/exemplarsTest.js
PASS test/counterTest.js
PASS test/defaultMetricsTest.js
PASS test/pushgatewayWithPathTest.js
PASS test/pushgatewayTest.js
PASS test/aggregatorsTest.js
PASS test/metrics/heapSpacesSizeAndUsedTest.js
PASS test/metrics/eventLoopLagTest.js
PASS test/timeWindowQuantilesTest.js
PASS test/metrics/maxFileDescriptorsTest.js
PASS test/clusterTest.js
PASS test/bucketGeneratorsTest.js
PASS test/metrics/versionTest.js
PASS test/metrics/heapSizeAndUsedTest.js
PASS test/workerTest.js
PASS test/metrics/gcTest.js
PASS test/metrics/processRequestsTest.js
PASS test/metrics/processHandlesTest.js
PASS test/browserCompatibilityTest.js
PASS test/metrics/processStartTimeTest.js
PASS test/metrics/processOpenFileDescriptorsTest.js
PASS test/metrics/processResourcesTest.js
PASS test/validationTest.js
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
Test Suites: 28 passed, 28 total
Tests: 543 passed, 543 total
Snapshots: 34 passed, 34 total
Time: 3.724 s
Ran all test suites.