forked from mirror/client_golang
Make listening port for examples to be settable.
This will be better for our own internal tests.
This commit is contained in:
parent
e9b12f3921
commit
1800ee2925
|
@ -17,6 +17,7 @@ distributions.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"github.com/matttproud/golang_instrumentation"
|
"github.com/matttproud/golang_instrumentation"
|
||||||
"github.com/matttproud/golang_instrumentation/maths"
|
"github.com/matttproud/golang_instrumentation/maths"
|
||||||
"github.com/matttproud/golang_instrumentation/metrics"
|
"github.com/matttproud/golang_instrumentation/metrics"
|
||||||
|
@ -25,7 +26,17 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
listeningAddress string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.StringVar(&listeningAddress, "listeningAddress", ":8080", "The address to listen to requests on.")
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
foo_rpc_latency := metrics.CreateHistogram(&metrics.HistogramSpecification{
|
foo_rpc_latency := metrics.CreateHistogram(&metrics.HistogramSpecification{
|
||||||
Starts: metrics.EquallySizedBucketsFor(0, 200, 4),
|
Starts: metrics.EquallySizedBucketsFor(0, 200, 4),
|
||||||
BucketMaker: metrics.AccumulatingBucketBuilder(metrics.EvictAndReplaceWith(10, maths.Average), 50),
|
BucketMaker: metrics.AccumulatingBucketBuilder(metrics.EvictAndReplaceWith(10, maths.Average), 50),
|
||||||
|
@ -71,5 +82,5 @@ func main() {
|
||||||
exporter := metrics.YieldExporter()
|
exporter := metrics.YieldExporter()
|
||||||
|
|
||||||
http.Handle("/metrics.json", exporter)
|
http.Handle("/metrics.json", exporter)
|
||||||
http.ListenAndServe(":8080", nil)
|
http.ListenAndServe(listeningAddress, nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,24 @@ framework is registered and invoked.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"github.com/matttproud/golang_instrumentation"
|
"github.com/matttproud/golang_instrumentation"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
listeningAddress string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.StringVar(&listeningAddress, "listeningAddress", ":8080", "The address to listen to requests on.")
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
exporter := registry.DefaultRegistry.YieldExporter()
|
exporter := registry.DefaultRegistry.YieldExporter()
|
||||||
|
|
||||||
http.Handle("/metrics.json", exporter)
|
http.Handle("/metrics.json", exporter)
|
||||||
http.ListenAndServe(":8080", nil)
|
http.ListenAndServe(listeningAddress, nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue