Replies: 0 comments 11 replies
-
Hey @cognivore, thanks for following up! It was great meeting you at the conference :) We actually had two people, @actualwitch and @stephlow, start poking around trying to implement it in Elixir yesterday so your suggestion came at a perfect time. I'll let them follow up with ideas/questions, since they're more in the weeds with trying to implement it. I'm not a big forum person and am embarrassed to say I'm still on the blue bird site ;) but if you want to come chat about autometrics, we've got a dedicated channel on Fiberplane's Discord https://discord.gg/kHtwcH8As9 |
Beta Was this translation helpful? Give feedback.
-
This is an embarrassing failure of autocutsel. Only now I realised that I pasted a link to the wrong article in the OP!!! http://sled.rs/errors.html <- here's the correct one @emschwartz |
Beta Was this translation helpful? Give feedback.
-
Thanks @cognivore for the initial ideas around this! @actualwitch and @stephlow played around with a couple of things and it seems like there are a couple of different ways to implement autometrics in Elixir. None of us are Elixir experts so we could very much use input on these options! To make autometrics work in Elixir, we need two components:
Instrumenting FunctionsAs far as we can tell, there are a number of options that seem viable. The main question probably comes down to Elixir library API design: which of these options would Elixir developers find most natural to use? Option 1: Overriding
|
Beta Was this translation helpful? Give feedback.
-
Trying to catch up on what autometrics is, but let me be clear. None of these options are acceptable from an elixir dev point of view. A better solution, to get the data at least, would be to use dynamic tracing. This is what I do in Orion. Hell tbh, what I do in Orion is exactly targeting your use case, except I do not need Prometheus. I already have plans to extend it to the IDE so you can get your graph directly in your IDE, with no need for any kind of storage. If you go this way, please consider using dynamic tracing. This way, you do not need to annotate anything or modify the AST. On the VSCode side. You probably do not need to use it, or more precisely, you probably want to use one of the more recent ways to programmatically modify elixir code. There are a few libraries that are starting to pop up, usually based on sourceror. I do not think they are integrated yet into the elixir_ls repo, but that would probably be a first step, at least if you want to inject something into the comments. On the old version of ElixirSense, I just checked and the version rn in the main branch is from 11th February 23. Slightly old, but not that much. If you ask for it to be merged or offer a PR, it will probably happen fast-ish. Feel free to ask more questions as much as you need :) |
Beta Was this translation helpful? Give feedback.
-
My two cents here: Largely agree with @DianaOlympos here. None of these options are super great. ImplementationLike @DianaOlympos said, option 1 and 2 are unacceptable, unlikely to be adopted by the Elixir community and probably break a lot of tooling/syntax highlighting. I'd refrain from these anytime Option 3 is not loved by the entire community, but is definitely the least breaking. Afaik I made comments about appsignal performance to mies, but that was largely caused by their proprietary daemon. Option 4 is probably the most idiomatic elixir, but I do share your concerns about it impacting readability and causing stupidly large diffs, so does not sound like a great solution to your problem. (I probably would not use it because of readability concerns). TLDR, I'd pick option 3. It's not idiomatic, but it works! To be quite honest: I'd use telemetry as much as possible to learn about the time certain operations take. It's implemented by most libraries (ecto, absinthe, phoenix) and gives ample information. There are many different backends and integrations for telemetry, which makes me wonder whether you really need to build yet another tool for this. Showing chart linksRewriting docs to include links is tough. Every tool relies on You may be able to pass some options or write a custom formatter for ex_doc to add it to the html of generated docs. That's the best I can come up with right now. Or roll your own vscode plugin, which shows gitlens-like annotations. |
Beta Was this translation helpful? Give feedback.
-
Hi, @emschwartz! We chatted at the conference, and on the next day I tried to guess your E-Mail address, but failed.
I'm tempted to write a small library based on this for injecting code, but for the time being, here's a sketch of a naive redefined
defmodule
(! you have to redefine defmodule becausedef
doesn't have access to@doc
!) for your atometrics:Given:
Redefine
defmodule
as:This will mess up other macros that redefine
defmodule
(lol), so you should check out Qqwy's sketch to prevent unsafe overrides: https://gist.github.com/Qqwy/d7d3fe9e172edc9a2a836f6754375819Sorry for not writing the actual code, but these bits should be good enough for copilot to write the macro for you haha.
Hope it'll be a breeze to release autometrics for Elixir... I'm absolutely gonna learn how to run prometheus and grafana on a plain VPS to test it in production!
P.S.
I found the error data types article too:
https://www.shuttle.rs/blog/2022/06/30/error-handling
P.P.S.
Are there any forums you hang out on (aside from tw*tter), would be cool to stay in touch!
P.P.P.S.
Correct link to the article: http://sled.rs/errors.html
Beta Was this translation helpful? Give feedback.
All reactions