{"id":26363035,"url":"https://github.com/eventbrite/pymetrics","last_synced_at":"2025-03-16T18:20:13.196Z","repository":{"id":46951440,"uuid":"208830056","full_name":"eventbrite/pymetrics","owner":"eventbrite","description":"Versatile Metrics Collection for Python","archived":false,"fork":false,"pushed_at":"2023-11-28T16:59:02.000Z","size":101,"stargazers_count":18,"open_issues_count":0,"forks_count":6,"subscribers_count":69,"default_branch":"master","last_synced_at":"2025-03-01T15:47:04.738Z","etag":null,"topics":["counters","datadog","framework","metrics","python","statsd","timers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eventbrite.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-16T15:09:44.000Z","updated_at":"2024-08-16T04:37:36.000Z","dependencies_parsed_at":"2024-06-21T04:11:33.466Z","dependency_job_id":null,"html_url":"https://github.com/eventbrite/pymetrics","commit_stats":{"total_commits":47,"total_committers":7,"mean_commits":6.714285714285714,"dds":0.4893617021276596,"last_synced_commit":"6c73de442953ca5c821e36ec964a1e111691835f"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventbrite%2Fpymetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventbrite%2Fpymetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventbrite%2Fpymetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventbrite%2Fpymetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eventbrite","download_url":"https://codeload.github.com/eventbrite/pymetrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910750,"owners_count":20367545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["counters","datadog","framework","metrics","python","statsd","timers"],"created_at":"2025-03-16T18:20:12.384Z","updated_at":"2025-03-16T18:20:13.160Z","avatar_url":"https://github.com/eventbrite.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"PyMetrics - Versatile Metrics Collection for Python\n===================================================\n\n.. image:: https://readthedocs.org/projects/pymetrics/badge/\n    :target: https://pymetrics.readthedocs.io\n\n.. image:: https://pepy.tech/badge/pymetrics\n    :target: https://pepy.tech/project/pymetrics\n\n.. image:: https://img.shields.io/pypi/l/pymetrics.svg\n    :target: https://pypi.python.org/pypi/pymetrics\n\n.. image:: https://api.travis-ci.org/eventbrite/pymetrics.svg\n    :target: https://travis-ci.org/eventbrite/pymetrics\n\n.. image:: https://img.shields.io/pypi/v/pymetrics.svg\n    :target: https://pypi.python.org/pypi/pymetrics\n\n.. image:: https://img.shields.io/pypi/wheel/pymetrics.svg\n    :target: https://pypi.python.org/pypi/pymetrics\n\n.. image:: https://img.shields.io/pypi/pyversions/pymetrics.svg\n    :target: https://pypi.python.org/pypi/pymetrics\n\n\n**PyMetrics** is versatile metrics collection library for Python that encapsulates the collection of counters, gauges,\nhistograms, and timers into a generic interface with pluggable publishers so that you can helpfully instrument your\napplications without suffering vendor lock.\n\n------------\n\nPublishing metrics is a straightforward process involving two steps. First, configure your metrics and publisher(s):\n\n.. code-block:: python\n\n    METRICS_CONFIG = {\n        'version': 2,\n        'error_logger_name': 'pymetrics',\n        'publishers': [\n            {\n                'path': 'pymetrics.publishers.datadog.DogStatsdPublisher',\n                'kwargs': {\n                    'host': 'localhost',\n                    'port': 8135,\n                },\n            },\n        ],\n    }\n\nThen, use a ``pymetrics.recorders.base.MetricsRecorder`` in your application to collect and publish:\n\n.. code-block:: python\n\n    from pymetrics.recorders.default import DefaultMetricsRecorder\n\n    metrics = DefaultMetricsRecorder(config=settings.METRICS_CONFIG)\n\n    metrics.counter('counter.name').increment()\n\n    metrics.gauge('gauge.name', tag_name1='tag_value1', tag_name2='tag_value2').set(12)\n\n    metrics.histogram('histogram.name').set(1730)\n\n    with metrics.timer('timer.name'):\n        do_something()\n\n    cumulative_timer = metrics.timer('cumulative_timer.name')\n    for item in items:\n        do_something_without_timing()\n        with cumulative_timer:\n            do_something_with_timing()\n\n    metrics.publish_all()\n\nProvided publisher plugins include Statsd, Datadog, Python Logging, SQLite, and a null publisher. Writing your own is\nsimple and we encourage you to share your work with the community by submitting a pull request.\n\n\nLicense\n-------\n\nPyMetrics is licensed under the `Apache License, version 2.0 \u003cLICENSE\u003e`_.\n\n\nInstallation\n------------\n\nPyMetrics is available in PyPi and can be installing directly via Pip or listed in ``setup.py``, ``requirements.txt``,\nor ``Pipfile``:\n\n.. code-block:: bash\n\n    pip install 'pymetrics~=1.0'\n\n.. code-block:: python\n\n    install_requires=[\n        ...\n        'pymetrics~=1.0',\n        ...\n    ]\n\n.. code-block:: text\n\n    pymetrics~=1.0\n\n.. code-block:: text\n\n    pymetrics = {version=\"~=1.0\"}\n\n\nDocumentation\n-------------\n\nThe complete PyMetrics documentation is available on `Read the Docs \u003chttps://pymetrics.readthedocs.io\u003e`_!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feventbrite%2Fpymetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feventbrite%2Fpymetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feventbrite%2Fpymetrics/lists"}