{"id":17091354,"url":"https://github.com/ajvb/go-librato","last_synced_at":"2025-03-23T16:14:13.168Z","repository":{"id":30529932,"uuid":"34084503","full_name":"ajvb/go-librato","owner":"ajvb","description":"forked from https://github.com/rcrowley/go-librato","archived":false,"fork":false,"pushed_at":"2015-04-17T00:14:16.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T22:19:31.213Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajvb.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-04-16T22:46:26.000Z","updated_at":"2015-04-17T00:14:16.000Z","dependencies_parsed_at":"2022-09-05T18:50:44.067Z","dependency_job_id":null,"html_url":"https://github.com/ajvb/go-librato","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajvb%2Fgo-librato","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajvb%2Fgo-librato/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajvb%2Fgo-librato/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajvb%2Fgo-librato/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajvb","download_url":"https://codeload.github.com/ajvb/go-librato/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245128130,"owners_count":20565206,"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":[],"created_at":"2024-10-14T13:58:22.688Z","updated_at":"2025-03-23T16:14:13.142Z","avatar_url":"https://github.com/ajvb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-librato\n==========\n\nThis is both a Go client to the [Librato Metrics API](http://dev.librato.com/v1/metrics) and a command-line tool for piping data into the client.\n\nUsage\n-----\n\nFrom Go:\n\n```go\nm := librato.NewSimpleMetrics(user, token, source)\ndefer m.Wait()\ndefer m.Close()\n\nc := m.GetCounter(\"foo\")\nc \u003c- 47\n\ng := m.GetGauge(\"bar\")\ng \u003c- 47\n\ncc := m.GetCustomCounter(\"baz\")\ncc \u003c- map[string]int64 {\n\t\"value\": 47,\n\t\"measure_time\": 1234567890,\n}\n\ncg := m.GetCustomGauge(\"bang\")\ncg \u003c- map[string]int64 {\n\t\"value\": 47,\n\t\"measure_time\": 1234567890,\n}\ncg \u003c- map[string]int64 {\n\t\"measure_time\": 1234567890,\n\t\"count\": 2,\n\t\"sum\": 94,\n\t\"max\": 47,\n\t\"min\": 47,\n\t\"sum_squares\": 4418,\n}\n```\n\nAlternatively you can use the collated mode so data will be sent when\nenough measurements are available:\n\n```go\ncollate_max := 3\nm := librato.NewCollatedMetrics(user, token, source, collate_max)\nc := m.GetCounter(\"foo\")\ng := m.GetGauge(\"bar\")\nc \u003c- 1\nc \u003c- 2\nc \u003c- 3 // send here ...\ng \u003c- 10\ng \u003c- 20\ng \u003c- 30 // send here ...\n```\n\nAs above, custom metrics are also available.\n\nYou can also use the command line tool to send your data:\n\n```sh\nthing | librato -u \"rcrowley\" -t \"ZOMG\" -s \"$(hostname)\"\n\nexport LIBRATO_USER=\"rcrowley\"\nexport LIBRATO_TOKEN=\"ZOMG\"\nexport LIBRATO_SOURCE=\"$(hostname)\"\ntail -F /var/log/thing | librato -c 100\n```\n\nThe `librato` tool accepts one metric per line.  The first field is either a `c` or a `g` to indicate that the metric is a counter or a gauge.  The second field is the name of the metric, which may not contain spaces.  The remaining fields may either be numeric or `-` but must provide a combination of non-`-` values acceptable to the Librato Metrics API.\n\nRegular expressions:\n\n```\n# Value-only counters and gauges.\n^([cg]) ([^ ]+) ([0-9]+)$\n\n# Custom counters with a value and optionally a timestamp.\n^(c) ([^ ]+) ([0-9]+) (-|[0-9]+)$\n\n# Custom gauges with a value, timestamp, count, sum, max, min, and sum-of-squares (or some combination thereof).\n^(g) ([^ ]+) (-|[0-9]+) (-|[0-9]+) (-|[0-9]+) (-|[0-9]+) (-|[0-9]+) (-|[0-9]+) (-|[0-9]+)$\n```\n\nExamples:\n\n```\nc foo 47\ng bar 47\nc baz 47 1234567890\ng bang 47 1234567890 - - - - -\ng bang - 1234567890 2 94 47 47 4418\n```\n\nInstallation\n------------\n\nInstallation requires a working Go build environment.  See their [Getting Started](http://golang.org/doc/install.html) guide if you don't already have one.\n\nAs a library:\n\n```sh\ngo get github.com/rcrowley/go-librato\n```\n\nThe `librato.a` library will by in `$GOROOT/pkg/${GOOS}_${GOARCH}/github.com/rcrowley/go-librato` should be linkable without further configuration.\n\nAs a command-line tool:\n\n```sh\ngit clone git://github.com/rcrowley/go-librato.git\ncd go-librato/cmd/librato\ngo install\n```\n\nThe `librato` tool will be in `$GOBIN`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajvb%2Fgo-librato","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajvb%2Fgo-librato","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajvb%2Fgo-librato/lists"}