mudasobwa

mudasobwa

Creator of Cure

I am glad to announce the first Telemetria release. telemetria v0.25.0 — Documentation

It takes care of event registration (through compilation manifest), runtime and release configs (through config provider), and basically allows to wrap any expressions and/or functions to “telemetryized” calls.

If you hesitated to add telemetry to your project, it’s a great time. Example from docs:

defmodule MyMod do
  import Telemetria

  defpt pi, do: 3.14
  deft answer, do: 42 - pi()

  def inner do
    short_result = t(42 * 42)
    result =
      t do
        # long calculations
        :ok
      end
  end
end

Enjoy. Mode details are in the linked above docs. Feedback is very welcome, as always.

Showing Posts 1 to 10

domvas

domvas

I can’t tell anything about how it’s working. But one thing keeps me away from using it: the cryptic names.
Reading deft, defpt, t in some code doesn’t tell me anything about what is it then it makes the understanding harder imo.

mudasobwa

mudasobwa OP

Creator of Cure

Well, either one uses telemetry or not.

If one uses it, each keystroke matters. And since deft stands for def+t and t for telemetry, I am positive it’s not as hard to memorize.

Imagine if Kernel.defp/2 macro was called Kernel.define_private_function/2.

lpil

lpil

Creator of Gleam

Could you expand a bit on what this does? I don’t understand the code snippet.

mudasobwa

mudasobwa OP

Creator of Cure

The link in the very first line leads to the more-or-less detailed documentation.

lpil

lpil

Creator of Gleam

After reading the example and the documentation it’s still not clear to me what this library does, some more detail and examples would be useful! Thanks

dimitarvp

dimitarvp

Random notes:

  • English nitpick: “macroses” => “macros”
  • English nitpick: “sware about” => “aware about”
  • I’d like the option to not have t be the default wrapping block. Could be something like report_duration (not sure I am getting this right so the name could be very off) and then you could also have a module we could use like this: use Telemetria.Shortcuts which aliases the longer name to t?
  • I am not versed in :telemetry at all so to me the statement about telemetry: false is confusing. Not saying programmers shouldn’t do our homework but in my eyes, if you went through the trouble to make an easier-to-use wrapper, you might as well also add some hand-holding quick explanations about :telemetry itself.
  • Similar to above and due to me not being caught up with the :telemetry module, I have zero clue what deft and defpt wrap in terms of def or defp exactly? Are deft and defpt functions that always yield telemetry events?

I am grateful for your efforts. But to me an even better onboarding would be to include things that you seem to find superfluous and/or easy to locate in other sources. It’d save time for interested users like myself if all needed info to start with :telemetry was in your docs as well.

mudasobwa

mudasobwa OP

Creator of Cure

OK, I will try.

deft/2 and defpt/2 are simply wrappers for Kernel.def/2 and Kernel.defp/2 respectively. They are somewhat similar to AOP around aspect, mesauring the time spent in the function itself and sending the telemetry event.

t/2 does the same for anonymous functions and expressions. The latter also allows to pass context as the second parameter to be attached to the event.

Events automatically get the names based on modules / functions (configurable) and the events are registered within :telemetry automagically by a compiler.

In general, it allows to have zero boilerplate when working with complicated/huge set of :telemetry events.

I hope it became a bit clearer.

mudasobwa

mudasobwa OP

Creator of Cure

Thanks, fixed!

Sounds reasonable. I’d love to collect more opinions, but atm I think that’s the way to go.

Basically one might configure functions that would be excluded from wrapping into :telemetry despite they are still declared with deft/defpt with zero overhead (compile-time purge.)

I honestly thought :telemetry is something like Jason nowadays, everyone should have at least read about; Phoenix docs mention it, Ecto docs do, etc.

I will try to add a couple of sentences, but I definitely want to avoid being DHH here. If one have never heard about :telemetry, they probably should have started with :telemetry itself to understand how it works in a nutshell, and only then come for libraries hiding the boilerplate.

:telemetry is a side effect. Both would behave exactly as def/2 and defp/2 from the consumer point of view. Only side effect of sending :telemetry events would happen under the hood.

mudasobwa

mudasobwa OP

Creator of Cure

BTW, you always might do

  import Telemetria, except: [t: 2]
  ...

    Telemetria.t do
      ...
    end
dimitarvp

dimitarvp

Sure, that’s your choice to make and I am not trying to change your mind. It’s simply my observation that very fast onboarding makes people much more likely to use a library. When all the info is at the same page, people are more willing to try.

I know what :telemetry is, it’s just that I never used it so far (and I want to). What I was saying was that your library could have finally made me try it but not if I have to dig separately. :slight_smile: I openly used the term “hand-holding” and I meant it. :003:

But again, it’s your choice. Thanks for sharing your thought process. :023:

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New

Other Trending Topics Top

mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews