empiredan commented on code in PR #1857:
URL:
https://github.com/apache/incubator-pegasus/pull/1857#discussion_r1456810887
##########
collector/metrics/metric_collector.go:
##########
@@ -67,22 +63,26 @@ func NewMetricCollector(
dataSource int,
detectInterval time.Duration,
detectTimeout time.Duration) MetricCollector {
- DataSource = dataSource
GaugeMetricsMap = make(map[string]prometheus.GaugeVec, 128)
CounterMetricsMap = make(map[string]prometheus.CounterVec, 128)
SummaryMetricsMap = make(map[string]prometheus.Summary, 128)
- RoleByDataSource = make(map[int]string, 128)
TableNameByID = make(map[string]string, 128)
- RoleByDataSource[0] = "meta"
- RoleByDataSource[1] = "replica"
- initMetrics()
- return &Collector{detectInterval: detectInterval, detectTimeout:
detectTimeout}
+ var role string
+ if dataSource == 0 {
Review Comment:
We could just change `dataSource` to `role`, and certainly change the type
of `dataSource` to `string` instead of `int` which means, changing the type of
following constants to `string`:
```go
const (
MetaServer int = 0
ReplicaServer int = 1
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]