et_selector(3)

πŸ“¦
version 29.0.6 Β· 2 versions
, in nixos 26.05, nixpkgs unstable, ubuntu stonking

πŸ‘‘ NAME πŸ‘‘

et_selector β€” define event transforms and trace patterns πŸ’…

(yeah bestie, this is et_selector(3), straight out of your Erlang Module Definition era ✨)


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk: this DESCRIPTION section is literally empty in the source β€” the manual just drops you straight into the data types and the functions. no lore, no backstory, just pure API. iconic honestly. moving on 🫢

🌸 DATA TYPES 🌸

  • event() :: #event{}. β€” an event record, that's the whole vibe πŸ’«
  • level() :: 0..100. β€” a detail level, a number that lives anywhere from 0 to 100 inclusive, no cap πŸ”₯

πŸ’– FUNCTIONS πŸ’–

πŸŽ€ change_pattern/1

change_pattern({Mod :: module(), Pattern}) -> ok
                           when
                               Pattern ::
                                   DetailLevel | TracePattern |
                                   EmptyTracePattern,
                               DetailLevel :: level(),
                               TracePattern ::
                                   [{[term()] | '_' | atom(),
                                     [term()],
                                     [term()]}],
                               EmptyTracePattern :: [].

this one turns tracing on or off by swapping out the current trace pattern. it's giving "main character flips the switch" energy ✨

here's how the detail level call goes down:

  • min detail level β†’ deactivates tracing of calls to et:trace_me/4,5 πŸ™ˆ
  • max detail level β†’ activates tracing of all calls to et:trace_me/4,5 πŸ‘‘
  • integer(X) detail level β†’ activates tracing of all calls to et:trace_me/4,5 whose detail level argument is lesser than X πŸ’«
  • an empty match spec β†’ deactivates tracing of calls to et:trace_me/4,5 πŸ’€
  • other match specs β†’ activates tracing of calls to et:trace_me/4,5 accordingly with erlang:trace_pattern/2 πŸ”₯

🧚 make_pattern/1

make_pattern({Mod :: module(), RawPattern}) ->
                        {Mod :: module(), TracePattern}
                        when
                            RawPattern :: level(),
                            TracePattern ::
                                [{[term()] | '_' | atom(),
                                  [term()],
                                  [term()]}].

this one bakes a trace pattern that's suitable to feed straight into change_pattern/1 πŸ“

same detail level rules, same energy:

  • Min detail level β†’ deactivates tracing of calls to et:trace_me/4,5 πŸ™ˆ
  • Max detail level β†’ activates tracing of all calls to et:trace_me/4,5 πŸ‘‘
  • integer(X) detail level β†’ activates tracing of all calls to et:trace_me/4,5 whose detail level argument is lesser than X πŸ’«
also, go peek at erlang:trace_pattern/2 if you want more info about its match_spec() β€” iykyk 🌈

🌈 parse_event/2

parse_event(Mod, ValidTraceData) -> boolean | {true, event()}
                       when
                           Mod :: module(),
                           ValidTraceData :: ErlangTraceData | event(),
                           ErlangTraceData ::
                               {trace, pid(), atom(), term()} |
                               {trace, pid(), atom(), term(), term()} |
                               {trace_ts,
                                pid(),
                                atom(),
                                term(),
                                TS :: {integer(), integer(), integer()}} |
                               {trace_ts,
                                pid(),
                                atom(),
                                term(),
                                term(),
                                TS :: {integer(), integer(), integer()}} |
                               {seq_trace, atom(), term()} |
                               {seq_trace,
                                atom(),
                                term(),
                                TS :: {integer(), integer(), integer()}} |
                               {drop, integer()}.

this is the glow-up function: it transforms trace data and makes an event record out of it πŸ’…βœ¨

if you want the semantics of that trace data, erlang:trace/3 is where the lore lives πŸ“–

an event record is made of these fields, bestie:

  • detail_level β€” noise has a high level as opposed to essentials 🌊
  • trace_ts β€” time when the trace was generated. same as event_ts if omitted in trace data ⏰
  • event_ts β€” time when the event record was created πŸ•°οΈ
  • from β€” from actor, such as sender of a message πŸ“¨
  • to β€” to actor, such as receiver of message 🫢
  • label β€” label intended to provide a brief event summary 🏷️
  • contents β€” all nitty gritty details of the event 🧐

oh and go check et:trace_me/4 and et:trace_me/5 for the details πŸ‘€

and here's what it hands back to you:

  • {true, Event} β€” where Event is an #event{} record representing the trace data ✨
  • true β€” means the trace data already is an event record and it's valid exactly as it is. no transformation needed, it ate and left no crumbs πŸ‘‘
  • false β€” means the trace data is uninteresting and should be dropped πŸ’€

that's the whole page, babe πŸŽ€ brought to you by Ericsson AB, living in et version 1.8, forever known as et_selector(3) β€” stan a trace-pattern icon πŸ’–βœ¨

πŸ“¦ where this page comes from