https://github.com/scorphus/measures
π Backstage Measures in Go
https://github.com/scorphus/measures
Last synced: about 1 year ago
JSON representation
π Backstage Measures in Go
- Host: GitHub
- URL: https://github.com/scorphus/measures
- Owner: scorphus
- License: other
- Created: 2016-03-22T20:11:41.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-09T01:11:01.000Z (about 10 years ago)
- Last Synced: 2025-03-01T18:51:17.932Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 25
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
[![][travis-badge]][travis-link]
[![][coverage-badge]][coverage-link]
![][license-badge]
![][go-version]
# Measures
A Go package to send application metrics using UDP.
## Usage
Create an instance of `Measures` specifying the client name and server address:
```go
Measures = measures.New("measures-example", "0.0.0.0:3593")
```
Count something β a fruit, for example:
```
Measures.Count("fruits", 1, measures.Dimensions{
"name": "avocado",
"color": "green",
})
```
You can also measure time spent on something:
```go
func someLengthyOperation() {
defer M.Time("example", time.Now(), nil) // No Dimensions in this case
time.Sleep(359e6)
}
```
And you can provide Dimensions at once:
```go
func anotherLengthyOperation() {
defer M.Time("example", time.Now(), measures.Dimensions{"number": 359})
time.Sleep(359e6)
}
```
Or as you have them:
```go
func yetanotherLengthyOperation() {
d := make(measures.Dimensions, 2)
defer M.Time("example", time.Now(), d)
d["number"] = 359
time.Sleep(359e6)
d["isPrime"] = true
}
```
# License
[Simplified BSD][bsd-2cl] Β© [Measures authors][authors] et [al][contributors]
[authors]: https://github.com/scorphus/measures/blob/master/AUTHORS
[bsd-2cl]: https://opensource.org/licenses/BSD-2-Clause
[contributors]: https://github.com/scorphus/measures/blob/master/CONTRIBUTORS
[go-version]: https://img.shields.io/badge/Go->=1.5.1-6DD2F0.svg
[coverage-badge]: https://img.shields.io/coveralls/scorphus/measures.svg
[coverage-link]: https://coveralls.io/github/scorphus/measures
[license-badge]: https://img.shields.io/badge/license-BSD_2βClause-007EC7.svg
[travis-badge]: http://img.shields.io/travis/scorphus/measures.svg
[travis-link]: https://travis-ci.org/scorphus/measures