Skip to content

katja-beam/katja_echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Katja Echo

Build Status Coverage Status

Katja Echo is a test library tool that helps performing tests on these specific use cases:

  • Testing riemann client implementations: instead of starting and running the riemann.io server, one can use Katja Echo that will listen and interact with the any riemann.io client faking the riemann.io server behaviour
  • If an application uses riemann.io, Katja Echo allows you to run tests without defining special configurations to start the riemann.io before running any test. In other words, you don't need to start a riemann.io server
  • During specific tests (like: load, performance or integration), Katja Echo can be used to track the values sended. Later, use Riemann queries (or calling Katja Echo APIs) to inspect the values.

Besides the above listed itens, riemann.io implements a simple protocol and query parsing which are good exercises as well suitable to use Erlang.

This project has an aim to help testing and not intends to be a full Riemann implementation.

Build

This project uses rebar3 as main build tool.

  • Compile:

    $ rebar3 compile

  • Running tests:

    $ rebar3 as test check

How to use

Add katja_echo as an application dependency (use test profile if needed):

{deps, [
    {katja_echo, "0.1.0"}
]}.

The following configuration is assumed as default values:

[
    {katja_echo, [
        {port, 5555},
        {pool, []},
        {callback, katja_echo_user}
    ]}
].

When testing, a typical test case looks like this:

    Fun = fun (_Event) -> ok end,
    {ok, Pid} = katja_echo:start_link(),

    % sending riemann events using any client

    % call katja_echo query. Or call the riemann client query function
    Events = katja_echo:query(Fun, "service = \"my service\"").

Resources

Riemann

Katja Echo can receive and send messages using Riemann Protocol Buffer.

Also query message was based on Riemann Query and the respective tests implementation.

The grammar was implemented based on Riemann antlr grammar.

Scanner and Parser

The following links are great source of knowledge about how to write a scanner and parer using yecc/leex:

License

MIT.