prometheus / prometheus/client_js

Pushgateway metrics

Open
#363 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.5k
Forks
429
Avg merge
3d 3h
Merged PRs (30d)
22

Description

const client = require('prom-client');
const collectDefaultMetrics = client.collectDefaultMetrics;
const Registry = client.Registry;
const register = new Registry();
collectDefaultMetrics({ register: register, prefix: 'prefix_' }); //ok, but without prefix

const test = new client.Counter({
    name: 'prefix_test',
    help: 'prefix_test',
    registers: [register]
});
register.registerMetric(test);
test.inc(10); //not ok.

let gateway = new client.Pushgateway('http://127.0.0.1:9091', [], register);

gateway.push({ jobName: 'test' }, function (err, resp, body) {});

I am trying to use Pushgateway. Default metrics pushed successfully but without prefix. But my test counter doesn't push to gateway.
Maybe I missed something? Really lacking a full-featured example with Pushgateway

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start with the provided Registry, collectDefaultMetrics, Counter, and Pushgateway.push flow. Compare the default metrics and test counter in the pushed output, then confirm whether the counter is registered and whether prefix handling matches the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, prometheus
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.