Module passage_transform

A parse_transform module for passage

Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>

Description

A parse_transform module for passage

This module handles passage_trace attribute.

If the attribute is appeared, the next function will be traced automatically.

See following example:

  -module(example).
 
  -compile({parse_transform, passage_transform}). % Enables `passage_transform'
 
  -passage_trace([{tags, #{foo => bar}}, {eval_tags, #{size => "byte_size(Bin)"}}]).
  -spec foo(binary()) -> binary().
  foo(Bin) ->
    <<"foo", Bin/binary>>.

The above foo function will be transformed as follows:

  foo(Bin) ->
    try
      passage_pd:start_span(foo, [{tags, #{application => example, module => example}}]),
      passage_pd:set_tags(#{process => self(), size => byte_size(Bin)}),
      <<"foo", Bin/binary>>
     after
      passage_pd:finish_span()
     end.

References

Function Index

parse_transform/2Performs transformations for passage

Function Details

parse_transform/2

parse_transform(AbstractForms, CompileOptions::list()) -> AbstractForms

Performs transformations for passage


Generated by EDoc, Oct 24 2017, 05:20:20.