{"id":21485902,"url":"https://github.com/usmanm/redis-tdigest","last_synced_at":"2026-03-07T03:03:10.336Z","repository":{"id":55029775,"uuid":"58898198","full_name":"usmanm/redis-tdigest","owner":"usmanm","description":"t-digest module for Redis","archived":false,"fork":false,"pushed_at":"2021-01-14T10:14:42.000Z","size":30,"stargazers_count":73,"open_issues_count":2,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-09T05:51:14.300Z","etag":null,"topics":["percentile","quantile","redis","redis-module","redis-tdigest","streaming-algorithms","tdigest"],"latest_commit_sha":null,"homepage":"http://redismodules.com/modules/redis-tdigest/","language":"C","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/usmanm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-16T02:39:07.000Z","updated_at":"2024-10-20T16:53:13.000Z","dependencies_parsed_at":"2022-08-14T09:31:23.967Z","dependency_job_id":null,"html_url":"https://github.com/usmanm/redis-tdigest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/usmanm/redis-tdigest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanm%2Fredis-tdigest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanm%2Fredis-tdigest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanm%2Fredis-tdigest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanm%2Fredis-tdigest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usmanm","download_url":"https://codeload.github.com/usmanm/redis-tdigest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanm%2Fredis-tdigest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30206339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"online","status_checked_at":"2026-03-07T02:00:06.765Z","response_time":53,"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":["percentile","quantile","redis","redis-module","redis-tdigest","streaming-algorithms","tdigest"],"created_at":"2024-11-23T13:18:03.745Z","updated_at":"2026-03-07T03:03:10.318Z","avatar_url":"https://github.com/usmanm.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redis-tdigest\n\n[![Build Status](https://img.shields.io/circleci/project/usmanm/redis-tdigest.svg?style=flat-square)](https://circleci.com/gh/usmanm/redis-tdigest)\n\nThis is a Redis module for the [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) data structure which can be used for accurate online accumulation of rank-based statistics such as quantiles and cumulative distribution at a point. The implementation is based on the [Merging Digest](https://github.com/tdunning/t-digest/blob/master/src/main/java/com/tdunning/math/stats/MergingDigest.java) implementation by the author.\n\n## Building \u0026 Loading\n\nBefore going ahead, make sure that the Redis server you're using has support for [Redis modules](http://antirez.com/news/106).\n\nFirst, you'll have to build the Redis t-digest module from source.\n\n```\nmake\n```\n\nThis should generate a shared library called `tdigest.so` in the root folder. You can now load it into Redis by using the following `redis.conf` configuration directive:\n\n```\nloadmodule /path/to/tdigest.so\n```\n\nAlternatively, you can load it on an already running Redis server by issuing the following commands:\n\n```\nMODULE LOAD /path/to/tdigest.so\n```\n\n## API\n\n#### `TDIGEST.NEW key [compression]`\n\nInitializes a `key` to an empty t-digest structure with the `compression` provided or with the default compression of `400`.\n\n*Reply:* `\"OK\"`\n\n#### `TDIGEST.ADD key value count [value count ...]`\n\nAdds a `value` with the specified `count`. If `key` is missing, an empty t-digest structure is initialized with a default compression of `400`. Returns the sum of counts for all values added.\n\n*Reply:* `long long`\n\n#### `TDIGEST.MERGE destkey sourcekey [sourcekey ...]`\n\nMerges one or more `sourcekey` into `destkey`. If `destkey` is missing, an empty t-digest structure is initialized with a default compression of `400`.\n\n*Reply:* `\"OK\"`\n\n#### `TDIGEST.CDF key value [value ...]`\n\nReturns the cumulative distribution for all provided values. `value` must be a double. The cumulative distribution returned for all values is between `0..1`.\n\n*Reply:* `double` array or `nil` if key missing\n\n#### `TDIGEST.QUANTILE key quantile [quantile ...]`\n\nReturns the estimate values at all provided quantiles. `quantile` must be a `double` between `0..1`.\n\n*Reply:* `double` array or `nil` if key missing\n\n#### `TDIGEST.DEBUG key`\n\nPrints debug information about the t-digest.\n\n*Reply:* bulk strings array\n\nThe reply is of the form:\n\n```\n1) TDIGEST (\u003ccompression\u003e, \u003cnum_centroids\u003e, \u003cmemory size\u003e)\n2)   CENTROID (\u003cmean\u003e, \u003cweight\u003e)\n3)   CENTROID (\u003cmean\u003e, \u003cweight\u003e)\n4)   CENTROID (\u003cmean\u003e, \u003cweight\u003e)\n5)   ...\n```\n\nCentroids are printed in sorted order with respect to their mean.\n\n## Testing\n\nThe integration tests require a running Redis server so you must have `redis-server` on your `PATH` or pass its location in an environment variable called `REDIS_SERVER`. Tests are written in Python and use the [pytest](http://pytest.org/latest/) unit testing library.\n\n```\nmake test\n```\n\n## Contributing\n\nBug reports, feature and pull requests are welcome! Please add tests for any non-trivial changes you submit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusmanm%2Fredis-tdigest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusmanm%2Fredis-tdigest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusmanm%2Fredis-tdigest/lists"}