lucaong / cubdb

Elixir embedded key/value database
Apache License 2.0
566 stars 23 forks source link

Telemetry integration #7

Open kwando opened 4 years ago

kwando commented 4 years ago

Would be cool if this library exposed metrics with telemetry.

I can give that integration a go if you think it is a worthwhile idea :)

lucaong commented 4 years ago

Hi @kwando , this is a great idea :)

As cubdb strives to be small and without dependencies (also to be used in minimal environments like Nerves), the best would be to report to telemetry only if it's available in the project, and do nothing otherwise. That way, the telemetry dependency would be optional.

kwando commented 4 years ago

I'll try to find some time for this during the holidays. I'm not sure how to do things conditionally based on available dependencies, but that will be a little exercise to figure out :)

lucaong commented 4 years ago

The Code.ensure_loaded?/1 function is useful to check if a module can be loaded or not, for example to check if an optional dependency is present or not. Also, a dependency can be marked as optional: true in mix.exs. 🙂