parent
92d561d235
commit
1885f1df74
@ -0,0 +1,81 @@ |
||||
package streammanager |
||||
|
||||
import ( |
||||
prom "github.com/harmony-one/harmony/api/service/prometheus" |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
) |
||||
|
||||
func init() { |
||||
prom.PromRegistry().MustRegister( |
||||
discoverCounterVec, |
||||
discoveredPeersCounterVec, |
||||
addedStreamsCounterVec, |
||||
removedStreamsCounterVec, |
||||
setupStreamDuration, |
||||
numStreamsGaugeVec, |
||||
) |
||||
} |
||||
|
||||
var ( |
||||
discoverCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "discover", |
||||
Help: "number of intentions to actively discover peers", |
||||
}, |
||||
[]string{"topic"}, |
||||
) |
||||
|
||||
discoveredPeersCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "discover_peers", |
||||
Help: "number of peers discovered and connect actively", |
||||
}, |
||||
[]string{"topic"}, |
||||
) |
||||
|
||||
addedStreamsCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "added_streams", |
||||
Help: "number of streams added in stream manager", |
||||
}, |
||||
[]string{"topic"}, |
||||
) |
||||
|
||||
removedStreamsCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "removed_streams", |
||||
Help: "number of streams removed in stream manager", |
||||
}, |
||||
[]string{"topic"}, |
||||
) |
||||
|
||||
setupStreamDuration = prometheus.NewHistogramVec( |
||||
prometheus.HistogramOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "setup_stream_duration", |
||||
Help: "duration in seconds of setting up connection to a discovered peer", |
||||
// buckets: 20ms, 40ms, 80ms, 160ms, 320ms, 640ms, 1280ms, +INF
|
||||
Buckets: prometheus.ExponentialBuckets(0.02, 2, 8), |
||||
}, |
||||
[]string{"topic"}, |
||||
) |
||||
|
||||
numStreamsGaugeVec = prometheus.NewGaugeVec( |
||||
prometheus.GaugeOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "num_streams", |
||||
Help: "number of connected streams", |
||||
}, |
||||
[]string{"topic"}, |
||||
) |
||||
) |
@ -0,0 +1,75 @@ |
||||
package sttypes |
||||
|
||||
import ( |
||||
prom "github.com/harmony-one/harmony/api/service/prometheus" |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
) |
||||
|
||||
func init() { |
||||
prom.PromRegistry().MustRegister( |
||||
bytesReadCounter, |
||||
bytesWriteCounter, |
||||
msgReadCounter, |
||||
msgWriteCounter, |
||||
msgReadFailedCounterVec, |
||||
msgWriteFailedCounterVec, |
||||
) |
||||
} |
||||
|
||||
var ( |
||||
bytesReadCounter = prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "bytes_read", |
||||
Help: "total bytes read from stream", |
||||
}, |
||||
) |
||||
|
||||
bytesWriteCounter = prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "bytes_write", |
||||
Help: "total bytes write to stream", |
||||
}, |
||||
) |
||||
|
||||
msgReadCounter = prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "msg_read", |
||||
Help: "number of messages read from stream", |
||||
}, |
||||
) |
||||
|
||||
msgWriteCounter = prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "msg_write", |
||||
Help: "number of messages write to stream", |
||||
}, |
||||
) |
||||
|
||||
msgReadFailedCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "msg_read_failed", |
||||
Help: "number of messages failed reading from stream", |
||||
}, |
||||
[]string{"error"}, |
||||
) |
||||
|
||||
msgWriteFailedCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "stream", |
||||
Name: "msg_write_failed", |
||||
Help: "number of messages failed writing to stream", |
||||
}, |
||||
[]string{"error"}, |
||||
) |
||||
) |
Loading…
Reference in new issue