{"id":18141554,"url":"https://github.com/skjolber/inline-histogram","last_synced_at":"2025-04-06T18:32:49.535Z","repository":{"id":200183128,"uuid":"704963462","full_name":"skjolber/inline-histogram","owner":"skjolber","description":"Inline text histogram","archived":false,"fork":false,"pushed_at":"2024-04-13T09:59:31.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T00:29:40.130Z","etag":null,"topics":["histogram","java","logging","stackdriver","text"],"latest_commit_sha":null,"homepage":"","language":"Java","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/skjolber.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-14T16:30:09.000Z","updated_at":"2023-10-14T21:50:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"61fd88c1-6f1e-4ef4-82cf-398204f4a567","html_url":"https://github.com/skjolber/inline-histogram","commit_stats":null,"previous_names":["skjolber/inline-histogram"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Finline-histogram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Finline-histogram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Finline-histogram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Finline-histogram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skjolber","download_url":"https://codeload.github.com/skjolber/inline-histogram/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247530842,"owners_count":20953857,"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":["histogram","java","logging","stackdriver","text"],"created_at":"2024-11-01T17:07:36.969Z","updated_at":"2025-04-06T18:32:49.498Z","avatar_url":"https://github.com/skjolber.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://github.com/skjolber/inline-histogram/actions/workflows/maven.yml/badge.svg) \n[![Maven Central](https://img.shields.io/maven-central/v/com.github.skjolber.histogram/inline.svg)](https://mvnrepository.com/artifact/com.github.skjolber.histogram/inline)\n\n\n# inline-histogram\nSimple utility for visualizing a histogram in a single line of text, using [box-drawing-characters](https://en.wikipedia.org/wiki/Box-drawing_character). \n\nFeatures: \n\n * generate normalized text histograms:\n    * Vanilla:\n        * ▁▂▃▅▆▇\n    * Labels:\n       * 0s▕ ▁▂▃▃▅▆▇ ▏5s\n    * Indicator:\n       *  ▁▂▃▅⭐▆▇\n\nThe library is primarily intended for simple visualization of HTTP request durations in logs.\n\n## License\n[Apache 2.0]\n\n## Obtain\nThe project is built with [Maven] and is available on the central Maven repository. \n\n\u003cdetails\u003e\n  \u003csummary\u003eMaven coordinates\u003c/summary\u003e\n\nAdd the property\n```xml\n\u003cinline-histogram.version\u003e1.0.0\u003c/inline-histogram.version\u003e\n```\n\nthen add\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.skjolber.histogram\u003c/groupId\u003e\n    \u003cartifactId\u003einline\u003c/artifactId\u003e\n    \u003cversion\u003e${inline-histogram.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\u003c/details\u003e\n\nor\n\n\u003cdetails\u003e\n  \u003csummary\u003eGradle coordinates\u003c/summary\u003e\n\nFor\n\n```groovy\next {\n  inlineHistogramVersion = '1.0.0'\n}\n```\n\nadd\n\n```groovy\napi (\"com.github.skjolber.histogram:inline:${inlineHistogramVersion}\")\n```\n\u003c/details\u003e\n\n# Usage\nSo we want to create a `HistogramCharSequence`. The `DefaultHistogram` implementation is a fixed size histogram with thread-safe counters.\n\n```\nDefaultHistogram histogram = DefaultHistogram.newBuilder()\n\t.add(0, \"0s\")\n\t.add(250)\n\t.add(500)\n\t.add(750)\n\t.add(1000, \"1000s\")\n\t.build();\n```\n\nthen update by index\n\n```\nhistogram.incrementByIndex(1);\n```\n\nor value\n\n```\nhistogram.incrementByValue(444);\n```\n\nwhen it is time to see the results, get the `HistogramCharSequence` and print it.\n\n```\nHistogramCharSequence sequence = HistogramCharSequenceFactory.newInstance(histogram);\n\nLOGGER.info(\"https://... HTTP 200 in 444ms \" + sequence);\n```\n\nNote that resolution is limited to 9 levels.\n\n# Supported tools\nSupport depends on the font used in the log accumulation tool. This implementation has been tested with\n\n * GCP's Stackdriver\n\nExample:\n\n * 0 to 10 second histogram, with\n * 250 ms slots, and\n * labels, with\n * indicator (⭐) for the current request\n \n![Logs Explorer](doc/stackdriver.png)\n\n[Apache 2.0]:          \thttp://www.apache.org/licenses/LICENSE-2.0.html\n[issue-tracker]:       \thttps://github.com/skjolber/inline-histogram/issues\n[Maven]:                http://maven.apache.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskjolber%2Finline-histogram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskjolber%2Finline-histogram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskjolber%2Finline-histogram/lists"}