mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Closes #21217 This pull-request traverses the `token_usages.metadata[...]` fields and merges them into a single consumable object so that we're able discern information about the metadata within the token usages at a glance. Its not the be-all end-all implementation of this feature but its a stepping stone in order to render more useful data to the frontend. These are currently mergable because they only contain `number` based fields. When it encounters something within the object that can't be merged (minus empty objects `{}`) it will simply return them as an array. ### Preview <img width="2682" height="1360" alt="CleanShot 2025-11-28 at 15 30 09@2x" src="https://github.com/user-attachments/assets/e07e6515-4b8e-4169-841c-38fd83c434f9" /> ### Logic breakdown <img width="914" height="1016" alt="CleanShot 2025-11-28 at 15 11 13@2x" src="https://github.com/user-attachments/assets/34b78fe1-3b58-4b78-a552-028ea5a88dc4" />