More stats.

This commit is contained in:
Sam Rose 2025-03-27 11:53:50 +00:00
parent 4329e1274c
commit 2f2424d8f5
No known key found for this signature in database
1 changed files with 15 additions and 1 deletions

View File

@ -173,6 +173,11 @@ export class BudibaseQueue<T> {
span.addTags(this.opts.jobTags(job.data))
}
tracer.dogstatsd.distribution(
"queue.process.sizeBytes",
sizeof(job.data),
this.metricTags()
)
await this.withMetrics("queue.process", () => cb(job))
})
}
@ -186,7 +191,11 @@ export class BudibaseQueue<T> {
async add(data: T, opts?: JobOptions): Promise<Job<T>> {
return await tracer.trace("queue.add", async span => {
span.addTags({ "queue.name": this.jobQueue, ...jobOptsTags(opts || {}) })
span.addTags({
"queue.name": this.jobQueue,
"job.data.sizeBytes": sizeof(data),
...jobOptsTags(opts || {}),
})
if (this.opts.jobTags) {
span.addTags(this.opts.jobTags(data))
}
@ -196,6 +205,11 @@ export class BudibaseQueue<T> {
spanId: span.context().toSpanId(),
}
tracer.dogstatsd.distribution(
"queue.add.sizeBytes",
sizeof(data),
this.metricTags()
)
return await this.withMetrics("queue.add", () =>
this.queue.add(data, opts)
)