Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add typesafe wrappers for prom client metrics #5969

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

nunogois
Copy link
Member

https://linear.app/unleash/issue/2-1856/add-typesafe-wrappers-over-prom-clients-metrics

As discussed on the latest knowledge sharing session, this adds typesafe wrappers over prom client's metrics, requiring us to specify all the configured labels for each metric.

This uses a functional approach and only exposes the methods that are currently relevant to us, while also exposing the underlying instance of the metric for an easy access if needed.

Since we often chain labels with inc in counters, this adds a convenience increment method for counters which does both in a single call.

Copy link

vercel bot commented Jan 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Jan 19, 2024 11:27am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Jan 19, 2024 11:27am

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ay I really like this!

Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool. :)

toggle: featureName,
project,
environment: 'default',
environmentType: 'production',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these environment and environmentType values are on purpose? I found it weird that these ones are specified, but not the others.

@nunogois nunogois force-pushed the refactor-prom-client-typesafe-wrappers branch from 0fc3102 to d5e32aa Compare January 19, 2024 11:27
@nunogois nunogois merged commit 5253482 into main Jan 19, 2024
6 checks passed
@nunogois nunogois deleted the refactor-prom-client-typesafe-wrappers branch January 19, 2024 14:51
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