{ "info": { "author": "Esben Sonne", "author_email": "esbensonne+code@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "Charcoal\n========\n\n.. image:: https://travis-ci.org/cknv/charcoal.svg?branch=master\n :target: https://travis-ci.org/cknv/charcoal\n\nA simple library for sending `StatsD metrics `_ in python. It aims to provide a high level API for the user, however that also means that much of the lower level functionality found in most other StatsD clients are not exposed, frankly because I do not find that I need it. So no manually timing things and etc.\n\nInstalling\n----------\n\n.. code-block:: shell\n\n $ pip install charcoal\n\n\nUse it like so:\n\n.. code-block:: python\n\n import charcoal\n\n my_client = charcoal.StatsClient(prefix, host, port)\n\nFor development, the client also provides a ``disabled`` kwarg, so you do not have change anything in the code when you want to not send stats:\n\n.. code-block:: python\n\n my_client = charcoal.StatsClient(prefix, host, port, disabled=True)\n\nBy itself, the client does not provide much use, but it does provide easy ways to get specific sub-clients, such as timers, counters, etc.\n\nTiming\n------\n\n.. code-block:: python\n\n timer = my_client.timer('my-timer-name').start()\n\n this_takes_a_while()\n timer.intermediate('first-pass')\n\n this_takes_a_while()\n timer.intermediate('second-pass')\n timer.stop()\n\nWhen you have end up with a measurement from somewhere else, perhaps from an external service, you can also send that, using the ``.send`` function on the timer class, in fact this is what the higler level functions above use, behind the scenes.\n\n.. code-block:: python\n\n timer = my_client.timer('my-timer-name')\n timer.send('db-call', 12.5)\n\nCounting\n--------\n\n.. code-block:: python\n\n counter = my_client.counter('my-counter-name')\n\n counter.increment('some-value', 10)\n counter.decrement('some-other-value', 10)\n\nThe counter can even be fed a dict like object, such as the Counter from the standard library and send the stats as a single message.\n\n.. code-block:: python\n\n pre_counted = {\n 'a-name': 5,\n 'another-name': 10,\n }\n\n counter.from_mapping(pre_counted)\n\nGauges\n------\n\nFor setting the current value.\n\n.. code-block:: python\n\n gauge = my_client.gauge('my-gauge')\n\n gauge.set('a-name', 10)\n gauge.update('a-name', 10)\n\nSets\n----\n\nFor counting unique events, such as unique users on a page.\n\n.. code-block:: python\n\n visitors = my_client.set('visitors')\n visitors.add('ids', user.id)\n\nCustom\n------\n\nIn case the server you are using supports more metric types than this library, you can send custom metrics:\n\n.. code-block:: python\n\n metric_to_send = 'metric.name:{value}|{type_suffix}'.format(\n value=str(value),\n type_suffix=type_suffix,\n )\n\n my_client.send(metric_to_send)\n\nThe ``prefix`` given to the client when creating it, is then prepended to the metric name, encoded, and sent to the server.\n\nCurrently it can even accept multiple metrics in one go:\n\n.. code-block:: python\n\n my_client.send(metric_to_send, other_metric_to_send)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cknv/charcoal", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "charcoal", "package_url": "https://pypi.org/project/charcoal/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/charcoal/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cknv/charcoal" }, "release_url": "https://pypi.org/project/charcoal/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Opionionated high level StatsD client", "version": "0.2.0" }, "last_serial": 2142062, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ee4ec73b72ac181c747ee34244df1656", "sha256": "a3ab7cea6caf03fe8681809c9e37602d8430e25034615feecc14e7d0fb09d8f7" }, "downloads": -1, "filename": "charcoal-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ee4ec73b72ac181c747ee34244df1656", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 6347, "upload_time": "2016-04-06T08:41:29", "url": "https://files.pythonhosted.org/packages/3f/6a/88809a3b9f07d287fb37c174a2b4222a23a699252a23aedead892e82d124/charcoal-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf9f2ff2e4bf962ba64317cb87173fac", "sha256": "1ac7c486d6edb6767efbc5402238f0becf7a067eeed076bf7461f8f028dd2dc9" }, "downloads": -1, "filename": "charcoal-0.1.0.tar.gz", "has_sig": false, "md5_digest": "bf9f2ff2e4bf962ba64317cb87173fac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4594, "upload_time": "2016-04-06T08:41:00", "url": "https://files.pythonhosted.org/packages/24/a9/3b81bc8ce7ded4ab310690e40ecac1ca82e84fd75b0b87eabfc2e80bd0b6/charcoal-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1ec8872a8015166321d9cbe6745f5dd1", "sha256": "b12ac748c4acc3a6532b44509893269c4d720061877c4909a33ed1863fd1f970" }, "downloads": -1, "filename": "charcoal-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1ec8872a8015166321d9cbe6745f5dd1", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 6712, "upload_time": "2016-05-31T07:29:33", "url": "https://files.pythonhosted.org/packages/7d/85/d27175832aa4d510bc0e08d611683757ec4c45edfca4f3157c8b761fcd24/charcoal-0.2.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1ec8872a8015166321d9cbe6745f5dd1", "sha256": "b12ac748c4acc3a6532b44509893269c4d720061877c4909a33ed1863fd1f970" }, "downloads": -1, "filename": "charcoal-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1ec8872a8015166321d9cbe6745f5dd1", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 6712, "upload_time": "2016-05-31T07:29:33", "url": "https://files.pythonhosted.org/packages/7d/85/d27175832aa4d510bc0e08d611683757ec4c45edfca4f3157c8b761fcd24/charcoal-0.2.0-py3-none-any.whl" } ] }