p2.7: prometheus /metrics
Default GET /metrics is Prometheus text; JSON stays at /metrics.json and ?format=json. :8443 needs the metrics caller bearer; loopback stays open. Restricted callers have no per-caller series and no tavily:restricted gauge.
This commit is contained in:
@@ -154,6 +154,31 @@ func (g *Gate) Release() {
|
||||
g.wakeLocked()
|
||||
}
|
||||
|
||||
func (g *Gate) Snapshot() (inflight, waiters int) {
|
||||
if g == nil {
|
||||
return 0, 0
|
||||
}
|
||||
g.mu.Lock()
|
||||
defer g.mu.Unlock()
|
||||
return g.inflight, len(g.waiters)
|
||||
}
|
||||
|
||||
func (e *Engine) Stats() (calls uint64, fallback map[string]uint64) {
|
||||
if e == nil {
|
||||
return 0, nil
|
||||
}
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
if e.Fallback == nil {
|
||||
return e.Calls, map[string]uint64{}
|
||||
}
|
||||
out := make(map[string]uint64, len(e.Fallback))
|
||||
for k, v := range e.Fallback {
|
||||
out[k] = v
|
||||
}
|
||||
return e.Calls, out
|
||||
}
|
||||
|
||||
type Engine struct {
|
||||
ChatURL string
|
||||
EmbedURL string
|
||||
|
||||
Reference in New Issue
Block a user