larshei
I have a number of different notifications, each identified by an id (example “ticket_closed”).
This ID can later be used to select the right E-Mail Template for the right language etc.
So basically, the recipient, the notification id and some metadata is stored as an Oban Job,
and the E-Mail is sent from there.
I would love to automatically extract all the available notification IDs, for 2 reasons:
- I could then check if I have an E-Mail template for each ID and
- I can check if any references to notification IDs are actually referring to existing IDs
I am pretty sure this is a rather simple task with mix/elixir, but so far I could not figure it out.
How could I extract all calls to a function and the functions n-th argument?
I found the tracers: compile options, however I am not sure how to add a Tracer inside a project that is meant to trace the project itselft (and would therefore needs itself compiled before it can compile itself?)
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











Showing Posts 1 to 6- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
alvises
Do you want trace function calls of a running app which you have access to? Or is it something you want to add to the code of your app which you’ll then deploy and run?
Can you please post an example of the code and function calls you want to trace?
larshei
He @alvises, thanks for the reply.
I do not want any runtime tracing.
It would be great to find all functions calls for
and extract the third argument Notification ID into a list.
LostKobrakai
Boundary seems to use a custom compiler (
Mix.Task.Compilerimplementation) which registeres itself as the tracer module. That probably makes mix load that module, before compilation of the project itself.alvises
@larshei I just saw you don’t need a tracer, you can ignore the post below (I didn’t find a way to delete my post
)
For debugging purpose, for an app at runtime, I’ve used on a running distributed cluster the
:dbgmodule, which is really simple to use.dimitarvp
You can try using GitHub - ast-grep/ast-grep: ⚡A CLI tool for code structural search, lint and rewriting. Written in Rust · GitHub.
Given this input on my machine:
Then you just run this:
And that gives you:
NOTE: it’s not perfect f.ex. if you have code that does
alias Notifications.Externaland then callsExternal.schedule(...)then this incantation will not catch it. Though you can also make variants for any levels of nesting i.e. replace the patternNotifications.External.schedule($USER_ID, $LINK, $TYPE, $METADATA)withExternal.schedule($USER_ID, $LINK, $TYPE, $METADATA)and you should be good. (And then you should be doing a union of all these results which is pretty easy withcatand then doingsort | uniqagain.)larshei
That is veeerry cool and will for sure be added to my list of tools.
This can get the job done I think, will try in a bit.
I am still curious about an erlang/elixir solution.