Skip to main content

Monitor Falcon with Riemann

Project description

Owl

https://api.travis-ci.org/merry-bits/Owl.svg?branch=master

Measure how long your Falcon requests take and send each measurement as an event to Riemann.

Example

Owl is designed to be a mix-in class for API. To use Owl you create your own API class providing configuration parameters for Owl.

In Python 3 this could look something like this:

from falcon.api import API
from riemann_client.client import QueuedClient
from owl import Owl

class MonitoredAPI(Owl, API):

    def __init__(self, *args, **kwds):
        kwds["get_riemann_client"] = lambda: QueuedClient()
        kwds["owl_service"] = "MyAPI"  # service name for Riemann
        super().__init__(*args, **kwds)

api = MonitoredAPI()
# api.add_route(...)
# ...

In Riemann you get the end point and the request result status code as tags. To convert them into their own InfluxDB tags ( endpoint` and ``status-code) for later use (for example in Grafana) you could do something like this in your Riemann InfluxDB configuration:

(defn- parse-api-event
 [event]
 (if (contains? event :tags)
   (let [[endpoint status-code & other] (:tags event)]
     (assoc event
       :endpoint endpoint
       :status-code status-code))
   event))

(let [index (index)]
 (streams index
   ; Write API monitoring to database
   (where (service "MyAPI")
     #(info (parse-api-event %))
     (comp api-db parse-api-event))))

Check out the event_builder parameter if you want to customize the event parameters (change what service means or add a description for example).

Installation

$ pip install owl

Changelog

0.2.0

  • generate a message with status 500 when a request throws an exception

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Owl-0.2.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

Owl-0.2.1-py2.py3-none-any.whl (8.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Owl-0.2.1.tar.gz.

File metadata

  • Download URL: Owl-0.2.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Owl-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5153396456dbb39562c095552448f5e49f5aaaa5cb3ddafb9bf6bd3ed30b00ad
MD5 838ca07b336ae5843e7534da0a1446cb
BLAKE2b-256 3f04dc007de1e3129e54d1a79fadf198eb07848c1d902321c0b6ca40461518bb

See more details on using hashes here.

File details

Details for the file Owl-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Owl-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ad6b2d6a0375c12c4f0b9ebd943c2c4bf3a14dfcfa53de28b179f2bf8b8d9ef1
MD5 03235e3695cc8a3b585084e03db7b584
BLAKE2b-256 acbbc9a09395add793fe4841ef40b1ee5cd64421bbed1657f7d046f496351ddb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page