Skip to content

Commit

Permalink
format files by gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Dec 11, 2023
1 parent 7641fdd commit 9d08fbd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions collector/avail/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ type pegasusDetector struct {
detectTableName string
detectInterval time.Duration
// timeout of a single detect.
detectTimeout time.Duration
detectTimeout time.Duration
// partition count.
partitionCount int
partitionCount int
}

func (d *pegasusDetector) Start(tom *tomb.Tomb) error {
Expand Down
46 changes: 23 additions & 23 deletions collector/metrics/metric_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,29 +291,29 @@ func updateClusterLevelTableMetrics(metricsByTableID map[string]Metrics) {
func updateMetric(metric Metric, endpoint string, level string, title string) {
role := RoleByDataSource[DataSource]
switch metric.mtype {
case "Counter":
if counter, ok := CounterMetricsMap[metric.name]; ok {
counter.With(
prometheus.Labels{"endpoint": endpoint,
"role": role, "level": level,
"title": title}).Add(float64(metric.value))
} else {
log.Warnf("Unknown metric name %s", metric.name)
}
case "Gauge":
if gauge, ok := GaugeMetricsMap[metric.name]; ok {
gauge.With(
prometheus.Labels{"endpoint": endpoint,
"role": role, "level": level,
"title": title}).Set(float64(metric.value))
} else {
log.Warnf("Unknown metric name %s", metric.name)
}
case "Percentile":
log.Warnf("Todo metric type %s", metric.mtype)
case "Histogram":
default:
log.Warnf("Unsupport metric type %s", metric.mtype)
case "Counter":
if counter, ok := CounterMetricsMap[metric.name]; ok {
counter.With(
prometheus.Labels{"endpoint": endpoint,
"role": role, "level": level,
"title": title}).Add(float64(metric.value))
} else {
log.Warnf("Unknown metric name %s", metric.name)
}
case "Gauge":
if gauge, ok := GaugeMetricsMap[metric.name]; ok {
gauge.With(
prometheus.Labels{"endpoint": endpoint,
"role": role, "level": level,
"title": title}).Set(float64(metric.value))
} else {
log.Warnf("Unknown metric name %s", metric.name)
}
case "Percentile":
log.Warnf("Todo metric type %s", metric.mtype)
case "Histogram":
default:
log.Warnf("Unsupport metric type %s", metric.mtype)
}
}

Expand Down

0 comments on commit 9d08fbd

Please sign in to comment.