Skip to content

Commit

Permalink
Revert "fix: rename ThreeStats to AggStats (#184)"
Browse files Browse the repository at this point in the history
This reverts commit 4cccba0.
  • Loading branch information
Reasno authored Aug 26, 2021
1 parent 4cccba0 commit 8a50bf3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 47 deletions.
25 changes: 13 additions & 12 deletions observability/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package observability
import (
"sync"

"github.com/DoNewsCode/core/otgorm"
"github.com/DoNewsCode/core/otkafka"

"github.com/DoNewsCode/core/otgorm"
"github.com/DoNewsCode/core/otredis"
"github.com/go-kit/kit/metrics"
"github.com/go-kit/kit/metrics/prometheus"
Expand Down Expand Up @@ -143,7 +144,7 @@ func ProvideKafkaReaderMetrics() *otkafka.ReaderStats {
Name: "kafka_reader_queue_capacity",
Help: "",
}, labels),
DialTime: otkafka.AggStats{
DialTime: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_reader_dial_seconds_min",
Help: "",
Expand All @@ -157,7 +158,7 @@ func ProvideKafkaReaderMetrics() *otkafka.ReaderStats {
Help: "",
}, labels),
},
ReadTime: otkafka.AggStats{
ReadTime: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_reader_read_seconds_min",
Help: "",
Expand All @@ -171,7 +172,7 @@ func ProvideKafkaReaderMetrics() *otkafka.ReaderStats {
Help: "",
}, labels),
},
WaitTime: otkafka.AggStats{
WaitTime: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_reader_wait_seconds_min",
Help: "",
Expand All @@ -185,7 +186,7 @@ func ProvideKafkaReaderMetrics() *otkafka.ReaderStats {
Help: "",
}, labels),
},
FetchSize: otkafka.AggStats{
FetchSize: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_reader_fetch_size_min",
Help: "",
Expand All @@ -199,7 +200,7 @@ func ProvideKafkaReaderMetrics() *otkafka.ReaderStats {
Help: "",
}, labels),
},
FetchBytes: otkafka.AggStats{
FetchBytes: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_reader_fetch_bytes_min",
Help: "",
Expand Down Expand Up @@ -265,7 +266,7 @@ func ProvideKafkaWriterMetrics() *otkafka.WriterStats {
Name: "kafka_writer_async",
Help: "",
}, labels),
BatchTime: otkafka.AggStats{
BatchTime: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_writer_batch_seconds_min",
Help: "",
Expand All @@ -279,7 +280,7 @@ func ProvideKafkaWriterMetrics() *otkafka.WriterStats {
Help: "",
}, labels),
},
WriteTime: otkafka.AggStats{
WriteTime: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_writer_write_seconds_min",
Help: "",
Expand All @@ -293,7 +294,7 @@ func ProvideKafkaWriterMetrics() *otkafka.WriterStats {
Help: "",
}, labels),
},
WaitTime: otkafka.AggStats{
WaitTime: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_writer_wait_seconds_min",
Help: "",
Expand All @@ -307,7 +308,7 @@ func ProvideKafkaWriterMetrics() *otkafka.WriterStats {
Help: "",
}, labels),
},
Retries: otkafka.AggStats{
Retries: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_writer_retries_count_min",
Help: "",
Expand All @@ -321,7 +322,7 @@ func ProvideKafkaWriterMetrics() *otkafka.WriterStats {
Help: "",
}, labels),
},
BatchSize: otkafka.AggStats{
BatchSize: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_writer_batch_size_min",
Help: "",
Expand All @@ -335,7 +336,7 @@ func ProvideKafkaWriterMetrics() *otkafka.WriterStats {
Help: "",
}, labels),
},
BatchBytes: otkafka.AggStats{
BatchBytes: otkafka.ThreeStats{
Min: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Name: "kafka_writer_batch_bytes_min",
Help: "",
Expand Down
44 changes: 22 additions & 22 deletions otkafka/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ func TestModule_ProvideRunGroup(t *testing.T) {
MaxWait: m,
QueueLength: m,
QueueCapacity: m,
DialTime: AggStats{
DialTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
ReadTime: AggStats{
ReadTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
WaitTime: AggStats{
WaitTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
FetchSize: AggStats{
FetchSize: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
FetchBytes: AggStats{
FetchBytes: ThreeStats{
Min: m,
Max: m,
Avg: m,
Expand All @@ -103,32 +103,32 @@ func TestModule_ProvideRunGroup(t *testing.T) {
WriteTimeout: m,
RequiredAcks: m,
Async: m,
BatchTime: AggStats{
BatchTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
WriteTime: AggStats{
WriteTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
WaitTime: AggStats{
WaitTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
Retries: AggStats{
Retries: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
BatchSize: AggStats{
BatchSize: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
BatchBytes: AggStats{
BatchBytes: ThreeStats{
Min: m,
Max: m,
Avg: m,
Expand Down Expand Up @@ -186,27 +186,27 @@ func TestCollector(t *testing.T) {
MaxWait: m,
QueueLength: m,
QueueCapacity: m,
DialTime: AggStats{
DialTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
ReadTime: AggStats{
ReadTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
WaitTime: AggStats{
WaitTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
FetchSize: AggStats{
FetchSize: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
FetchBytes: AggStats{
FetchBytes: ThreeStats{
Min: m,
Max: m,
Avg: m,
Expand All @@ -226,32 +226,32 @@ func TestCollector(t *testing.T) {
WriteTimeout: m,
RequiredAcks: m,
Async: m,
BatchTime: AggStats{
BatchTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
WriteTime: AggStats{
WriteTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
WaitTime: AggStats{
WaitTime: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
Retries: AggStats{
Retries: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
BatchSize: AggStats{
BatchSize: ThreeStats{
Min: m,
Max: m,
Avg: m,
},
BatchBytes: AggStats{
BatchBytes: ThreeStats{
Min: m,
Max: m,
Avg: m,
Expand Down
14 changes: 7 additions & 7 deletions otkafka/reader_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type readerCollector struct {
interval time.Duration
}

// AggStats is a gauge group struct.
type AggStats struct {
// ThreeStats is a gauge group struct.
type ThreeStats struct {
Min metrics.Gauge
Max metrics.Gauge
Avg metrics.Gauge
Expand All @@ -38,11 +38,11 @@ type ReaderStats struct {
QueueLength metrics.Gauge
QueueCapacity metrics.Gauge

DialTime AggStats
ReadTime AggStats
WaitTime AggStats
FetchSize AggStats
FetchBytes AggStats
DialTime ThreeStats
ReadTime ThreeStats
WaitTime ThreeStats
FetchSize ThreeStats
FetchBytes ThreeStats
}

// newCollector creates a new kafka reader wrapper containing the name of the reader.
Expand Down
12 changes: 6 additions & 6 deletions otkafka/writer_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ type WriterStats struct {
RequiredAcks metrics.Gauge
Async metrics.Gauge

BatchTime AggStats
WriteTime AggStats
WaitTime AggStats
Retries AggStats
BatchSize AggStats
BatchBytes AggStats
BatchTime ThreeStats
WriteTime ThreeStats
WaitTime ThreeStats
Retries ThreeStats
BatchSize ThreeStats
BatchBytes ThreeStats
}

// newCollector creates a new kafka writer wrapper containing the name of the reader.
Expand Down

0 comments on commit 8a50bf3

Please sign in to comment.