(name: string, options?: {
readonly description?: string | undefined
readonly attributes?: Metric.Attributes | undefined
readonly boundaries?: ReadonlyArray<number>
})
| 2529 | * @since 2.0.0 |
| 2530 | */ |
| 2531 | export const timer = (name: string, options?: { |
| 2532 | readonly description?: string | undefined |
| 2533 | readonly attributes?: Metric.Attributes | undefined |
| 2534 | readonly boundaries?: ReadonlyArray<number> |
| 2535 | }): Histogram<Duration.Duration> => { |
| 2536 | const boundaries = Predicate.isNotUndefined(options?.boundaries) |
| 2537 | ? options.boundaries |
| 2538 | : exponentialBoundaries({ start: 0.5, factor: 2, count: 35 }) |
| 2539 | const attributes = mergeAttributes(options?.attributes, { time_unit: "milliseconds" }) |
| 2540 | const metric = new HistogramMetric(name, { ...options, boundaries, attributes }) |
| 2541 | return mapInput(metric, Duration.toMillis) |
| 2542 | } |
| 2543 | |
| 2544 | /** |
| 2545 | * Retrieves the current state of the specified `Metric`. |
nothing calls this directly
no test coverage detected