Metadata-Version: 2.1
Name: falcon-telegraf-middleware
Version: 2018.4.19.3
Summary: Falcon to Telegraf middlewares
Home-page: https://github.com/Webinterpret/falcon-telegraf-middleware
Author: Webinterpret
Author-email: funky_chicken@webinterpret.com
License: UNKNOWN
Description: # falcon-telegraf-middleware
        
        [![Build Status](https://travis-ci.org/Webinterpret/falcon-telegraf-middleware.svg?branch=master)](https://travis-ci.org/Webinterpret/falcon-telegraf-middleware)
        
        ![PyPI](https://img.shields.io/pypi/v/falcon-telegraf-middleware.svg?style=for-the-badge)
        
        [![forthebadge](https://forthebadge.com/images/badges/no-ragrets.svg)](https://forthebadge.com)
        
        ## What is this?
        
        Package to ease gathering metrics from [Falcon](http://falcon.readthedocs.io/) APIs into InfluxDB via a Telegraf.
        By use of middlewares this orthogonal functionality is added in a hassle-free way minimizing required work. Sane defaults make quickstart really quick 👍
        
        ## How?
        Inject the middleware (or couple of them) when creating `Api` instance:
        
        ```python
        telegraf_client = TelegrafClient('localhost', 8094)
        app = falcon.API(
            middleware=[
                LogHits(telegraf_client),
                TimeRequests(),
            ]
        )
        ```
        
        Note that passing `telegraf_client` is totally optional.
        Measurement names can be set when creating middleware, prefixed or autogenerated.
        
        ## Middlewares
        ### `LogHits`
        Creates a metric named hits-path/to/endpoint with one fields called `hits` with value 1.
        ### `LogHitsContextAware`
        Similar to `LogHits` but executes *after* `on-*` method was called and adds more context data. Because of this you can add custom tags.
        Example:
        ```python
        def on_get(self, request, response, some_path_variable):
            request.context['my_new_tag'] = 'this_tags_value'
            request.context['some_path_variable'] = some_path_variable  ## this is unnecessary - it's logged by middleware
            ...
        ```
        It's metric name is the same as for `LogHits`.
        Note that using this two middlewares in the sam API doesn't make any sense.
        ### `Timer`
        Reports time in ms elapsed between registering response and registering request. Default metric prefix is `time-`.
        Other things in processing pipeline can affect it's readings so take them with a grain of salt.
        ## Deploy
        First bump version in `setup.py` in master branch via merge request. Afterwards push a version tag and wait.
        
        ```bash
        git tag `date +"%Y.%-m.%-d.1"`
        git push --tags
        ```
        
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
