You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
776 B
35 lines
776 B
4 years ago
|
package ratelimiter
|
||
|
|
||
|
import (
|
||
|
prom "github.com/harmony-one/harmony/api/service/prometheus"
|
||
|
"github.com/prometheus/client_golang/prometheus"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
prom.PromRegistry().MustRegister(
|
||
|
serverRequestCounter,
|
||
|
serverRequestDelayDuration,
|
||
|
)
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
serverRequestCounter = prometheus.NewCounter(
|
||
|
prometheus.CounterOpts{
|
||
|
Namespace: "hmy",
|
||
|
Subsystem: "stream",
|
||
|
Name: "num_server_request",
|
||
|
Help: "number of incoming requests as server",
|
||
|
},
|
||
|
)
|
||
|
|
||
|
serverRequestDelayDuration = prometheus.NewHistogram(
|
||
|
prometheus.HistogramOpts{
|
||
|
Namespace: "hmy",
|
||
|
Subsystem: "stream",
|
||
|
Name: "server_request_delay",
|
||
|
Help: "delay in seconds of incoming requests of server",
|
||
|
Buckets: prometheus.ExponentialBuckets(0.01, 2, 5),
|
||
|
},
|
||
|
)
|
||
|
)
|