falcon-telegraf-middleware
What is this?
Package to ease gathering metrics from Falcon 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:
from falcon_telegraf import LogHits, Timer
telegraf_client = TelegrafClient('localhost', 8094)
app = falcon.API(
middleware=[
LogHits(telegraf_client),
Timer(),
]
)
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.
Executes after on-* method was called. Because of this you can add custom tags and values.
Example:
def on_get(self, request, response, some_path_variable):
request.context['telegraf_tags']['my_new_tag'] = 'this_tags_value'
request.context['telegraf_values']['some_path_variable'] = some_path_variable
...
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.
Testing
pip install -e .
pytest
Deploy
First bump version in setup.py in master branch via merge request. Afterwards push a version tag and wait.
git tag `date +"%Y.%-m.%-d.1"`
git push --tags
Metadata
Release files for falcon-telegraf-middleware 2021.6.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| falcon-telegraf-middleware-2021.6.1.1.tar.gz | 6.0 kB | Without provenance | Details for falcon-telegraf-middleware-2021.6.1.1.tar.gz |
Release files / falcon-telegraf-middleware-2021.6.1.1.tar.gz
| Download URL | falcon-telegraf-middleware-2021.6.1.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd1356ae10f27517000ee22285bf714b45a07284f2c32a52440ca916fc24304d
|
|
BLAKE2b-256 checksum How to use checksums |
3d9e87c2707a099fb3490784e8f132613e8377fb8dfa2a8a7777fd579b214183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.7
|
Security for falcon-telegraf-middleware 2021.6.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.