(context: Context.Context<never>)
| 1684 | abstract createHooks(): Metric.Hooks<Input, State> |
| 1685 | |
| 1686 | hook(context: Context.Context<never>): Metric.Hooks<Input, State> { |
| 1687 | const extraAttributes = Context.get(context, CurrentMetricAttributes) |
| 1688 | if (Object.keys(extraAttributes).length === 0) { |
| 1689 | if (Predicate.isNotUndefined(this.#metadata)) { |
| 1690 | return this.#metadata.hooks |
| 1691 | } |
| 1692 | this.#metadata = this.getOrCreate(context, this.attributes) |
| 1693 | return this.#metadata.hooks |
| 1694 | } |
| 1695 | const mergedAttributes = mergeAttributes(this.attributes, extraAttributes) |
| 1696 | let metadata = this.#metadataCache.get(mergedAttributes) |
| 1697 | if (Predicate.isNotUndefined(metadata)) { |
| 1698 | return metadata.hooks |
| 1699 | } |
| 1700 | metadata = this.getOrCreate(context, mergedAttributes) |
| 1701 | this.#metadataCache.set(mergedAttributes, metadata) |
| 1702 | return metadata.hooks |
| 1703 | } |
| 1704 | |
| 1705 | getOrCreate( |
| 1706 | context: Context.Context<never>, |
nothing calls this directly
no test coverage detected