Skip to content

Allow specifying count when observing a histogram entry #514

Description

@nordfjord

This would be useful in cases where you're doing batch processing.

const start = process.hrtime.bigint();
await doBatchProcessing(batch)
const duration = Number(process.hrtime.bigint() - start) / 1e9
// record the histogram for the processing time of "each" item
histogram.observe({label: 'something'}, duration / batch.length, batch.length)

Current workaround is something like:

const start = process.hrtime.bigint();
await doBatchProcessing(batch)
const duration = Number(process.hrtime.bigint() - start) / 1e9
for (let i = 0; i < batch.length; ++i) {
  histogram.observe({label: 'something'}, duration / batch.length)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions