{"id":37100440,"url":"https://github.com/sendgrid/go-metrics","last_synced_at":"2026-01-14T12:14:07.042Z","repository":{"id":66169722,"uuid":"39218234","full_name":"sendgrid/go-metrics","owner":"sendgrid","description":"Go port of Coda Hale's Metrics library","archived":false,"fork":true,"pushed_at":"2015-12-01T17:35:06.000Z","size":1219,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":82,"default_branch":"master","last_synced_at":"2024-06-20T15:02:39.252Z","etag":null,"topics":["coreplatform"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rcrowley/go-metrics","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sendgrid.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":"2015-07-16T20:13:28.000Z","updated_at":"2024-05-15T18:18:25.000Z","dependencies_parsed_at":"2023-02-19T23:45:38.411Z","dependency_job_id":null,"html_url":"https://github.com/sendgrid/go-metrics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sendgrid/go-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fgo-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fgo-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fgo-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fgo-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sendgrid","download_url":"https://codeload.github.com/sendgrid/go-metrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fgo-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"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":["coreplatform"],"created_at":"2026-01-14T12:14:06.274Z","updated_at":"2026-01-14T12:14:07.029Z","avatar_url":"https://github.com/sendgrid.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-metrics\n==========\n\n![travis build status](https://travis-ci.org/rcrowley/go-metrics.svg?branch=master)\n\nGo port of Coda Hale's Metrics library: \u003chttps://github.com/dropwizard/metrics\u003e.\n\nDocumentation: \u003chttp://godoc.org/github.com/rcrowley/go-metrics\u003e.\n\nUsage\n-----\n\nCreate and update metrics:\n\n```go\nc := metrics.NewCounter()\nmetrics.Register(\"foo\", c)\nc.Inc(47)\n\ng := metrics.NewGauge()\nmetrics.Register(\"bar\", g)\ng.Update(47)\n\ns := metrics.NewExpDecaySample(1028, 0.015) // or metrics.NewUniformSample(1028)\nh := metrics.NewHistogram(s)\nmetrics.Register(\"baz\", h)\nh.Update(47)\n\nm := metrics.NewMeter()\nmetrics.Register(\"quux\", m)\nm.Mark(47)\n\nt := metrics.NewTimer()\nmetrics.Register(\"bang\", t)\nt.Time(func() {})\nt.Update(47)\n```\n\nPeriodically log every metric in human-readable form to standard error:\n\n```go\ngo metrics.Log(metrics.DefaultRegistry, 5 * time.Second, log.New(os.Stderr, \"metrics: \", log.Lmicroseconds))\n```\n\nPeriodically log every metric in slightly-more-parseable form to syslog:\n\n```go\nw, _ := syslog.Dial(\"unixgram\", \"/dev/log\", syslog.LOG_INFO, \"metrics\")\ngo metrics.Syslog(metrics.DefaultRegistry, 60e9, w)\n```\n\nPeriodically emit every metric to Graphite using the [Graphite client](https://github.com/cyberdelia/go-metrics-graphite):\n\n```go\n\nimport \"github.com/cyberdelia/go-metrics-graphite\"\n\naddr, _ := net.ResolveTCPAddr(\"tcp\", \"127.0.0.1:2003\")\ngo graphite.Graphite(metrics.DefaultRegistry, 10e9, \"metrics\", addr)\n```\n\nPeriodically emit every metric into InfluxDB:\n\n**NOTE:** this has been pulled out of the library due to constant fluctuations\nin the InfluxDB API. In fact, all client libraries are on their way out. see\nissues [#121](https://github.com/rcrowley/go-metrics/issues/121) and\n[#124](https://github.com/rcrowley/go-metrics/issues/124) for progress and details.\n\n```go\nimport \"github.com/rcrowley/go-metrics/influxdb\"\n\ngo influxdb.Influxdb(metrics.DefaultRegistry, 10e9, \u0026influxdb.Config{\n    Host:     \"127.0.0.1:8086\",\n    Database: \"metrics\",\n    Username: \"test\",\n    Password: \"test\",\n})\n```\n\nPeriodically upload every metric to Librato using the [Librato client](https://github.com/mihasya/go-metrics-librato):\n\n**Note**: the client included with this repository under the `librato` package\nhas been deprecated and moved to the repository linked above.\n\n```go\nimport \"github.com/mihasya/go-metrics-librato\"\n\ngo librato.Librato(metrics.DefaultRegistry,\n    10e9,                  // interval\n    \"example@example.com\", // account owner email address\n    \"token\",               // Librato API token\n    \"hostname\",            // source\n    []float64{0.95},       // percentiles to send\n    time.Millisecond,      // time unit\n)\n```\n\nPeriodically emit every metric to StatHat:\n\n```go\nimport \"github.com/rcrowley/go-metrics/stathat\"\n\ngo stathat.Stathat(metrics.DefaultRegistry, 10e9, \"example@example.com\")\n```\n\nInstallation\n------------\n\n```sh\ngo get github.com/rcrowley/go-metrics\n```\n\nStatHat support additionally requires their Go client:\n\n```sh\ngo get github.com/stathat/go\n```\n\nPublishing Metrics\n------------------\n\nClients are available for the following destinations:\n\n* Librato - [https://github.com/mihasya/go-metrics-librato](https://github.com/mihasya/go-metrics-librato)\n* Graphite - [https://github.com/cyberdelia/go-metrics-graphite](https://github.com/cyberdelia/go-metrics-graphite)\n* InfluxDB - [https://github.com/vrischmann/go-metrics-influxdb](https://github.com/vrischmann/go-metrics-influxdb)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendgrid%2Fgo-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsendgrid%2Fgo-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendgrid%2Fgo-metrics/lists"}