Skip to content

Conversation

@fredr
Copy link
Member

@fredr fredr commented Oct 30, 2025

Adds support for creating custom metrics in typescript apps. Depends on #2109

Inspired by the implementation in the go runtime.
Metrics needs to be defined within a service, and will automatically add the service label.

This implementation is backed by a SharedArrayBuffer, where each u64 slot is a metric value, created from js by the main thread. From js we do atomic operation to update values on this buffer, and from rust we do atomic load when collecting the metrics. The rust runtime is use to coordinate what slot should be used for a label set, so that we can support multiple workers updating the same metric.

@fredr fredr requested a review from eandre October 30, 2025 12:51
@fredr fredr self-assigned this Oct 30, 2025
@encore-cla
Copy link

encore-cla bot commented Oct 30, 2025

All committers have signed the CLA.

@fredr fredr force-pushed the fredr/ts-custom-metrics branch 2 times, most recently from 72f6462 to 1efb0bd Compare October 30, 2025 15:41
@fredr fredr force-pushed the fredr/ts-custom-metrics branch from b59ebcb to b24e057 Compare December 3, 2025 10:20
eandre
eandre previously approved these changes Dec 11, 2025
Base automatically changed from fredr/ts-metrics to main December 12, 2025 09:11
@fredr fredr dismissed eandre’s stale review December 12, 2025 09:11

The base branch was changed.

@fredr fredr force-pushed the fredr/ts-custom-metrics branch from 044fbdd to 2511f0f Compare December 12, 2025 09:11
@fredr fredr enabled auto-merge (squash) December 12, 2025 09:14
@fredr fredr merged commit 6552f95 into main Dec 12, 2025
5 checks passed
@fredr fredr deleted the fredr/ts-custom-metrics branch December 12, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants