Plugin to implement instrumentation of elastic apm on a bottle server.
Project description
Bottle Elastic APM
Simple plugin to use ELK with APM server for your bottle application
Using default_app
default_app()
uses AppStack, so you only need to install it once.
from bottle import default_app, run
from bottle_elastic_apm import ElasticAPM, make_apm_client
ELK_CONFIG = {
'service_name': 'my-app',
}
app = default_app()
app2 = default_app()
apm_client = make_apm_client(**ELK_CONFIG) # avoid multi client instances
app.install(ElasticAPM(client=apm_client))
@app.get('/')
def index():
return 'Hello world!'
@app2.get('/2')
def index2():
return 'Hello world!'
run(app)
Using Bottle()
Bottle()
don't uses AppStack, so you need to install on all of them.
from bottle import Bottle, run
from bottle_elastic_apm import ElasticAPM, make_apm_client
ELK_CONFIG = {
'service_name': 'my-app',
}
app = Bottle()
app2 = Bottle()
app.mount('v2', app2)
apm_client = make_apm_client(**ELK_CONFIG) # avoid multi client instances
app.install(ElasticAPM(client=apm_client))
app2.install(ElasticAPM(client=apm_client))
@app.get('/')
def index():
return 'Hello world!'
@app2.get('/2')
def index2():
return 'Hello world!'
run(app)
Avoid capture specific errors
from bottle import default_app
from bottle_elastic_apm import ElasticAPM, make_apm_client
ELK_CONFIG = {
'service_name': 'my-app',
}
app = default_app()
apm_client = make_apm_client(**ELK_CONFIG) # avoid multi client instances
app.install(ElasticAPM(client=apm_client, avoided_errors={(401, 'JWT: Signature has expired',)}))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for bottle_elastic_apm-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c52e04237bb3b682ec69be312802f4d8c5a3be56f59a74b8f69b97d9615b0339 |
|
MD5 | ba2236473f70f57ce8f68e359979846d |
|
BLAKE2b-256 | 7c7a6fb8256c42d6d3f85008345fcc9eb616a5568818305fac81e4605c2423d9 |