{"id":38519029,"url":"https://github.com/farzadghanei/statsd-metrics","last_synced_at":"2026-01-17T06:36:40.748Z","repository":{"id":57471265,"uuid":"42386063","full_name":"farzadghanei/statsd-metrics","owner":"farzadghanei","description":"Data metrics for Statsd","archived":false,"fork":false,"pushed_at":"2020-11-25T18:45:13.000Z","size":172,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-28T00:31:52.947Z","etag":null,"topics":["python","python3","statsd","statsd-client"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farzadghanei.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-13T06:22:55.000Z","updated_at":"2020-11-25T18:45:16.000Z","dependencies_parsed_at":"2022-09-10T11:40:32.295Z","dependency_job_id":null,"html_url":"https://github.com/farzadghanei/statsd-metrics","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/farzadghanei/statsd-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzadghanei%2Fstatsd-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzadghanei%2Fstatsd-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzadghanei%2Fstatsd-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzadghanei%2Fstatsd-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farzadghanei","download_url":"https://codeload.github.com/farzadghanei/statsd-metrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzadghanei%2Fstatsd-metrics/sbom","scorecard":{"id":393145,"data":{"date":"2025-08-11","repo":{"name":"github.com/farzadghanei/statsd-metrics","commit":"4b3ceb481cf7d39405b03d19496a50cf5cd22aa5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2013-22 / GHSA-27x4-j476-jp5f","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2022-43012 / GHSA-r9hx-vwmv-q579"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T18:19:41.834Z","repository_id":57471265,"created_at":"2025-08-18T18:19:41.834Z","updated_at":"2025-08-18T18:19:41.834Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28502618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["python","python3","statsd","statsd-client"],"created_at":"2026-01-17T06:36:40.651Z","updated_at":"2026-01-17T06:36:40.732Z","avatar_url":"https://github.com/farzadghanei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"**************\nStatsd Metrics\n**************\n\n.. image:: https://travis-ci.org/farzadghanei/statsd-metrics.svg?branch=master\n    :target: https://travis-ci.org/farzadghanei/statsd-metrics\n\n.. image:: https://ci.appveyor.com/api/projects/status/bekwcg8n1xe0w0n9/branch/master?svg=true\n    :target: https://ci.appveyor.com/project/farzadghanei/statsd-metrics?branch=master\n\nMetric classes for Statsd, and Statsd clients (each metric in a single request, or send batch requests).\n\nMetric classes represent the data used in Statsd protocol excluding the IO, to create,\nrepresent and parse Statsd requests. So any Statsd server and client regardless of the\nIO implementation can use them to send/receive Statsd requests.\n\nThe library also comes with a rich set of Statsd clients using the same metric classes, and\nPython standard library socket module.\n\n\nMetric Classes\n--------------\n\n* Counter\n* Timer\n* Gauge\n* Set\n* GaugeDelta\n\n.. code-block:: python\n\n    from statsdmetrics import Counter, Timer\n\n    counter = Counter('event.login', 1, 0.2)\n    counter.to_request() # returns event.login:1|c|@0.2\n\n    timer = Timer('db.search.username', 27.4)\n    timer.to_request() # returns db.search.username:27.4|ms\n\nParse metrics from a Statsd request\n\n.. code-block:: python\n\n    from statsdmetrics import parse_metric_from_request\n\n    event_login = parse_metric_from_request('event.login:1|c|@.2')\n    # event_login is a Counter object with count = 1 and sample_rate = 0.2\n\n    mem_usage = parse_metric_from_request('resource.memory:2048|g')\n    # mem_usage is a Gauge object with value = 2028\n\nStatsd Clients\n--------------\n* ``client.Client``: Default client, sends request on each call using UDP\n* ``client.BatchClient``: Buffers metrics and flushes them in batch requests using UDP\n* ``client.tcp.TCPClient``: Sends request on each call using TCP\n* ``client.tcp.TCPBatchClient``: Buffers metrics and flushes them in batch requests using TCP\n\nSend Statsd requests\n\n.. code-block:: python\n\n    from statsdmetrics.client import Client\n\n    # default client, send metrics over UDP\n    client = Client(\"stats.example.org\")\n    client.increment(\"login\")\n    client.decrement(\"connections\", 2)\n    client.timing(\"db.search.username\", 3500)\n    client.gauge(\"memory\", 20480)\n    client.gauge_delta(\"memory\", -256)\n    client.set(\"unique.ip_address\", \"10.10.10.1\")\n\n    # helpers for timing operations\n    chronometer = client.chronometer()\n    chronometer.time_callable(\"func1_duration\", func1)\n\n    # decorate functions to send timing metrics for the duration of their running time\n    @chronometer.wrap(\"func2_duration\")\n    def func2():\n        pass\n\n    # send timing for duration of a with block\n    with client.stopwatch(\"with_block_duration\"):\n        pass\n\n\n\nSending multiple metrics in batch requests by ``BatchClient``, either\nby using an available client as the context manager:\n\n\n.. code-block:: python\n\n    from statsdmetrics.client import Client\n\n    client = Client(\"stats.example.org\")\n    with client.batch_client() as batch_client:\n        batch_client.increment(\"login\")\n        batch_client.decrement(\"connections\", 2)\n        batch_client.timing(\"db.search.username\", 3500)\n    # now all metrics are flushed automatically in batch requests\n\n\nor by creating a ``BatchClient`` object explicitly:\n\n\n.. code-block:: python\n\n    from statsdmetrics.client import BatchClient\n\n    client = BatchClient(\"stats.example.org\")\n    client.set(\"unique.ip_address\", \"10.10.10.1\")\n    client.gauge(\"memory\", 20480)\n    client.flush() # sends one UDP packet to remote server, carrying both metrics\n\n    # timing helpers are available on all clients\n    chronometer = client.chronometer()\n    chronometer.time_callable(\"func1_duration\", func1)\n\n    @chronometer.wrap(\"func2_duration\")\n    def func2():\n        pass\n\n    with client.stopwatch(\"with_block_duration\"):\n        pass\n\n    client.flush()\n\n\nInstallation\n------------\n\n.. code-block:: bash\n\n    $ pip install statsdmetrics\n\n\nThe only dependencies are Python 2.7+ and setuptools.\nCPython 2.7, 3.4+, 3.7-dev, PyPy, and Jython 2.7 are tested)\n\nHowever on development (and test) environment\n`pytest \u003chttps://pypi.org/project/pytest/\u003e`_, `mock \u003chttps://pypi.org/project/mock\u003e`_ is required (for Python 2),\n`typing \u003chttps://pypi.org/project/typing\u003e`_ is recommended.\n\n.. code-block:: bash\n\n    # on dev/test env\n    $ pip install -r requirements-dev.txt\n\n\nDevelopment\n-----------\n\n* Code is on `GitHub \u003chttps://github.com/farzadghanei/statsd-metrics\u003e`_\n* Documentations are on `Read The Docs \u003chttps://statsd-metrics.readthedocs.org\u003e`_\n\nTests\n^^^^^\n\n`Tox \u003chttps://pypi.org/project/tox/\u003e`_ is most convenient to run tests with since it handles creation of virtualenvs\n\n.. code-block:: bash\n\n    $ tox\n\nWhen development dependencies are installed (preferably with a virtual environment),\ntests can be run by calling `pytest`.\n\n.. code-block:: bash\n\n    $ pytest\n\nIntegration tests are available as part of the test suite, bringing up dummy servers (but actually listening on\nnetwork socket) to capture requests instead of processing them. Then send some metrics and\nassert if the captured requests match the expected.\n\nLicense\n-------\n\nStatsd metrics is released under the terms of the\n`MIT license \u003chttp://opensource.org/licenses/MIT\u003e`_.\n\nThe MIT License (MIT)\n\nCopyright (c) 2015-2018 Farzad Ghanei\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarzadghanei%2Fstatsd-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarzadghanei%2Fstatsd-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarzadghanei%2Fstatsd-metrics/lists"}