Skip to content

Commit 295f99c

Browse files
committed
fix(lint): replace deprecated golang.org/x/exp/rand with math/rand/v2
1 parent aa5f244 commit 295f99c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

plugins/processors/awsapplicationsignals/processor_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package awsapplicationsignals
66
import (
77
"context"
88
"fmt"
9+
"math/rand/v2"
910
"sync"
1011
"testing"
1112
"time"
@@ -14,7 +15,6 @@ import (
1415
"go.opentelemetry.io/collector/pdata/pmetric"
1516
"go.opentelemetry.io/collector/pdata/ptrace"
1617
"go.uber.org/zap"
17-
"golang.org/x/exp/rand"
1818

1919
"github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsapplicationsignals/common"
2020
"github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsapplicationsignals/config"
@@ -163,15 +163,15 @@ func TestProcessMetricsWithConcurrency(t *testing.T) {
163163
go func() {
164164
defer wg.Done()
165165

166-
time.Sleep(time.Duration(rand.Intn(50)*100) * time.Millisecond)
166+
time.Sleep(time.Duration(rand.IntN(50)*100) * time.Millisecond) //nolint:gosec
167167

168168
lowercaseMetrics := pmetric.NewMetrics()
169169
errorMetric := lowercaseMetrics.ResourceMetrics().AppendEmpty().ScopeMetrics().AppendEmpty().Metrics().AppendEmpty()
170170
errorMetric.SetName("error")
171171
errorGauge := errorMetric.SetEmptyGauge().DataPoints().AppendEmpty()
172172
errorGauge.SetIntValue(1)
173173
errorGauge.Attributes().PutStr("Telemetry.Source", "UnitTest")
174-
errorGauge.Attributes().PutStr(common.CWMetricAttributeLocalService, fmt.Sprintf("UnitTest%d", rand.Intn(200)))
174+
errorGauge.Attributes().PutStr(common.CWMetricAttributeLocalService, fmt.Sprintf("UnitTest%d", rand.IntN(200))) //nolint:gosec
175175
latencyMetric := lowercaseMetrics.ResourceMetrics().AppendEmpty().ScopeMetrics().AppendEmpty().Metrics().AppendEmpty()
176176
latencyMetric.SetName("latency")
177177
histogram := latencyMetric.SetEmptyExponentialHistogram().DataPoints().AppendEmpty()
@@ -180,12 +180,12 @@ func TestProcessMetricsWithConcurrency(t *testing.T) {
180180
histogram.SetMin(0)
181181
histogram.SetMax(1)
182182
histogram.Attributes().PutStr("Telemetry.Source", "UnitTest")
183-
histogram.Attributes().PutStr(common.CWMetricAttributeLocalService, fmt.Sprintf("UnitTest%d", rand.Intn(200)))
183+
histogram.Attributes().PutStr(common.CWMetricAttributeLocalService, fmt.Sprintf("UnitTest%d", rand.IntN(200))) //nolint:gosec
184184
faultMetric := lowercaseMetrics.ResourceMetrics().AppendEmpty().ScopeMetrics().AppendEmpty().Metrics().AppendEmpty()
185185
faultGauge := faultMetric.SetEmptyGauge().DataPoints().AppendEmpty()
186186
faultGauge.SetIntValue(1)
187187
faultGauge.Attributes().PutStr("Telemetry.Source", "UnitTest")
188-
faultGauge.Attributes().PutStr(common.CWMetricAttributeLocalService, fmt.Sprintf("UnitTest%d", rand.Intn(200)))
188+
faultGauge.Attributes().PutStr(common.CWMetricAttributeLocalService, fmt.Sprintf("UnitTest%d", rand.IntN(200))) //nolint:gosec
189189
faultMetric.SetName("fault")
190190

191191
ap.processMetrics(ctx, lowercaseMetrics)

0 commit comments

Comments
 (0)