Skip to content

Add available and waitDuration metric to util/gate.go - #17024

Open
pipiland2612 wants to merge 2 commits into
prometheus:mainfrom
pipiland2612:metric_for_gate
Open

pipiland2612 wants to merge 2 commits into
prometheus:mainfrom
pipiland2612:metric_for_gate

Conversation

@pipiland2612

@pipiland2612 pipiland2612 commented Aug 7, 2025 •

Copy link
Copy Markdown
Contributor

What issue is this pull request solves ?

Changes

  • added waitDuration counter tracks time spent waiting for gate access
  • added available gauge is the number that represent the total of free slot and the number of requests waiting to get in the gate (this can be negative to show that there are already somethings waiting)
  • added gate_test.go to test the new changes

Signed-off-by: pipiland2612 <[email protected]>
@pipiland2612 pipiland2612 changed the title add metrics to util/gate.go Add available and waitDuration metric to util/gate.go Aug 7, 2025
@pipiland2612

pipiland2612 commented Aug 8, 2025 •

Copy link
Copy Markdown
Contributor Author

Hi @bboreham, I'd love to hear your review in this pull request. Thanks!

Signed-off-by: pipiland2612 <[email protected]>
@bboreham

Copy link
Copy Markdown
Member

Hello from the bug-scrub! @juliusv you reviewed the previous PR - could you take a look at this one please?

@bboreham
bboreham requested a review from juliusv September 16, 2025 11:51

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding high level comments.

Also likely @GiedriusS could review this PR as @GiedriusS requested this feature (:

You can ping @GiedriusS on CNCF Slack too @pipiland2612 - I know Giedrius and I think he wouldn't mind that.

Name: "available_slots",
Help: "Available slots in gate (positive = available, negative = queued requests)",
}),
promauto.With(r).NewCounter(prometheus.CounterOpts{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a native histogram instead? 🤔

config: config,
remoteReadSampleLimit: remoteReadSampleLimit,
remoteReadGate: gate.New(remoteReadConcurrencyLimit,
promauto.With(r).NewGauge(prometheus.GaugeOpts{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this metric shouldn't come from gate "package" and allow specifying handler label 🤔

So prometheus_gate_available_slots{handler="remote_read"} etc

@pipiland2612

Copy link
Copy Markdown
Contributor Author

Hi @bwplotka, I have ping the author @GiedriusS ealier but seems like he's quite busy and I don't receive any reply yet. Do you think we should continue this PR anymore ?

@beorn7

beorn7 commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Hello from the bug scrub!

@bwplotka could you consider @pipiland2612's question and help them out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gate needs a waiting duration metric

4 participants