Repository navigation
feat(telemetry): add queue health snapshots - #41
Merged
Merged
Conversation
elpete
marked this pull request as ready for review
October 25, 2026 19:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add provider-owned queue-health snapshots without a Sentry dependency or a default backend.
Choose a worker pool for worker activity plus its queue backlog, or a connection for backlog without local workers. Companion to Sentry #56, which uses one
automaticCollectors.queueslist:// Configure periodic collection in Sentry. moduleSettings.sentry.automaticCollectors = { // Start the sampler; the application also needs a valid DSN and enableMetrics=true. enabled: true, // One provider-neutral list for queue and worker measurements. queues: [ { // Fixed logical metric label, independent of cbq identifiers. name: "mail", // Explicit provider-owned implementation. adapter: "QueueHealthAdapter@cbq", // Choose worker activity plus backlog from this cbq worker pool. options: { // Its connection/provider and queue selection determine the snapshot. workerPool: "outbound" } } ] };For queue backlog without a worker pool:
// Use the same collector with a connection-only source. moduleSettings.sentry.automaticCollectors.queues = [ { // Fixed logical metric label. name: "mail", // Provider-owned snapshot implementation. adapter: "QueueHealthAdapter@cbq", // Select storage and queues without collecting shared worker activity. options: { // Registered cbq connection; its provider owns table/datasource settings. connection: "database", // Optional string, array or wildcard; omit to use the connection's default queue. queue: "mail" } } ];Configure exactly one of
workerPoolorconnection. The adapter resolves it freshly on every sample. Worker-pool selection uses that worker pool's connection and queue string/array/wildcard unlessoptions.queueoverrides backlog selection. Connection-only snapshots use the connection's default queue when no override is given and never include worker fields. Missing, blank, nonsimple, ambiguous and legacyoptions.poolselections raisecbq.Telemetry.InvalidQueueHealthSelection; a metric label never chooses a source.DBProvider.getQueueHealth()owns the configured table, datasource/query options and parameterized aggregate throughDatabaseQueueSnapshot. It reads pending depth/oldest age, runnable/delayed work and reserved/stale leases without reserving jobs or starting workers. Providers without queue-snapshot support retain supported worker fields, or return an empty connection-only snapshot. Missing capabilities stay absent, and sampling errors propagate rather than becoming zero.The adapter follows
sample(context)without importing a Sentry interface.WorkerHealthAdapter@cbqremains an alias, andsamplePool(pool)remains available for existing manual worker-only calls. Worker measurements describe the whole worker pool even whenoptions.queuenarrows backlog; use connection-only snapshots for extra per-queue breakdowns to avoid duplicating shared worker activity. No package/lock changes; selecting the mapping requires a cbq release containing this change.Checks
107f2b1againstmain, including the full Lucee 5/6 and Adobe 2021/2023/2025 matrix and real MySQL snapshots. Hosted CImainand preserved its isolated provider fixture for dialect compilation, so pretend queries cannot affect application-provider teardown.This is an additive minor release for cbq 7.1.0. The Ortus documentation update is cbq docs #2.
Local proof uses prepared runtimes. Actual worker heartbeats, process-crash recovery, non-database provider snapshots and real Sentry delivery/indexing remain outside this change.