Skip to content

Commit

Permalink
[chore] fix exhaustive lint for pkg pdatatest (#23953)
Browse files Browse the repository at this point in the history
**Description:** 
related #23266

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
  • Loading branch information
fatsheep9146 authored Jul 5, 2023
1 parent e41a58a commit bd8eae1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ issues:
- path: k8sconfig
linters:
- exhaustive
- path: pdatatest
linters:
- exhaustive
- path: ottl
linters:
- exhaustive
Expand Down
1 change: 1 addition & 0 deletions pkg/pdatatest/pmetrictest/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ func CompareMetric(expected pmetric.Metric, actual pmetric.Metric) error {
case pmetric.MetricTypeSummary:
errs = multierr.Append(errs, compareSummaryDataPointSlices(expected.Summary().DataPoints(),
actual.Summary().DataPoints()))
case pmetric.MetricTypeEmpty:
}

return errs
Expand Down
7 changes: 7 additions & 0 deletions pkg/pdatatest/pmetrictest/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func getDataPointSlice(metric pmetric.Metric) pmetric.NumberDataPointSlice {
dataPointSlice = metric.Gauge().DataPoints()
case pmetric.MetricTypeSum:
dataPointSlice = metric.Sum().DataPoints()
case pmetric.MetricTypeEmpty, pmetric.MetricTypeHistogram, pmetric.MetricTypeExponentialHistogram, pmetric.MetricTypeSummary:
fallthrough
default:
panic(fmt.Sprintf("data type not supported: %s", metric.Type()))
}
Expand Down Expand Up @@ -115,6 +117,7 @@ func maskTimestamp(metrics pmetric.Metrics, ts pcommon.Timestamp) {
for l := 0; l < m.Summary().DataPoints().Len(); l++ {
m.Summary().DataPoints().At(l).SetTimestamp(ts)
}
case pmetric.MetricTypeEmpty:
}
}
}
Expand Down Expand Up @@ -157,6 +160,7 @@ func maskStartTimestamp(metrics pmetric.Metrics, ts pcommon.Timestamp) {
for l := 0; l < m.Summary().DataPoints().Len(); l++ {
m.Summary().DataPoints().At(l).SetStartTimestamp(ts)
}
case pmetric.MetricTypeEmpty:
}
}
}
Expand Down Expand Up @@ -226,6 +230,8 @@ func maskDataPointSliceAttributeValues(dataPoints pmetric.NumberDataPointSlice,
attribute.SetBool(false)
case pcommon.ValueTypeInt:
attribute.SetInt(0)
case pcommon.ValueTypeEmpty, pcommon.ValueTypeDouble, pcommon.ValueTypeMap, pcommon.ValueTypeSlice, pcommon.ValueTypeBytes:
fallthrough
default:
panic(fmt.Sprintf("data type not supported: %s", attribute.Type()))
}
Expand Down Expand Up @@ -397,6 +403,7 @@ func sortMetricDataPointSlices(ms pmetric.Metrics) {
sortExponentialHistogramDataPointSlice(m.ExponentialHistogram().DataPoints())
case pmetric.MetricTypeSummary:
sortSummaryDataPointSlice(m.Summary().DataPoints())
case pmetric.MetricTypeEmpty:
}
}
}
Expand Down

0 comments on commit bd8eae1

Please sign in to comment.