Skip to main content

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


Download files

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

Source Distribution

bottle-elastic-apm-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

bottle_elastic_apm-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file bottle-elastic-apm-0.1.1.tar.gz.

File metadata

  • Download URL: bottle-elastic-apm-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

File hashes

Hashes for bottle-elastic-apm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 05de5edfdd4ed789ee67392ee256b7781cdbd4d93a15d2f4eb6ec8492d693c74
MD5 9294a8c5fbbaefce31d2485f1528d617
BLAKE2b-256 5ffcdf435ba830b1c135f57123e4ec8f3e13b03b5dd8569e50bf7bc8b653f1aa

See more details on using hashes here.

File details

Details for the file bottle_elastic_apm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bottle_elastic_apm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

File hashes

Hashes for bottle_elastic_apm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c52e04237bb3b682ec69be312802f4d8c5a3be56f59a74b8f69b97d9615b0339
MD5 ba2236473f70f57ce8f68e359979846d
BLAKE2b-256 7c7a6fb8256c42d6d3f85008345fcc9eb616a5568818305fac81e4605c2423d9

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