1 -module(beam_stats_consumer_statsd_SUITE).
3 -include_lib("beam_stats/include/beam_stats.hrl").
15 -define(GROUP, beam_stats_consumer_statsd).
17 %% ============================================================================
18 %% Common Test callbacks
19 %% ============================================================================
29 [{?GROUP, Properties, Tests}].
31 %% =============================================================================
33 %% =============================================================================
36 BEAMStats = #beam_stats
37 { timestamp = {1, 2, 3}
38 , node_id = 'node_foo@host_bar'
39 , memory = [{mem_type_foo, 1}]
42 , context_switches = 5
45 {ok, ServerSocket} = gen_udp:open(ServerPort, [binary, {active, false}]),
46 BEAMStatsQ = queue:in(BEAMStats, queue:new()),
47 Options = [{dst_port, ServerPort}],
48 {_, State1} = beam_stats_consumer_statsd:init(Options),
49 State2 = beam_stats_consumer_statsd:consume(BEAMStatsQ, State1),
50 {} = beam_stats_consumer_statsd:terminate(State2),
51 ResultOfReceive = gen_udp:recv(ServerSocket, 0),
52 ok = gen_udp:close(ServerSocket),
53 {ok, {_, _, Data}} = ResultOfReceive,
54 << "beam_stats.node_foo_host_bar.io.bytes_in:3|g\n"
55 , "beam_stats.node_foo_host_bar.io.bytes_out:7|g\n"
56 , "beam_stats.node_foo_host_bar.context_switches:5|g\n"
57 , "beam_stats.node_foo_host_bar.memory.mem_type_foo:1|g\n"