{ "info": { "author": "OpenCensus Authors", "author_email": "census-developers@googlegroups.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "OpenCensus Azure Monitor Exporters\n============================================================================\n\n|pypi|\n\n.. |pypi| image:: https://badge.fury.io/py/opencensus-ext-azure.svg\n :target: https://pypi.org/project/opencensus-ext-azure/\n\nInstallation\n------------\n\n::\n\n pip install opencensus-ext-azure\n\nUsage\n-----\n\nLog\n~~~\n\nThe **Azure Monitor Log Handler** allows you to export Python logs to `Azure Monitor`_.\n\nThis example shows how to send a warning level log to Azure Monitor.\n\n* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here `_.\n* Place your instrumentation key in a `connection string` and directly into your code.\n* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.\n\n.. code:: python\n\n import logging\n\n from opencensus.ext.azure.log_exporter import AzureLogHandler\n\n logger = logging.getLogger(__name__)\n logger.addHandler(AzureLogHandler(connection_string='InstrumentationKey='))\n logger.warning('Hello, World!')\n\n* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.\n\nYou can enrich the logs with trace IDs and span IDs by using the `logging integration <../opencensus-ext-logging>`_.\n\n* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here `_.\n* Place your instrumentation key in a `connection string` and directly into your code.\n* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.\n\n.. code:: python\n\n import logging\n\n from opencensus.ext.azure.log_exporter import AzureLogHandler\n from opencensus.ext.azure.trace_exporter import AzureExporter\n from opencensus.trace import config_integration\n from opencensus.trace.samplers import ProbabilitySampler\n from opencensus.trace.tracer import Tracer\n\n config_integration.trace_integrations(['logging'])\n\n logger = logging.getLogger(__name__)\n\n handler = AzureLogHandler(connection_string='InstrumentationKey=')\n handler.setFormatter(logging.Formatter('%(traceId)s %(spanId)s %(message)s'))\n logger.addHandler(handler)\n\n tracer = Tracer(\n exporter=AzureExporter(connection_string='InstrumentationKey='),\n sampler=ProbabilitySampler(1.0)\n )\n\n logger.warning('Before the span')\n with tracer.span(name='test'):\n logger.warning('In the span')\n logger.warning('After the span')s\n\nMetrics\n~~~~~~~\n\nThe **Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Monitor`_.\n\n* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here `_.\n* Place your instrumentation key in a `connection string` and directly into your code.\n* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.\n\n.. code:: python\n\n import time\n\n from opencensus.ext.azure import metrics_exporter\n from opencensus.stats import aggregation as aggregation_module\n from opencensus.stats import measure as measure_module\n from opencensus.stats import stats as stats_module\n from opencensus.stats import view as view_module\n from opencensus.tags import tag_map as tag_map_module\n\n stats = stats_module.stats\n view_manager = stats.view_manager\n stats_recorder = stats.stats_recorder\n\n CARROTS_MEASURE = measure_module.MeasureInt(\"carrots\",\n \"number of carrots\",\n \"carrots\")\n CARROTS_VIEW = view_module.View(\"carrots_view\",\n \"number of carrots\",\n [],\n CARROTS_MEASURE,\n aggregation_module.CountAggregation())\n\n def main():\n # Enable metrics\n # Set the interval in seconds in which you want to send metrics\n exporter = metrics_exporter.new_metrics_exporter(connection_string='InstrumentationKey=')\n view_manager.register_exporter(exporter)\n\n view_manager.register_view(CARROTS_VIEW)\n mmap = stats_recorder.new_measurement_map()\n tmap = tag_map_module.TagMap()\n\n mmap.measure_int_put(CARROTS_MEASURE, 1000)\n mmap.record(tmap)\n # Default export interval is every 15.0s\n # Your application should run for at least this amount\n # of time so the exporter will meet this interval\n # Sleep can fulfill this\n time.sleep(60)\n\n print(\"Done recording metrics\")\n\n if __name__ == \"__main__\":\n main()\n\nThe exporter also includes a set of standard metrics that are exported to Azure Monitor by default.\n\n.. code:: python\n\n import psutil\n import time\n\n from opencensus.ext.azure import metrics_exporter\n\n def main():\n # All you need is the next line. You can disable standard metrics by\n # passing in enable_standard_metrics=False into the constructor of\n # new_metrics_exporter() \n _exporter = metrics_exporter.new_metrics_exporter(connection_string='InstrumentationKey=')\n\n for i in range(100):\n print(psutil.virtual_memory())\n time.sleep(5)\n\n print(\"Done recording metrics\")\n\n if __name__ == \"__main__\":\n main()\n\nBelow is a list of standard metrics that are currently available:\n\n- Available Memory (bytes)\n- CPU Processor Time (percentage)\n- Incoming Request Rate (per second)\n- Incoming Request Average Execution Time (milliseconds)\n- Outgoing Request Rate (per second)\n- Process CPU Usage (percentage)\n- Process Private Bytes (bytes)\n\nTrace\n~~~~~\n\nThe **Azure Monitor Trace Exporter** allows you to export `OpenCensus`_ traces to `Azure Monitor`_.\n\nThis example shows how to send a span \"hello\" to Azure Monitor.\n\n* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here `_.\n* Place your instrumentation key in a `connection string` and directly into your code.\n* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.\n\n .. code:: python\n\n from opencensus.ext.azure.trace_exporter import AzureExporter\n from opencensus.trace.samplers import ProbabilitySampler\n from opencensus.trace.tracer import Tracer\n\n tracer = Tracer(\n exporter=AzureExporter(connection_string='InstrumentationKey='),\n sampler=ProbabilitySampler(1.0)\n )\n\n with tracer.span(name='hello'):\n print('Hello, World!')\n\nOpenCensus also supports several [integrations](https://github.com/census-instrumentation/opencensus-python#integration) which allows OpenCensus to integrate with third party libraries.\n\nThis example shows how to integrate with the [requests](https://2.python-requests.org/en/master/) library.\n\n* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here `_.\n* Install the `requests integration package <../opencensus-ext-requests>`_ using ``pip install opencensus-ext-requests``.\n* Place your instrumentation key in a `connection string` and directly into your code.\n* Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``.\n\n.. code:: python\n\n import requests\n\n from opencensus.ext.azure.trace_exporter import AzureExporter\n from opencensus.trace import config_integration\n from opencensus.trace.samplers import ProbabilitySampler\n from opencensus.trace.tracer import Tracer\n\n config_integration.trace_integrations(['requests'])\n tracer = Tracer(\n exporter=AzureExporter(\n # TODO: replace this with your own instrumentation key.\n instrumentation_key='00000000-0000-0000-0000-000000000000',\n ),\n sampler=ProbabilitySampler(1.0),\n )\n with tracer.span(name='parent'):\n response = requests.get(url='https://www.wikipedia.org/wiki/Rabbit')\n\n\nReferences\n----------\n\n* `Azure Monitor `_\n* `Examples `_\n* `OpenCensus Project `_\n\n.. _Azure Monitor: https://docs.microsoft.com/azure/azure-monitor/\n.. _OpenCensus: https://github.com/census-instrumentation/opencensus-python/\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-azure", "keywords": "", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "opencensus-ext-azure", "package_url": "https://pypi.org/project/opencensus-ext-azure/", "platform": "", "project_url": "https://pypi.org/project/opencensus-ext-azure/", "project_urls": { "Homepage": "https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-azure" }, "release_url": "https://pypi.org/project/opencensus-ext-azure/1.0.0/", "requires_dist": [ "opencensus (<1.0.0,>=0.7.0)", "psutil (>=5.6.3)", "requests (>=2.19.0)" ], "requires_python": "", "summary": "OpenCensus Azure Monitor Exporter", "version": "1.0.0" }, "last_serial": 5910029, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0cd8c5bf690444f2649203bdc6aff4b5", "sha256": "3cf3cb9fe96c9ec66046d19843eb725f8b926450385cd2be4ae29447ce3f9001" }, "downloads": -1, "filename": "opencensus_ext_azure-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0cd8c5bf690444f2649203bdc6aff4b5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8643, "upload_time": "2019-04-24T20:41:38", "url": "https://files.pythonhosted.org/packages/f9/59/fb2b674d4d55c8c52bd3f236364b1c7b56e21440a40fd4073e048e76da40/opencensus_ext_azure-0.1.0-py2.py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d9df546199de009387b58ab0f247315b", "sha256": "dcf11139ed6a10f16fb293657e302cfb5b3723a7e7d1375ed6bb3bf4f4257d3f" }, "downloads": -1, "filename": "opencensus_ext_azure-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d9df546199de009387b58ab0f247315b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16756, "upload_time": "2019-06-01T04:20:49", "url": "https://files.pythonhosted.org/packages/4f/83/7af54bcd3a6c0d42ed165854153f9d07890b23ce767a63a6b1bc0a2e72dc/opencensus_ext_azure-0.2.0-py2.py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "ab735392e828dddefa8a8ab479761d45", "sha256": "a01b7fe623e1cf972753b66f6445fae3cecd6f9d660eed774b5193dd56469f65" }, "downloads": -1, "filename": "opencensus_ext_azure-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ab735392e828dddefa8a8ab479761d45", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16785, "upload_time": "2019-06-13T22:17:00", "url": "https://files.pythonhosted.org/packages/b0/84/0fcfe4bfa0ee82fe8d19e13c0c6e0973b97f17ae1e6f93b3b00f78538035/opencensus_ext_azure-0.2.1-py2.py3-none-any.whl" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "eae2b71058fd77a4f955e758c0b98300", "sha256": "32b256c14e3691b600c355c8d8424bf22e7dc70883c80ccb3ed15180293f2fea" }, "downloads": -1, "filename": "opencensus_ext_azure-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eae2b71058fd77a4f955e758c0b98300", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20529, "upload_time": "2019-07-01T05:59:13", "url": "https://files.pythonhosted.org/packages/71/ce/a0f9cc91a5d2f93a769b9d158161450fadc2fe901eebc462a47af426c1bf/opencensus_ext_azure-0.3.1-py2.py3-none-any.whl" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "414235a3bddf3ed10704ae487074bf3c", "sha256": "a420a2e872276ed3edf1f38cd03a17f9cb61d4f7abcf9f41885cf97e432b5299" }, "downloads": -1, "filename": "opencensus_ext_azure-0.7.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "414235a3bddf3ed10704ae487074bf3c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 27267, "upload_time": "2019-08-01T23:31:54", "url": "https://files.pythonhosted.org/packages/d4/87/643a1a068f066fa6a4a389526028a5a454d7c40bbdc65ea517e01014b3fa/opencensus_ext_azure-0.7.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fcc92986ccca5faddb9eee0fdcb4e036", "sha256": "adceecb858598ee55a4603dcf82a5cf2bd0c4cec09644cce440113bbc4208035" }, "downloads": -1, "filename": "opencensus-ext-azure-0.7.0.tar.gz", "has_sig": false, "md5_digest": "fcc92986ccca5faddb9eee0fdcb4e036", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17539, "upload_time": "2019-08-01T23:31:56", "url": "https://files.pythonhosted.org/packages/9e/bc/54562434103784247f52c9975dbee47976cb0c33862e1c38f3982d660673/opencensus-ext-azure-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "0062cbb9aff83e97c096a61ba89c1561", "sha256": "2f372b18c689916e17187ce9321b29268a12a50ae14877f8c0b31f89b6a4d4ea" }, "downloads": -1, "filename": "opencensus_ext_azure-0.7.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0062cbb9aff83e97c096a61ba89c1561", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 28781, "upload_time": "2019-08-26T20:02:45", "url": "https://files.pythonhosted.org/packages/af/58/445f99086b4c601d491ece7cff6e07e50d4c1808a6256dd56b8e8a7d9e0e/opencensus_ext_azure-0.7.1-py2.py3-none-any.whl" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "d51e1ecb052459b60fc686f594c3e9aa", "sha256": "8df03f2e117db506a4e6a8c9e6cca18090af188deb3ff02d2eae4684ab948126" }, "downloads": -1, "filename": "opencensus_ext_azure-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d51e1ecb052459b60fc686f594c3e9aa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 30203, "upload_time": "2019-10-01T02:23:53", "url": "https://files.pythonhosted.org/packages/77/3f/18b5baab4bf06b5476ded416e3c6dc90a1dfab7ee51ce14c3b49de4af880/opencensus_ext_azure-1.0.0-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d51e1ecb052459b60fc686f594c3e9aa", "sha256": "8df03f2e117db506a4e6a8c9e6cca18090af188deb3ff02d2eae4684ab948126" }, "downloads": -1, "filename": "opencensus_ext_azure-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d51e1ecb052459b60fc686f594c3e9aa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 30203, "upload_time": "2019-10-01T02:23:53", "url": "https://files.pythonhosted.org/packages/77/3f/18b5baab4bf06b5476ded416e3c6dc90a1dfab7ee51ce14c3b49de4af880/opencensus_ext_azure-1.0.0-py2.py3-none-any.whl" } ] }