Files
teleport/lib/utils
Julia Ogris 6c8ea32bc2 app: Add active sessions Prometheus gauge (#65008)
* fncache: Pass non-cancellable context to `OnExpiry` callbacks

Call `OnExpiry` when `get()` replaces an expired entry on reload.
Previously, entries that expired between cleanup intervals were
silently dropped when a new request triggered a reload, skipping
the `OnExpiry` callback entirely.

Use `context.WithoutCancel(c.cfg.Context)` at both the
`removeExpiredLocked` and `get` call sites so that `OnExpiry` work
completes even after shutdown begins. `Shutdown` cancels
`c.cfg.Context` via `c.cancel()` before processing entries, but
these two call sites passed `c.cfg.Context` directly, meaning
goroutines spawned by `OnExpiry` could run with an
already-cancelled context.

Update the `OnExpiry` doc comment to warn that the cache mutex may
be held when the callback is invoked.

* app: Add active sessions Prometheus gauge

Add a `teleport_app_active_sessions` gauge labeled by app name that
tracks HTTP app sessions on each agent. The gauge increments when a
session chunk is created and decrements after the session chunk
finishes closing, so it reflects sessions still holding resources
(audit streams, disk I/O) rather than just sessions accepting new
requests.

TCP and MCP sessions are excluded because they bypass the session
chunk cache.

* fncache: Fix `OnExpires` typo in `Shutdown` doc comment

Correct the stale field name `OnExpires` to `OnExpiry` in the
`Shutdown` method's doc comment to match the actual field name in
`FnCacheConfig`.
2026-04-23 02:44:47 +00:00
..
2025-12-15 22:30:52 +00:00
2025-10-01 20:30:50 +00:00
2025-08-01 18:42:18 +00:00
2025-07-15 18:11:10 +00:00
2025-09-22 20:42:45 +00:00
2026-04-22 14:57:55 +00:00
2024-12-19 15:08:04 +00:00
2025-10-06 17:10:50 +00:00
2025-08-01 18:42:18 +00:00
2025-05-07 22:14:51 +00:00
2024-01-25 22:01:14 +00:00
2025-10-29 15:19:44 +00:00