Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pkg/pdatatest] enable exhaustive lint #26105

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/pdatatest/pmetrictest/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ func CompareMetric(expected pmetric.Metric, actual pmetric.Metric) error {
return errs
}

//exhaustive:enforce
switch actual.Type() {
case pmetric.MetricTypeGauge:
errs = multierr.Append(errs, compareNumberDataPointSlices(expected.Gauge().DataPoints(),
Expand Down
4 changes: 4 additions & 0 deletions pkg/pdatatest/pmetrictest/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func maskMetricSliceValues(metrics pmetric.MetricSlice, metricNames ...string) {

func getDataPointSlice(metric pmetric.Metric) pmetric.NumberDataPointSlice {
var dataPointSlice pmetric.NumberDataPointSlice
//exhaustive:enforce
switch metric.Type() {
case pmetric.MetricTypeGauge:
dataPointSlice = metric.Gauge().DataPoints()
Expand Down Expand Up @@ -96,6 +97,7 @@ func maskTimestamp(metrics pmetric.Metrics, ts pcommon.Timestamp) {
for j := 0; j < rms.At(i).ScopeMetrics().Len(); j++ {
for k := 0; k < rms.At(i).ScopeMetrics().At(j).Metrics().Len(); k++ {
m := rms.At(i).ScopeMetrics().At(j).Metrics().At(k)
//exhaustive:enforce
switch m.Type() {
case pmetric.MetricTypeGauge:
for l := 0; l < m.Gauge().DataPoints().Len(); l++ {
Expand Down Expand Up @@ -139,6 +141,7 @@ func maskStartTimestamp(metrics pmetric.Metrics, ts pcommon.Timestamp) {
for j := 0; j < rms.At(i).ScopeMetrics().Len(); j++ {
for k := 0; k < rms.At(i).ScopeMetrics().At(j).Metrics().Len(); k++ {
m := rms.At(i).ScopeMetrics().At(j).Metrics().At(k)
//exhaustive:enforce
switch m.Type() {
case pmetric.MetricTypeGauge:
for l := 0; l < m.Gauge().DataPoints().Len(); l++ {
Expand Down Expand Up @@ -392,6 +395,7 @@ func sortMetricDataPointSlices(ms pmetric.Metrics) {
for j := 0; j < ms.ResourceMetrics().At(i).ScopeMetrics().Len(); j++ {
for k := 0; k < ms.ResourceMetrics().At(i).ScopeMetrics().At(j).Metrics().Len(); k++ {
m := ms.ResourceMetrics().At(i).ScopeMetrics().At(j).Metrics().At(k)
//exhaustive:enforce
switch m.Type() {
case pmetric.MetricTypeGauge:
sortNumberDataPointSlice(m.Gauge().DataPoints())
Expand Down
Loading