mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Use Golangci-lint
This commit is contained in:
parent
fdfecc8d7f
commit
0ea1c1b8d3
23 changed files with 177 additions and 174 deletions
|
|
@ -100,7 +100,7 @@ func (l *basicMetricLister) ListAllMetrics() (MetricUpdateResult, error) {
|
|||
}
|
||||
selectors[sel] = struct{}{}
|
||||
go func() {
|
||||
series, err := l.promClient.Series(context.TODO(), pmodel.Interval{startTime, 0}, sel)
|
||||
series, err := l.promClient.Series(context.TODO(), pmodel.Interval{Start: startTime, End: 0}, sel)
|
||||
if err != nil {
|
||||
errs <- fmt.Errorf("unable to fetch metrics for query %q: %v", sel, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ func (r *externalSeriesRegistry) filterAndStoreMetrics(result MetricUpdateResult
|
|||
|
||||
r.metrics = apiMetricsCache
|
||||
r.metricsInfo = rawMetricsCache
|
||||
|
||||
}
|
||||
|
||||
func (r *externalSeriesRegistry) ListAllMetrics() []provider.ExternalMetricInfo {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func (c *metricConverter) convertSample(info provider.ExternalMetricInfo, sample
|
|||
singleMetric := external_metrics.ExternalMetricValue{
|
||||
MetricName: info.Metric,
|
||||
Timestamp: metav1.Time{
|
||||
sample.Timestamp.Time(),
|
||||
Time: sample.Timestamp.Time(),
|
||||
},
|
||||
Value: *resource.NewMilliQuantity(int64(sample.Value*1000.0), resource.DecimalSI),
|
||||
MetricLabels: labels,
|
||||
|
|
@ -133,7 +133,7 @@ func (c *metricConverter) convertScalar(info provider.ExternalMetricInfo, queryR
|
|||
{
|
||||
MetricName: info.Metric,
|
||||
Timestamp: metav1.Time{
|
||||
toConvert.Timestamp.Time(),
|
||||
Time: toConvert.Timestamp.Time(),
|
||||
},
|
||||
Value: *resource.NewMilliQuantity(int64(toConvert.Value*1000.0), resource.DecimalSI),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ func (l *periodicMetricLister) updateMetrics() error {
|
|||
return err
|
||||
}
|
||||
|
||||
//Cache the result.
|
||||
// Cache the result.
|
||||
l.mostRecentResult = result
|
||||
//Let our listeners know we've got new data ready for them.
|
||||
// Let our listeners know we've got new data ready for them.
|
||||
l.notifyListeners()
|
||||
return nil
|
||||
}
|
||||
|
|
@ -85,5 +85,7 @@ func (l *periodicMetricLister) notifyListeners() {
|
|||
}
|
||||
|
||||
func (l *periodicMetricLister) UpdateNow() {
|
||||
l.updateMetrics()
|
||||
if err := l.updateMetrics(); err != nil {
|
||||
utilruntime.HandleError(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue