README.md: added usage
section
This commit is contained in:
parent
b1d3992f35
commit
5cc39fde95
24
README.md
24
README.md
@ -19,6 +19,30 @@
|
|||||||
* It doesn't implement advanced functionality from [github.com/prometheus/client_golang/prometheus](https://godoc.org/github.com/prometheus/client_golang/prometheus).
|
* It doesn't implement advanced functionality from [github.com/prometheus/client_golang/prometheus](https://godoc.org/github.com/prometheus/client_golang/prometheus).
|
||||||
|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```go
|
||||||
|
var (
|
||||||
|
requestsTotal = metrics.NewCounter("requests_total")
|
||||||
|
|
||||||
|
queueSize = metrics.NewGauge(`queue_size{queue="foobar"}`, func() float64 {
|
||||||
|
return float64(foobarQueue.Len())
|
||||||
|
})
|
||||||
|
|
||||||
|
requestDuration = metrics.NewSummary(`requests_duration_seconds{handler="/my/super/handler"}`)
|
||||||
|
)
|
||||||
|
|
||||||
|
func requestHandler() {
|
||||||
|
startTime := time.Now()
|
||||||
|
...
|
||||||
|
requestsTotal.Inc()
|
||||||
|
requestDuration.UpdateDuration(startTime)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See [docs](http://godoc.org/github.com/VictoriaMetrics/metrics) for more info.
|
||||||
|
|
||||||
|
|
||||||
### Users
|
### Users
|
||||||
|
|
||||||
* `Metrics` has been extracted from [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) sources.
|
* `Metrics` has been extracted from [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) sources.
|
||||||
|
Loading…
Reference in New Issue
Block a user