Debian Codegraph @

doc/src/manual/cowboy_tracer_h.asciidoc

raw
1 = cowboy_tracer_h(3)
2
3 == Name
4
5 cowboy_tracer_h - Tracer stream handler
6
7 == Description
8
9 The module `cowboy_tracer_h` can be used to conditionally
10 trace streams based on information found in the request.
11 Trace messages are given to the configured callback.
12
13 == Options
14
15 [source,erlang]
16 ----
17 opts() :: #{
18 tracer_callback => Callback,
19 tracer_flags => [atom()],
20 tracer_match_specs => [MatchSpec]
21 }
22
23 Callback :: fun((init | terminate | tuple(), State) -> State)
24
25 MatchSpec :: MatchPredicate
26 | {method, binary()}
27 | {host, binary()}
28 | {path, binary()}
29 | {path_start, binary()}
30 | {header, binary()}
31 | {header, binary(), binary()}
32 | {peer_ip, inet:ip_address()}
33
34 MatchPredicate :: fun((cowboy_stream:streamid(),
35 cowboy_req:req(),
36 cowboy:opts()) -> boolean())
37 }
38 ----
39
40 Configuration for the tracer stream handler.
41
42 This module will not set trace patterns. Those must be
43 set by the user directly, either from the callback's
44 `init` or, preferably, in advance.
45
46 tracer_callback::
47
48 The function that will be called for each trace
49 events. It will also be called before any trace
50 event with an argument `init`, and when the
51 stream is terminated with an argument `terminate`.
52 +
53 This option is required for tracing to be enabled.
54 The tracer stream handler does nothing otherwise.
55
56 tracer_flags::
57
58 Trace flags to enable. See the documentation
59 of `erlang:trace/3` for details. Note that all
60 trace flags are allowed except for the `tracer`
61 flag.
62
63 tracer_match_specs::
64
65 A list of match conditions that must all be
66 fulfilled for the stream to be traced. Cowboy
67 will compare these with the information found
68 in the request and only enable tracing if all
69 matches succeed.
70 +
71 This option is required for tracing to be enabled.
72 The tracer stream handler does nothing otherwise.
73
74 == Events
75
76 The tracer stream handler does not produce any event.
77
78 == Changelog
79
80 * *2.7*: Module introduced.
81
82 == See also
83
84 link:man:cowboy(7)[cowboy(7)],
85 link:man:cowboy_stream(3)[cowboy_stream(3)],
86 link:man:cowboy_compress_h(3)[cowboy_compress_h(3)],
87 link:man:cowboy_decompress_h(3)[cowboy_decompress_h(3)],
88 link:man:cowboy_metrics_h(3)[cowboy_metrics_h(3)],
89 link:man:cowboy_stream_h(3)[cowboy_stream_h(3)]