Feature Request:`JobCount()` client function

Open
#1,017 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, prometheus
Domain
api, backend

Research direction

Start at the client’s existing JobList entry point and trace how its kind and state parameters reach the query. Add a lighter JobCount entry point that returns only the number of matching jobs rather than full JobRow values. Done means callers can count jobs by the same parameters without retrieving complete rows.

Written by the indexing model from the issue text.

Description

There's a nice JobList method on the client that can be used to get back a slice of all jobs, according to some provided params (kind, state etc).

I've been using this - but just to get a count of the number of jobs of each kind in each state (I've made a prometheus metrics Collector that keeps track of the number of jobs by kind and state).

This is quite a heavy query as it's returning the whole JobRow - which includes a bunch of fields I don't really care about for this narrow purpose.

It'd be great if there were a lighter weight JobCount method that would just return a count of the number of jobs according to the parameters.

Dominant language
Go
Stars
5.7k
Forks
179
Avg merge
15h 43m
Merged PRs (30d)
13

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.

More from riverqueue/river

All issues in riverqueue/river

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.