Welcome to 🥕 Karrot’s documentation!¶

Application diagram¶

_images/karrot-diagram.png

Burrow¶

synopsis:Burrow Blueprint

Main application endpoint called by Burrow

karrot.burrow.controllers.event_handler(event)[source]¶

For each enabled reporter, call the process(event) function.

If prometheus is enabled, it tracks the reporter update.

Parameters:event (str) – A valid Burrow Json event
karrot.burrow.controllers.webhook_handler()[source]¶

Process an incoming event from Burrow and call event_handler() to process it.

Parameters:event (str) – A valid Burrow Json event POSTed to this endpoint

Heartbeat¶

synopsis:Heartbeat Blueprint

Heartbeat endpoint of the application

karrot.heartbeat.controllers.health()[source]¶

Returns a simple JSON string when the application is healthy.

Returns:json – A JSON with the following format:
``{“status”: “success”,
“msg”: “Burrow-reporter is healthy”, “time”: “<datetime.now()>”}``

Config¶

synopsis:Configuration Blueprint

Configuration endpoint for the application

karrot.config.controllers.display()[source]¶

Returns a simple JSON string with the current application configuration.

Returns:json – A JSON with the following format:

{"status": "success", "settings": "{...}"}

Reporters¶

Reporters called once a webhook has been received from Burrow

Cloudwatch¶

class karrot.reporters.cloudwatch.models.CloudwatchReporter(name)[source]¶

Bases: karrot.reporters.models.Reporter

process(event)[source]¶

Refresh the object with the event details. A child class should call this parent function and then implement the proper processing steps for the event.

Parameters:event (str) – A
stats(reporter)[source]¶

Report stats of an other reporter. Useful for Prometheus to collect stats about other reporters.

This method must be implemented in child classes.

Prometheus¶

karrot.reporters.prometheus.controllers.metrics()[source]¶
class karrot.reporters.prometheus.models.PrometheusReporter(name)[source]¶

Bases: karrot.reporters.models.Reporter

process(event)[source]¶

Refresh the object with the event details. A child class should call this parent function and then implement the proper processing steps for the event.

Parameters:event (str) – A
stats(reporter)[source]¶

Increment the number of events processed by the reporter.

synopsis:Reporter Blueprint

Reporter endpoint of the application

karrot.reporters.controllers.display(reporter)[source]¶

Returns a simple JSON with the current application reporters.

Parameters:reporter (str) – If provided returns details about this reporter only
Returns:json – A JSON with the following format:

{"reporters": ["reporter1", "reporter2"]}

class karrot.reporters.models.Reporter(name)[source]¶

Bases: object

process(event)[source]¶

Refresh the object with the event details. A child class should call this parent function and then implement the proper processing steps for the event.

Parameters:event (str) – A
stats(reporter)[source]¶

Report stats of an other reporter. Useful for Prometheus to collect stats about other reporters.

This method must be implemented in child classes.

class karrot.reporters.factory.ReporterFactory[source]¶

Bases: object

ReporterFactory used to create a Reporter object based on it’s name.

static get(reporter)[source]¶

Return the proper notifier object based on the name.

Params str reporter:
 The type of reporter to create
Returns:Reporter – A reporter matching reporter
Raises:ValueError – When the requested reporter is not found.

Indices and tables¶