{"id":20980706,"url":"https://github.com/statful/statful-client-golang","last_synced_at":"2026-04-21T21:02:15.729Z","repository":{"id":51341818,"uuid":"253994147","full_name":"statful/statful-client-golang","owner":"statful","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-14T10:07:40.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-20T06:33:56.488Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statful.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":"2020-04-08T05:31:01.000Z","updated_at":"2021-05-14T10:05:29.000Z","dependencies_parsed_at":"2022-08-27T19:40:25.228Z","dependency_job_id":null,"html_url":"https://github.com/statful/statful-client-golang","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-client-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-client-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-client-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-client-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statful","download_url":"https://codeload.github.com/statful/statful-client-golang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243382934,"owners_count":20282051,"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-11-19T05:29:44.984Z","updated_at":"2025-12-28T21:28:19.434Z","avatar_url":"https://github.com/statful.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nStatful Client for golang\n==============\n\nStatful client for golang written in go. This client is intended to gather metrics and send them to Statful.\n\n## Table of Contents\n\n* [Supported Versions of Golang](#supported-versions-of-golang)\n* [Quick Start](#quick-start)\n* [Reference](#reference)\n  * [Global Configuration](#global-configuration)\n  * [Methods](#methods)\n* [Examples](#examples)\n  * [UDP Configuration](#udp-configuration)\n  * [HTTP Configuration](#http-configuration)\n  * [Disabling Auto Flush](#disabling-auto-flush)\n  * [Buffer Configuration](#buffer-configuration)\n  * [Event Sender Configuration](#event-sender-configuration)\n * [Authors](#authors)\n* [License](#license)\n\n## Supported Versions of Golang\n\n| Statful Client version | Tested golang versions  |\n|:---|:---|\n| 0.16.0 | `1.15` |\n| 0.15.0 | `1.15` |\n\n## Quick Start\n\nTwo examples are available in the examples folder. One of an http server and one of a simple metric.\nYou can use them as guideline on how to setup a golang client on your own project.\n\n## Reference\n\nThe following section presents a detailed reference of the available options to take full advantage of Statful.\n\n### Global Configuration\n\nBelow you can find the information on the custom options to set up the configurations parameters.\n\n| Option | Description | Type | Default | Required |\n|:---|:---|:---|:---|:---|\n| _DisableAutoFlush_ | Defines if metrics should be flushed synchronously. ``FlushSize`` and ``FlushInterval`` attributes are disabled and ``Flush()`` or ``FlushError()`` functions should be called instead. | `boolean` | `false` | **NO** |\n| _DryRun_ | Defines if metrics should be output to the logger instead of being sent to Statful (useful for testing/debugging purposes). | `boolean` | `false` | **NO** |\n| _FlushSize_ | Defines the maximum buffer size before performing a flush, in **bytes**. | `number` | `1000` | **NO** |\n| _GlobalTags_ | Object for setting the global tags. | `object` | `{}` | **NO** |\n| _Url_ | Defines the url where the metrics are sent. | `string` | **none** | **NO** |\n| _token_ | Defines the token used to match incoming data to Statful. It can only be set inside _api_. | `string` | **none** | **YES** |\n| _timeout_ | Defines the timeout for the transport layers in **milliseconds**. It can only be set inside _api_. | `number` | `2000` | **NO** |\n\n### Methods\n\nThe methods for non-aggregated metrics receive a metric name and value as arguments and send a counter, a gauge, a timer or a custom metric.\n\n```golang\n// Non-Aggregated Metrics\n- statful.Counter(\"myCounter\", 1.0, statful.Tags{\"foo \"bar\"});\n- statful.Gauge(\"myGauge\", 1, statful.Tags{\"foo \"bar\"});\n- statful.Timer(\"myTimer\", 1.0, statful.Tags{\"foo \"bar\"});\n- statful.Put(\"myCustomMetric\", 200, statful.Tags{\"foo \"bar\"}, time.Now().Unix(), statful.Aggregations{AggAvg: struct{}{}}, statful.Freq30s, statful.WithUser(\"user-uuid\"));\n```\n\n```golang\n// Aggregated Metrics\n- statful.CounterAggregated(\"myCounter\", 1.0, statful.Tags{\"foo \"bar\"}, statful.Aggregations{AggAvg: struct{}{}}, statful.Freq30s);\n- statful.GaugeAggregated(\"myGauge\", 1, statful.Tags{\"foo \"bar\"}, statful.Aggregations{AggAvg: struct{}{}}, statful.Freq30s);\n- statful.TimerAggregated(\"myTimer\", 1.0, statful.Tags{\"foo \"bar\"}, statful.Aggregations{AggAvg: struct{}{}}, statful.Freq30s);\n- statful.PutAggregated(\"myCustomMetric\", 200, statful.Tags{\"foo \"bar\"}, time.Now().Unix(), statful.Aggregations{AggAvg: struct{}{}}, statful.Freq30s, statful.WithUser(\"user-uuid\"));\n```\n\n## Examples\n\nHere you can find some useful usage examples of the Statful’s golang Client.\n\n### UDP Configuration\n\nCreate a simple UDP configuration for the client.\n\n```golang\nstatful.Statful{\n    Sender: \u0026statful.ProxyMetricsSender{\n        Client: \u0026statful.UdpClient{\n            Address: \"localhost:1234\",\n        },\n    },\n    GlobalTags: statful.Tags{\"client\": \"golang\"},\n    DryRun:     false,\n}\n```\n\n### HTTP Configuration\n\nCreate a simple HTTP API configuration for the client.\n\n```golang\nstatful.New(\n    statful.Configuration{\n        DryRun: false,\n        FlushSize: 1000,\n\n        Sender: \u0026statful.HttpSender{\n            Http:     \u0026http.Client{},\n            Url:      \"https://api.statful.com\",\n            Token:    \"12345678-09ab-cdef-1234-567890abcdef\",\n        },\n\n        Logger: log.New(os.Stderr, \"\", log.LstdFlags),\n        Tags: statful.Tags{\"client\": \"golang\"},\n    }\n)\n```\n\n### Disabling Auto Flush\n\nCreate an HTTP API configuration that prevents flushing asynchronously.\n\n```golang\nstatful.New(\n    statful.Configuration{\n        DisableAutoFlush: true,\n        DryRun: false,\n\n        Sender: \u0026statful.HttpSender{\n            Http:     \u0026http.Client{},\n            Url:      \"https://api.statful.com\",\n            Token:    \"12345678-09ab-cdef-1234-567890abcdef\",\n        },\n\n        Logger: log.New(os.Stderr, \"\", log.LstdFlags),\n        Tags: statful.Tags{\"client\": \"golang\"},\n    }\n)\n```\n\n### Buffer Configuration\n\nCreate a simple Metrics Sender that buffers metrics before sending.\n\n```golang\nstatful.New(\n    statful.Configuration{\n        DryRun: false,\n        FlushSize: 1000,\n\n        Sender: \u0026statful.HttpSender{\n            Http:     \u0026http.Client{},\n            Url:      \"https://api.statful.com\",\n            Token:    \"12345678-09ab-cdef-1234-567890abcdef\",\n        },\n\n        Logger: log.New(os.Stderr, \"\", log.LstdFlags),\n        Tags: statful.Tags{\"client\": \"golang\"},\n    }\n)\n```\n\n\n### Event Sender Configuration\n\nTo send event payload (JSON) you may configure event sender in your client.\n\n```golang\nstatful.New(\n    statful.Configuration{\n        DryRun: false,\n\n        Sender: \u0026statful.HttpSender{\n            Http:     \u0026http.Client{},\n            Url:      \"https://api.statful.com\",\n            Token:    \"12345678-09ab-cdef-1234-567890abcdef\",\n        },\n        Logger: log.New(os.Stderr, \"\", log.LstdFlags),\n    }\n)\n```\n\n## Authors\n\n[Statful](https://github.com/Statful)\n\n## License\n\nStatful Golang Client is available under the MIT license. See the [LICENSE](https://raw.githubusercontent.com/statful/statful-client-objc/master/LICENSE) file for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatful%2Fstatful-client-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatful%2Fstatful-client-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatful%2Fstatful-client-golang/lists"}