{ "info": { "author": "Wavefront by VMware", "author_email": "songhao@vmware.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Wavefront Flask SDK\n\nThis SDK provides support for reporting out of the box metric, histograms and tracing from your Flask based application. That data is reported to Wavefront via proxy or direct ingestion. That data will help you understand how your application is performing in production.\n\n## Install\n\n```bash\npip install wavefront_flask_sdk_python\n```\n\n## Usage\n\nConfigure your Flask application to install the SDK as follows:\n\n ```python\nfrom wavefront_sdk.common import ApplicationTags\nfrom wavefront_opentracing_sdk import WavefrontTracer\nfrom wavefront_opentracing_sdk.reporting import WavefrontSpanReporter\nfrom wavefront_pyformance.wavefront_reporter import WavefrontDirectReporter\nfrom wavefront_flask_sdk.flask_tracing import FlaskTracing\n\nfrom flask import Flask\n\nif __name__ == '__main__':\n app = Flask(__name__)\n\n source = '{SOURCE}'\n\n application_tags = ApplicationTags(\n application=\"{APP_NAME}\",\n service=\"{SERVICE_NAME}\",\n cluster=\"{CLUSTER_NAME}\", # Optional\n shard=\"{SHARD_NAME},\", # Optional\n custom_tags=[(\"{KEY}\", \"{VAL}\")] # Optional\n )\n\n wf_reporter = WavefrontDirectReporter(\n server=\"{SERV_ADDR}\",\n token=\"{TOKEN}\",\n source=source\n ).report_minute_distribution()\n\n span_reporter = WavefrontSpanReporter(wf_reporter.wavefront_client,\n source=source)\n\n tracer = WavefrontTracer(span_reporter, application_tags)\n\n tracing = FlaskTracing(tracer=tracer,\n reporter=wf_reporter,\n application_tags=application_tags,\n app=app)\n\n app.run(host='0.0.0.0', port=8080)\n\n ```\n\n## Out of the box metrics and histograms for your Flask based application.\n\n Assume you have the following API in your Flask Application:\n\n```python\n@app.route('/style//make')\ndef make_shirts(id):\n return \"Shirts {} made.\".format(id)\n```\n\n### Request Gauges\n\n| Entity Name | Entity Type | source | application | cluster | service | shard | flask.func |\n| :------------------------------------------------ | :---------- | :----- | :---------- | :-------- | :------ | :------ | :------------------- |\n| flask.request.style.path:id.make.GET.inflight.value | Gauge | host-1 | Ordering | us-west-1 | styling | primary | make_shirts |\n| flask.total_requests.inflight.value | Gauge | host-1 | Ordering | us-west-1 | styling | primary | n/a |\n\n### Granular Response related metrics\n\n| Entity Name | Entity Type | source | application | cluster | service | shard | flask.func |\n| :----------------------------------------------------------- | :----------- | :----------------- | :---------- | :-------- | :------ | :------ | :------------------- |\n| flask.response.style.path:id.make.GET.200.cumulative.count | Counter | host-1 | Ordering | us-west-1 | styling | primary | make_shirts |\n| flask.response.style.path:id.make.GET.200.aggregated_per_shard.count | DeltaCounter | wavefront-provided | Ordering | us-west-1 | styling | primary | make_shirts |\n| flask.response.style.path:id.make.GET.200.aggregated_per_service.count | DeltaCounter | wavefront-provided | Ordering | us-west-1 | styling | n/a | make_shirts |\n| flask.response.style.path:id.make.GET.200.aggregated_per_cluster.count | DeltaCounter | wavefront-provided | Ordering | us-west-1 | n/a | n/a | make_shirts |\n| flask.response.style.path:id.make.GET.200.aggregated_per_application.count | DeltaCounter | wavefront-provided | Ordering | n/a | n/a | n/a | make_shirts |\n\n### Granular Response related histograms\n\n| Entity Name | Entity Type | source | application | cluster | service | shard | flask.func |\n| :--------------------------------------------------------- | :----------------- | :----- | :---------- | :-------- | :------ | :------ | :------------------- |\n| flask.response.style.path:id.make.summary.GET.200.latency.m | WavefrontHistogram | host-1 | Ordering | us-west-1 | styling | primary | make_shirts |\n| flask.response.style.path:id.make.summary.GET.200.cpu_ns.m | WavefrontHistogram | host-1 | Ordering | us-west-1 | styling | primary | make_shirts |\n\n### Overall Response related metrics\n\nThis includes all the completed requests that returned a response (i.e. success + errors).\n\n| Entity Name | Entity Type | source | application | cluster | service | shard |\n| :--------------------------------------------------------- | :----------- | :---------------- | :---------- | :-------- | :------ | :------ |\n| flask.response.completed.aggregated_per_source.count | Counter | host-1 | Ordering | us-west-1 | styling | primary |\n| flask.response.completed.aggregated_per_shard.count | DeltaCounter | wavefont-provided | Ordering | us-west-1 | styling | primary |\n| flask.response.completed.aggregated_per_service.count | DeltaCounter | wavefont-provided | Ordering | us-west-1 | styling | n/a |\n| flask.response.completed.aggregated_per_cluster.count | DeltaCounter | wavefont-provided | Ordering | us-west-1 | n/a | n/a |\n| flask.response.completed.aggregated_per_application.count | DeltaCounter | wavefont-provided | Ordering | n/a | n/a | n/a |\n\n### Overall Error Response related metrics\n\nThis includes all the completed requests that resulted in an error response (that is HTTP status code of 4xx or 5xx).\n\n| Entity Name | Entity Type | source | application | cluster | service | shard |\n| :------------------------------------------------------ | :----------- | :---------------- | :---------- | :-------- | :------ | :------ |\n| flask.response.errors.aggregated_per_source.count | Counter | host-1 | Ordering | us-west-1 | styling | primary |\n| flask.response.errors.aggregated_per_shard.count | DeltaCounter | wavefont-provided | Ordering | us-west-1 | styling | primary |\n| flask.response.errors.aggregated_per_service.count | DeltaCounter | wavefont-provided | Ordering | us-west-1 | styling | n/a |\n| flask.response.errors.aggregated_per_cluster.count | DeltaCounter | wavefont-provided | Ordering | us-west-1 | n/a | n/a |\n| flask.response.errors.aggregated_per_application.count | DeltaCounter | wavefont-provided | Ordering | n/a | n/a | n/a |\n\n### Tracing Spans\n\nEvery span will have the operation name as span name, start time in millisec along with duration in millisec. The following table includes all the rest attributes of generated tracing spans. \n\n| Span Tag Key | Span Tag Value |\n| ---------------------- | ------------------------------------ |\n| traceId | 4a3dc181-d4ac-44bc-848b-133bb3811c31 |\n| parent | q908ddfe-4723-40a6-b1d3-1e85b60d9016 |\n| followsFrom | b768ddfe-4723-40a6-b1d3-1e85b60d9016 |\n| spanId | c908ddfe-4723-40a6-b1d3-1e85b60d9016 |\n| component | flask |\n| span.kind | server |\n| application | Ordering |\n| service | styling |\n| cluster | us-west-1 |\n| shard | primary |\n| location | Oregon (*custom tag) |\n| env | Staging (*custom tag) |\n| http.method | GET |\n| http.url | http://{SERVER_ADDR}/style/{id}/make |\n| http.status_code | 502 |\n| error | true |\n| flask.func | make_shirts |", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wavefrontHQ/wavefront-flask-sdk-python", "keywords": "Wavefront,Wavefront SDK,Flask", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "wavefront-flask-sdk-python", "package_url": "https://pypi.org/project/wavefront-flask-sdk-python/", "platform": "", "project_url": "https://pypi.org/project/wavefront-flask-sdk-python/", "project_urls": { "Homepage": "https://github.com/wavefrontHQ/wavefront-flask-sdk-python" }, "release_url": "https://pypi.org/project/wavefront-flask-sdk-python/1.0/", "requires_dist": null, "requires_python": "", "summary": "Wavefront Flask SDK", "version": "1.0" }, "last_serial": 5924624, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "c4ad78a3c121dacaea18cfb011d62823", "sha256": "b7f575317144660e561117f6f0bd4791425bc5a617e9e0c2b2a070d825ca159b" }, "downloads": -1, "filename": "wavefront-flask-sdk-python-1.0.tar.gz", "has_sig": false, "md5_digest": "c4ad78a3c121dacaea18cfb011d62823", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9135, "upload_time": "2019-10-03T18:10:27", "url": "https://files.pythonhosted.org/packages/8a/f6/ca86c0cdac52c7cabe763c80fad5815af9ce0f550d4591752afa2ffdaa81/wavefront-flask-sdk-python-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c4ad78a3c121dacaea18cfb011d62823", "sha256": "b7f575317144660e561117f6f0bd4791425bc5a617e9e0c2b2a070d825ca159b" }, "downloads": -1, "filename": "wavefront-flask-sdk-python-1.0.tar.gz", "has_sig": false, "md5_digest": "c4ad78a3c121dacaea18cfb011d62823", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9135, "upload_time": "2019-10-03T18:10:27", "url": "https://files.pythonhosted.org/packages/8a/f6/ca86c0cdac52c7cabe763c80fad5815af9ce0f550d4591752afa2ffdaa81/wavefront-flask-sdk-python-1.0.tar.gz" } ] }