Close buffer in #readme example
This commit is contained in:
parent
89d7c1f584
commit
e8dbc2aa55
|
@ -19,7 +19,7 @@ import (
|
||||||
func handleMetrics(rw http.ResponseWriter, req *http.Request) {
|
func handleMetrics(rw http.ResponseWriter, req *http.Request) {
|
||||||
ua := parseUserAgent(req.UserAgent())
|
ua := parseUserAgent(req.UserAgent())
|
||||||
geo := fetchGeoInfo(req.RemoteAddr)
|
geo := fetchGeoInfo(req.RemoteAddr)
|
||||||
|
|
||||||
buf.Add(
|
buf.Add(
|
||||||
&influxdb.Series{
|
&influxdb.Series{
|
||||||
Name: "app.browsers",
|
Name: "app.browsers",
|
||||||
|
@ -44,8 +44,10 @@ var (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
buf = buffer.New(100, writeMetrics)
|
buf = buffer.New(100, writeMetrics)
|
||||||
|
defer buf.Close()
|
||||||
|
|
||||||
http.HandleFunc("/metrics", handleMetrics)
|
http.HandleFunc("/metrics", handleMetrics)
|
||||||
http.ListenAndServe(":8080", nil)
|
http.ListenAndServe(":8080", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue