{"id":23960665,"url":"https://github.com/daniel-nichter/go-metrics","last_synced_at":"2025-04-23T04:27:13.397Z","repository":{"id":89031977,"uuid":"168891398","full_name":"daniel-nichter/go-metrics","owner":"daniel-nichter","description":"Counter, gauge, and histogram base metrics for Go","archived":false,"fork":false,"pushed_at":"2021-11-01T18:22:55.000Z","size":34,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T22:05:21.431Z","etag":null,"topics":["algorithm-r","counter","gauge","golang","histogram","metrics","p999","percentile"],"latest_commit_sha":null,"homepage":"","language":"Go","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/daniel-nichter.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":"2019-02-02T23:54:02.000Z","updated_at":"2024-08-20T14:09:11.000Z","dependencies_parsed_at":"2023-03-13T18:15:18.069Z","dependency_job_id":null,"html_url":"https://github.com/daniel-nichter/go-metrics","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-nichter%2Fgo-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-nichter%2Fgo-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-nichter%2Fgo-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-nichter%2Fgo-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-nichter","download_url":"https://codeload.github.com/daniel-nichter/go-metrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250369242,"owners_count":21419208,"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":["algorithm-r","counter","gauge","golang","histogram","metrics","p999","percentile"],"created_at":"2025-01-06T19:31:47.198Z","updated_at":"2025-04-23T04:27:13.379Z","avatar_url":"https://github.com/daniel-nichter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-metrics\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/daniel-nichter/go-metrics)](https://goreportcard.com/report/github.com/daniel-nichter/go-metrics) [![Build Status](https://app.travis-ci.com/daniel-nichter/go-metrics.svg?branch=master)](https://app.travis-ci.com/daniel-nichter/go-metrics) [![Coverage Status](https://coveralls.io/repos/github/daniel-nichter/go-metrics/badge.svg?branch=master)](https://coveralls.io/github/daniel-nichter/go-metrics?branch=master) [![GoDoc](https://godoc.org/github.com/daniel-nichter/go-metrics?status.svg)](https://pkg.go.dev/github.com/daniel-nichter/go-metrics?tab=doc)\n\nPackage metrics provides base metric types: counter, gauge, and histogram.\n\nThis package differs from other Go metric packages in three significant ways:\n\n1. Metrics: Only base metric types are provide (counter, gauge, histogram). There are no sinks, registries, or derivative metric types. These should be implement by other packages which import this package.\n\n2. Sampling: Only [\"Algorithm R\" by Jeffrey Vitter](https://www.cs.umd.edu/~samir/498/vitter.pdf) is used to sample values for Gauge and Histogram. The reservoir size is fixed at 2,000. Testing with real-world values shows that smaller and larger sizes yield no benefit. **And the true maximum value is kept and reported**, which is not a feature of the original Algorithm R but critical for application performance monitoring.\n\n3. Percentiles: Both nearest rank and linear interpolation are used calculate percentile values. If the sample is full (\u003e= 2,000 values), nearest rank is used; else, \"Definition 8\"--better known as \"R8\"--is used ([Hyndman and Fan (1996)](https://www.amherst.edu/media/view/129116/original/Sample+Quantiles.pdf)). Testing with real-world values shows that this combination produces more accurate P999 (99.9th percentile) values, which is the gold standard for high-performance, low-latency applications.\n\nThis is not a full-feature metrics package with various sampling algorithms, data sinks, etc. It is  _not_ right for:\n\n* Streaming metrics (never resetting sample)\n* Trending or smoothing (1/5/15 min. moving avg.)\n* Derivative/hybrid metrics (timers, sets, etc.)\n\nThose requirements are better handled by specialized algorithms, higher-level code abstractions, and metrics system like Datadog, SignalFx, Prometheus, etc. For example, trending/smoothing should be computed from time series data rather than storing and reporting 1/5/15 minutes of data.\n\nThis package does one thing very well: base app metrics: _counters, gauges, and histograms_. It is right for:\n\n* Latency/response time in micro and milliseconds (with spikes \u003e1s)\n* 99.9th percentile\u0026mdash;the gold standard for high-performance, low-latency apps\n* Building block for an open-source program to provide its own metrics\n\nDoing only one things makes it very easy to understand and use. [Read the docs](https://godoc.org/github.com/daniel-nichter/go-metrics) to see how.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-nichter%2Fgo-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-nichter%2Fgo-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-nichter%2Fgo-metrics/lists"}