-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add metrics to track queue sizes and add operations - #AES-361 #3282
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import PQueue from 'p-queue' | ||
import { ServiceMetrics as Metrics } from '@ceramicnetwork/observability' | ||
|
||
const TASK_QUEUE_SIZE = 'task_queue_size' | ||
const TASK_QUEUE_SIZE_PENDING = 'task_queue_size_pending' | ||
|
||
export const noop = () => { | ||
// Do Nothing | ||
|
@@ -52,6 +56,8 @@ export class TaskQueue implements TaskQueueLike { | |
* Size of the queue. Counts both deferred and currently running tasks. | ||
*/ | ||
get size(): number { | ||
Metrics.observe(TASK_QUEUE_SIZE, this.#pq.size) | ||
Metrics.observe(TASK_QUEUE_SIZE_PENDING, this.#pq.pending) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These might be less useful because there will be many Looks like they're instantiated through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, removed! |
||
return this.#pq.size + this.#pq.pending | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a
get
call, should we move these lines to theput
call? I don't think the S3 store is used anymore, but adding these doesn't hurt.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well - the way i read this, for whatever reason the .get of the s3 storage is adding a leveldb get call into the queue. so for monitoring the queue, i want it here.
The put doesn't add to the queue, it just does the put synchronously it seems