tompave / fun_with_flags

Feature Flags/Toggles for Elixir
https://hexdocs.pm/fun_with_flags/FunWithFlags.html
MIT License
1.08k stars 79 forks source link

Add instrumentation using :telemetry #176

Open Kasse-Dembele opened 4 months ago

Kasse-Dembele commented 4 months ago

This PR adds instrumentation to FunWithFlags using the :telemetry library. This allows users to gain insights into the performance and usage of feature flags in their applications.

Key changes:

New telemetry events:

This change is backwards compatible and does not affect existing functionality. Users can choose to attach handlers to these events to collect metrics or perform logging.

This PR aims to provide better observability for applications using FunWithFlags, allowing for easier debugging, performance monitoring, and usage analytics.

Testing:

Next steps:

Feedback and suggestions are welcome! @tompave

tompave commented 3 months ago

Hi, thank you for using the library and for the PR. This is some nice work! I think I can accept this change, but first I want to measure the performance overhead.

In the meantime, can you please merge in master or rebase? I've updated the CI matrix and it'd be good to re-run CI with the latest Elixir and OTP versions.

I can also see that at the moment the telemetry tests are failing with Elixir 1.14 (is it incompatible?), but the good news is that I'm dropping support for Elixir 1.14 (it's removed from CI on master), so that won't be a concern. Still, I'd be curious to know why it's failing there.

jmartinezpoq commented 3 days ago

I love this idea, I was thinking of building an ad hoc solution to solve this problem

Is there anything pending to be able to add this to the library? Can we help in any way to make this a reality? @tompave