Example #1
0
func newEntryReader(r io.Reader, id types.ID) *entryReader {
	return &entryReader{
		r:         r,
		id:        id,
		ents:      metrics.GetMap("rafthttp.stream.entries_received").NewCounter(id.String()),
		bytes:     metrics.GetMap("rafthttp.stream.bytes_received").NewCounter(id.String()),
		lastIndex: metrics.GetMap("rafthttp.stream.last_index_received").NewGauge(id.String()),
	}
}
Example #2
0
func newEntryWriter(w io.Writer, id types.ID) *entryWriter {
	ew := &entryWriter{
		w:         w,
		id:        id,
		ents:      metrics.GetMap("rafthttp.stream.entries_sent").NewCounter(id.String()),
		bytes:     metrics.GetMap("rafthttp.stream.bytes_sent").NewCounter(id.String()),
		lastIndex: metrics.GetMap("rafthttp.stream.last_index_sent").NewGauge(id.String()),
	}
	return ew
}
Example #3
0
func (er *entryReader) stop() {
	metrics.GetMap("rafthttp.stream.entries_received").Delete(er.id.String())
	metrics.GetMap("rafthttp.stream.bytes_received").Delete(er.id.String())
	metrics.GetMap("rafthttp.stream.last_index_received").Delete(er.id.String())
}
Example #4
0
func (ew *entryWriter) stop() {
	metrics.GetMap("rafthttp.stream.entries_sent").Delete(ew.id.String())
	metrics.GetMap("rafthttp.stream.bytes_sent").Delete(ew.id.String())
	metrics.GetMap("rafthttp.stream.last_index_sent").Delete(ew.id.String())
}