Module katja_connection

Handles connections to Riemann.

Copyright © ?? Daniel Kempkens

Version: Apr 13 2020 14:27:19

Authors: Daniel Kempkens (daniel@kempkens.io).

Description

Handles connections to Riemann.

Data Types

state()

abstract datatype: state()

transport()

transport() = detect | udp | tcp | config

Function Index

connect/0Tries to connect to Riemann via UDP and TCP.
connect/2Tries to connect to Riemann via UDP and TCP using the specified Host and Port.
connect/3Tries to connect to Riemann via UDP and TCP using the specified Host and Port and Transport.
connect_tcp/0Tries to connect to Riemann via TCP only.
connect_tcp/2Tries to connect to Riemann via TCP using the specified Host and Port.
connect_udp/0Tries to connect to Riemann via UDP only.
connect_udp/2Tries to connect to Riemann via UDP using the specified Host and Port.
disconnect/1Disconnects all connected sockets from Riemann.
send_message/3Sends a message to Riemann via UDP or TCP.

Function Details

connect/0

connect() -> {ok, state()} | {error, term()}

Tries to connect to Riemann via UDP and TCP. Delegates to connect/2.
Host and Port are read from the application configuration.

Defaults
Host: 127.0.0.1
Port: 5555

connect/2

connect(Host::string(), Port::pos_integer()) -> {ok, state()} | {error, term()}

Tries to connect to Riemann via UDP and TCP using the specified Host and Port.
A default message transport can be set using the application configuration. Delegates to connect/3.

Defaults
Transport: detect

connect/3

connect(Host::string(), Port::pos_integer(), Transport::transport()) -> {ok, state()} | {error, term()}

Tries to connect to Riemann via UDP and TCP using the specified Host and Port and Transport.
The Transport option only affects entities (events and/or states) that are sent to Riemann, since querying always uses TCP.

connect_tcp/0

connect_tcp() -> {ok, state()} | {error, term()}

Tries to connect to Riemann via TCP only. Delegates to connect_tcp/2.
Host and Port are read from the application configuration.

Defaults
Host: 127.0.0.1
Port: 5555

connect_tcp/2

connect_tcp(Host::string(), Port::pos_integer()) -> {ok, state()} | {error, term()}

Tries to connect to Riemann via TCP using the specified Host and Port.

connect_udp/0

connect_udp() -> {ok, state()} | {error, term()}

Tries to connect to Riemann via UDP only. Delegates to connect_udp/2.
Host and Port are read from the application configuration.

Defaults
Host: 127.0.0.1
Port: 5555

connect_udp/2

connect_udp(Host::string(), Port::pos_integer()) -> {ok, state()} | {error, term()}

Tries to connect to Riemann via UDP using the specified Host and Port.

disconnect/1

disconnect(Connection_state::state()) -> ok

Disconnects all connected sockets from Riemann.
This method detects which sockets actually exist and only disconnects the ones that do.

send_message/3

send_message(Transport::transport(), Msg::binary(), Connection_state::state()) -> {{ok, riemannpb_message()}, state()} | {{error, term()}, state()}

Sends a message to Riemann via UDP or TCP.

Transport can be one of the following values:
config: Uses the transport configuration option
detect: Uses the UDP transport for messages up to 16Kb in size and TCP for everything larger than that
udp: Send the message via UDP
tcp: Sends the message via TCP


Generated by EDoc