garthk
TelemetryDecorator - @decorate functions for :telemetry.span/3
TelemetryDecorator uses Decorator to wrap a function’s body with a :telemetry.span/3 call. I’ve found the results easier to read and maintain than when I make the call explicitly.
To use it, take the dependency and add a @decorate attribute before any function for which you want telemetry:
defmodule MyApp.MyModule do
use TelemetryDecorator
@decorate telemetry([:my_app, :succeed])
def succeed(arg1, arg2) do
:...
end
end
Your event metadata will contain:
- Any variables matched by your arguments for
:start,:stop, and:exceptionevents - Your function’s
resultfor:stopevents (overriding any variable namedresult) - Any other variables you name with the
includeoption
I also include TelemetryDecorator.watch/1 for convenient console watching of any telemetry following the :telemetry.span/3 conventions.
Most Liked
hauleth
TBH this is probably the only use case of decorator that I find ok with my internal Programmer Zen.
5
Popular in Libraries
Lexical
Lexical is a next-generation language server for the Elixir programming language.
Features
Context aware code completion
As-you...
New
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix!
You can read this blog post or the docs for more info...
New
I’ve just released stable versions of my Prometheus Elixir libs:
Elixir client [docs];
Ecto collector [docs];
Plugs instrumenter/Export...
New
Dear Elixir community,
After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Presenting Aviacommerce, open source e-commerce platform in Elixir
Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
New
After working on it for a couple of months and using it in production for most of that time, today I’ve released LiveAdmin, a LiveView ba...
New
Hello everybody :wave:
Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
Prometheus metrics and Grafana dashboards for all of your favorite Elixir libraries
I have been put...
New
Other popular topics
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
What is most correct way to open, read and parse JSON file with poison?
For example if we have example.json file in root of some projec...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New







