Skip to main content

Python package fo generating diagnostic endpoint for flask based python web applications.

Project description

Diagnostics Endpoint

Library to generate diagnostics endpoint for flask based python web applications.

Installation

Installation from PyPi

this package can be installed from PyPi using pip :

pip install -U diagnostics-endpoint

Installation from Github

Install this package directly from github:

pip install -U git+ssh://git@github.com/shardulsrivastava/python-diagnostics.git@master

Usage

  1. Add the dependency in requirements.txt.
diagnostics-endpoint==0.0.7
  1. Add the below line to your application entry point:
from diagnostics_endpoint import Diagnostics

application_endpoints = [
    {"name": "API - Test Service", "endpoint": "http://my-api"},
    {"name": "Upstream - UpStream API", "endpoint": "https://my-upstream-api"},
    {"name": "Downstream - DownStream API", "endpoint": "https://my-downstream-api"},
    {"name": "Database - MyDatabase", "endpoint": "tcp://my-database-host:my-database-port"}
]

app = Flask(__name__)
Diagnostics.render(app, application_endpoints)

This will generate two endpoints :

  1. /diagnostics as

alt text

  1. /heartbeat with response as Ok

Configuration

diagnostics-endpoints supports configuration via Diagnostics.render() method.

Set Application Endpoints

Diagnostics.render() method takes a list of dictionaries of application endpoints. Format of the dictionary is :

application_endpoints = [{"name": "API Name","endpoint": "API URL"}]

here endpoint can be a http, https or tcp endpoint. You can also give absolute URLs as well by giving the url directly as /user. Example:

application_endpoints = [
                            {"name": "My API Endpoint","endpoint": "/hello"},
                            {"name":"My HTTP Endpoint","endpoint":"http://example.com/healthcheck"},
                            {"name":"My HTTPS Endpoint","endpoint":"https://example.com/healthcheck"},
                            {"name":"My TCP Database Endpoint","endpoint":"tcp://my-database-host:3306"}    
                        ]

Set Application Root

you can specify application root path as:

Diagnostics.render(app, application_endpoints, "/myapplication")

This will generate the two endpoints as /myapplication/diagnostics and /myapplication/heartbeat.

Python Diagnostics History

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

diagnostics-endpoint-0.0.8.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

diagnostics_endpoint-0.0.8-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file diagnostics-endpoint-0.0.8.tar.gz.

File metadata

  • Download URL: diagnostics-endpoint-0.0.8.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.7

File hashes

Hashes for diagnostics-endpoint-0.0.8.tar.gz
Algorithm Hash digest
SHA256 1509f7019affc2241724ee304c7f0e37928b3b29bbde8431cdb3c9ebfe4ddf9f
MD5 9215e629fb24dbc7c61f0d472891f8f3
BLAKE2b-256 d055b4ef29f8d36f37a7a52e8f4a01e5d045ced78ee680989c5ddaf4eeca4b9f

See more details on using hashes here.

File details

Details for the file diagnostics_endpoint-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: diagnostics_endpoint-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.7

File hashes

Hashes for diagnostics_endpoint-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 33d9d1ffdf8bb4ba67ec9100e74f7d17038afda5b8c73f2f360edbfacbe634ff
MD5 e9c0e582e4ce17f1edb6bcd8ac78979d
BLAKE2b-256 0ee47399781e44fed56915b8de1bc5d02d12758346162ec4932af419ed4b85fe

See more details on using hashes here.

Supported by

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