{"id":32219416,"url":"https://github.com/domm/measure-everything","last_synced_at":"2025-10-22T08:11:45.271Z","repository":{"id":35744757,"uuid":"40023812","full_name":"domm/Measure-Everything","owner":"domm","description":"Log::Any for Stats","archived":false,"fork":false,"pushed_at":"2021-01-08T21:06:46.000Z","size":33,"stargazers_count":0,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T08:11:23.866Z","etag":null,"topics":["hacktoberfest","measuring-stats","stats","writing-stats"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/domm.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-31T20:34:58.000Z","updated_at":"2021-01-08T21:06:45.000Z","dependencies_parsed_at":"2022-09-20T22:45:39.683Z","dependency_job_id":null,"html_url":"https://github.com/domm/Measure-Everything","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/domm/Measure-Everything","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FMeasure-Everything","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FMeasure-Everything/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FMeasure-Everything/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FMeasure-Everything/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domm","download_url":"https://codeload.github.com/domm/Measure-Everything/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FMeasure-Everything/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280402268,"owners_count":26324600,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["hacktoberfest","measuring-stats","stats","writing-stats"],"created_at":"2025-10-22T08:08:33.679Z","updated_at":"2025-10-22T08:11:45.257Z","avatar_url":"https://github.com/domm.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nMeasure::Everything - Log::Any for Stats\n\n# VERSION\n\nversion 1.003\n\n# SYNOPSIS\n\nIn a module where you want to count some stats:\n\n    package Foo;\n    use Measure::Everything qw($stats);\n\n    $stats-\u003ewrite('jigawats', 1.21, { source=\u003e'Plutonium', location=\u003e'Hill Valley' });\n\nIn your application:\n\n    use Foo;\n    use Measure::Everything::Adapter;\n    Measure::Everything::Adapter-\u003eset('InfluxDB::File', %args);\n\n# DESCRIPTION\n\n`Measure::Everything` tries to provide a standard measuring API for\nmodules (like [Log::Any](https://metacpan.org/pod/Log::Any) does for\nlogging). `Measure::Everything::Adapter`s allow applications to\nchoose the mechanism for measuring stats (for example\n[InfluxDB](https://influxdb.com), [OpenTSDB](http://opentsdb.net/),\nGraphite, etc).\n\nFor now, `Measure::Everything` only supports `InfluxDB`, because\nthat's what we're using. But I hope that other time series databases\n(or other storage backends) can be added to `Measure::Everything`.\nUnfortunately, measuring stats is not such a well-established domain\nlike logging (where we have a set of common log levels, and basically\n\"just\" need to pass some string to some logging sink). So it is very\nlikely that `Measure::Everything` cannot provide a generic API, where\nyou can switch out Adapters without changing the measuring code. But\nwe can try!\n\n`Measure::Everything` currently provides a way to access a global\nobject `$stats`, on which you can call the `write` method. The\ncurrently active `Adapter` decides what to do with the data passed to\n`write`. In contrast to `Log::Any`, there can be only one active\n`Adapter`.\n\n# PRODUCING STATS (FOR MODULES)\n\n## Getting a stats handler\n\n    use Measure::Everything qw($stats);\n\nThis will import a `$stats` object into your current namespace. What\nthis object will do depends on the active Adapter (see section\nCONSUMING STATS)\n\n## Counting\n\nFor now, `Measure::Everything` provides one method to write stats,\n`write`:\n\n    $stats-\u003ewrite($measurement, $value | \\%values, \\%tags?, $timestamp?);\n\nIt is still a bit uncertain whether this API will work for all\npossible time series databases and other storage backends. But it\nworks for `InfluxDB`!\n\n`$measurement` is the name of the thing you want to count.\n\n`$value` or `\\%values` is the value you want to count. Not all\ndatabases can handle multiple values. In this case it should be the\njob of the Adapter to convert the hashref of values into something the\nstorage backend can handle.\n\n`\\%tags` is a hashref of further tags. InfluxDB uses them, not sure\nabout other systems.\n\n`$timestamp` is the time of the measurement. In general you should\nnot pass a timestamp and instead let the Adapter figure out the\ncurrent time and format it in a way the backend can understand. But if\nyou want to record stats for past (or future?) events, you will need\nto pass in the timestamp in the correct format (or hope that the\nAdapter will convert it for you).\n\n# CONSUMING STATS (FOR APPLICATIONS)\n\n`Application` here means the script running your modules. Could be a\ndaemon, a cron-job, a command line script, whatever. In this script\nyou will have to define what to do with stats generated in your\nmodules. You could throw them away (by using\n`Measure::Everything::Adapter::Null`), which is the default. Or you\ndefine an adapter, that will handle the data passed via `write`.\n\n    use Measure::Everything::Adapter;\n    Measure::Everything::Adapter-\u003eset('InfluxDB::File', file =\u003e '/tmp/my_app.stats');\n\n# TODO\n\n- tests\n- docs\n- Measure::Everything::Adapter::Memory\n- Measure::Everything::Adapter::Test\n- more InfluxDB Adapters: Direct, ZeroMQ, UDP, ..\n- move Measure::Everything::Adapter::InfluxDB::\\* into seperate distribution(s)\n\n# SEE ALSO\n\nThe basic concept is stolen from\n\u003cLog::Any|https://metacpan.org/pod/Log::Any\u003e. If you have troubles\nunderstanding this set of modules, please read the excellent Log::Any\ndocs, and substitue \"logging\" with \"writing stats\".\n\nFor more information on measuring \u0026 stats, and the obvious inspiration\nfor this module's name, read the interesting article [Measure\n    Anything, Measure\n    Everything](https://codeascraft.com/2011/02/15/measure-anything-measure-everything/)\n    by Ian Malpass from [Etsy](http://etsy.com/).\n\n# THANKS\n\nThanks to\n\n- [validad.com](http://www.validad.com/) for funding the\ndevelopment of this code.\n\n# AUTHOR\n\nThomas Klausner \u003cdomm@plix.at\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2015 - 2021 by Thomas Klausner.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomm%2Fmeasure-everything","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomm%2Fmeasure-everything","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomm%2Fmeasure-everything/lists"}