From 37a4bf6c31df423c47ed9221e3120ea1e47496e0 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 14 Nov 2024 07:32:39 +0100 Subject: [PATCH] [chore]: enable gofumpt linter for internal Signed-off-by: Matthieu MOREL --- internal/aws/awsutil/conn.go | 10 ++-- internal/aws/awsutil/conn_test.go | 2 +- internal/aws/containerinsight/utils_test.go | 3 +- internal/aws/cwlogs/cwlog_client.go | 12 ++-- internal/aws/cwlogs/cwlog_client_test.go | 60 ++++++++++++------- internal/aws/cwlogs/pusher.go | 17 +++--- internal/aws/cwlogs/pusher_test.go | 10 +++- internal/aws/ecsutil/metadata_provider.go | 2 - internal/aws/k8s/k8sclient/helpers_test.go | 6 +- internal/aws/k8s/k8sclient/job.go | 3 +- internal/aws/k8s/k8sclient/replicaset.go | 3 +- internal/aws/proxy/conn.go | 1 - internal/aws/proxy/conn_test.go | 7 ++- internal/aws/xray/telemetry/nop_sender.go | 3 +- .../aws/xray/testdata/sampleapp/sample.go | 3 +- internal/aws/xray/xray_client.go | 8 ++- internal/common/docker/images.go | 4 +- internal/common/testutil/testutil_test.go | 1 + .../coreinternal/aggregateutil/aggregate.go | 12 ++-- .../attraction/attraction_test.go | 7 ++- .../goldendataset/traces_generator.go | 6 +- .../timeutils/internal/ctimefmt/ctimefmt.go | 8 ++- .../internal/ctimefmt/ctimefmt_test.go | 14 +++-- .../coreinternal/timeutils/parser_test.go | 20 +++---- internal/docker/matcher.go | 1 - internal/filter/filterset/config.go | 4 +- .../filterset/regexp/regexpfilterset_test.go | 22 ++++--- .../filterset/strict/strictfilterset_test.go | 12 ++-- internal/k8sconfig/config.go | 1 - internal/k8stest/client.go | 3 +- internal/kubelet/client_test.go | 8 ++- .../aws/ec2/metadata_test.go | 3 +- internal/otelarrow/admission2/boundedqueue.go | 6 +- internal/otelarrow/test/e2e_test.go | 22 +++---- internal/pdatautil/logs_test.go | 14 +++-- internal/splunk/common.go | 4 +- internal/sqlquery/scraper_test.go | 23 +++---- 37 files changed, 188 insertions(+), 157 deletions(-) diff --git a/internal/aws/awsutil/conn.go b/internal/aws/awsutil/conn.go index 820b03c75c38..32963e811128 100644 --- a/internal/aws/awsutil/conn.go +++ b/internal/aws/awsutil/conn.go @@ -45,7 +45,8 @@ const ( // newHTTPClient returns new HTTP client instance with provided configuration. func newHTTPClient(logger *zap.Logger, maxIdle int, requestTimeout int, noVerify bool, - proxyAddress string) (*http.Client, error) { + proxyAddress string, +) (*http.Client, error) { logger.Debug("Using proxy address: ", zap.String("proxyAddr", proxyAddress), ) @@ -206,7 +207,6 @@ func (c *Conn) newAWSSession(logger *zap.Logger, roleArn string, region string) s, err = session.NewSession(&aws.Config{ Credentials: stsCreds, }) - if err != nil { logger.Error("Error in creating session object : ", zap.Error(err)) return s, err @@ -245,7 +245,8 @@ func getSTSCreds(logger *zap.Logger, region string, roleArn string) (*credential // AWS STS recommends that you provide both the Region and endpoint when you make calls to a Regional endpoint. // Reference: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#id_credentials_temp_enable-regions_writing_code func getSTSCredsFromRegionEndpoint(logger *zap.Logger, sess *session.Session, region string, - roleArn string) *credentials.Credentials { + roleArn string, +) *credentials.Credentials { regionalEndpoint := getSTSRegionalEndpoint(region) // if regionalEndpoint is "", the STS endpoint is Global endpoint for classic regions except ap-east-1 - (HKG) // for other opt-in regions, region value will create STS regional endpoint. @@ -259,7 +260,8 @@ func getSTSCredsFromRegionEndpoint(logger *zap.Logger, sess *session.Session, re // getSTSCredsFromPrimaryRegionEndpoint fetches STS credentials for provided roleARN from primary region endpoint in // the respective partition. func getSTSCredsFromPrimaryRegionEndpoint(logger *zap.Logger, t *session.Session, roleArn string, - region string) *credentials.Credentials { + region string, +) *credentials.Credentials { logger.Info("Credentials for provided RoleARN being fetched from STS primary region endpoint.") partitionID := getPartition(region) switch partitionID { diff --git a/internal/aws/awsutil/conn_test.go b/internal/aws/awsutil/conn_test.go index 363b5ac5ec49..5946b36ff2b8 100644 --- a/internal/aws/awsutil/conn_test.go +++ b/internal/aws/awsutil/conn_test.go @@ -58,7 +58,7 @@ func TestRegionEnv(t *testing.T) { region := "us-east-1" t.Setenv("AWS_REGION", region) - var m = &mockConn{} + m := &mockConn{} var expectedSession *session.Session expectedSession, _ = session.NewSession() m.sn = expectedSession diff --git a/internal/aws/containerinsight/utils_test.go b/internal/aws/containerinsight/utils_test.go index e1fe4df48c2c..0a702d7f5d76 100644 --- a/internal/aws/containerinsight/utils_test.go +++ b/internal/aws/containerinsight/utils_test.go @@ -132,7 +132,8 @@ func convertToFloat64(value any) float64 { } func checkMetricsAreExpected(t *testing.T, md pmetric.Metrics, fields map[string]any, tags map[string]string, - expectedUnits map[string]string) { + expectedUnits map[string]string, +) { rms := md.ResourceMetrics() assert.Equal(t, 1, rms.Len()) diff --git a/internal/aws/cwlogs/cwlog_client.go b/internal/aws/cwlogs/cwlog_client.go index 106aca07390a..a8a17e243b52 100644 --- a/internal/aws/cwlogs/cwlog_client.go +++ b/internal/aws/cwlogs/cwlog_client.go @@ -26,9 +26,7 @@ const ( errCodeThrottlingException = "ThrottlingException" ) -var ( - containerInsightsRegexPattern = regexp.MustCompile(`^/aws/.*containerinsights/.*/(performance|prometheus)$`) -) +var containerInsightsRegexPattern = regexp.MustCompile(`^/aws/.*containerinsights/.*/(performance|prometheus)$`) // Possible exceptions are combination of common errors (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/CommonErrors.html) // and API specific erros (e.g. https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html#API_PutLogEvents_Errors) @@ -53,10 +51,12 @@ func WithUserAgentExtras(userAgentExtras ...string) ClientOption { // Create a log client based on the actual cloudwatch logs client. func newCloudWatchLogClient(svc cloudwatchlogsiface.CloudWatchLogsAPI, logRetention int64, tags map[string]*string, logger *zap.Logger) *Client { - logClient := &Client{svc: svc, + logClient := &Client{ + svc: svc, logRetention: logRetention, tags: tags, - logger: logger} + logger: logger, + } return logClient } @@ -124,7 +124,7 @@ func (client *Client) PutLogEvents(input *cloudwatchlogs.PutLogEventsInput, retr } } - //TODO: Should have metrics to provide visibility of these failures + // TODO: Should have metrics to provide visibility of these failures if response != nil { if response.RejectedLogEventsInfo != nil { rejectedLogEventsInfo := response.RejectedLogEventsInfo diff --git a/internal/aws/cwlogs/cwlog_client_test.go b/internal/aws/cwlogs/cwlog_client_test.go index 2832251e47e4..b3d430c2e5c9 100644 --- a/internal/aws/cwlogs/cwlog_client_test.go +++ b/internal/aws/cwlogs/cwlog_client_test.go @@ -27,7 +27,8 @@ func newAlwaysPassMockLogClient(putLogEventsFunc func(args mock.Arguments)) *Cli svc.On("PutLogEvents", mock.Anything).Return( &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken}, + NextSequenceToken: &expectedNextSequenceToken, + }, nil).Run(putLogEventsFunc) svc.On("CreateLogGroup", mock.Anything).Return(new(cloudwatchlogs.CreateLogGroupOutput), nil) @@ -36,7 +37,8 @@ func newAlwaysPassMockLogClient(putLogEventsFunc func(args mock.Arguments)) *Cli svc.On("DescribeLogStreams", mock.Anything).Return( &cloudwatchlogs.DescribeLogStreamsOutput{ - LogStreams: []*cloudwatchlogs.LogStream{{UploadSequenceToken: &expectedNextSequenceToken}}}, + LogStreams: []*cloudwatchlogs.LogStream{{UploadSequenceToken: &expectedNextSequenceToken}}, + }, nil) return newCloudWatchLogClient(svc, 0, nil, logger) } @@ -77,11 +79,13 @@ func (svc *mockCloudWatchLogsClient) TagResource(input *cloudwatchlogs.TagResour } // Tests -var previousSequenceToken = "0000" -var expectedNextSequenceToken = "1111" -var logGroup = "logGroup" -var logStreamName = "logStream" -var emptySequenceToken = "" +var ( + previousSequenceToken = "0000" + expectedNextSequenceToken = "1111" + logGroup = "logGroup" + logStreamName = "logStream" + emptySequenceToken = "" +) func TestPutLogEvents_HappyCase(t *testing.T) { logger := zap.NewNop() @@ -92,7 +96,8 @@ func TestPutLogEvents_HappyCase(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, nil) @@ -114,7 +119,8 @@ func TestPutLogEvents_HappyCase_SomeRejectedInfo(t *testing.T) { rejectedLogEventsInfo := &cloudwatchlogs.RejectedLogEventsInfo{ ExpiredLogEventEndIndex: aws.Int64(1), TooNewLogEventStartIndex: aws.Int64(2), - TooOldLogEventEndIndex: aws.Int64(3)} + TooOldLogEventEndIndex: aws.Int64(3), + } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ NextSequenceToken: &expectedNextSequenceToken, RejectedLogEventsInfo: rejectedLogEventsInfo, @@ -138,7 +144,8 @@ func TestPutLogEvents_NonAWSError(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, errors.New("some random error")).Once() @@ -158,7 +165,8 @@ func TestPutLogEvents_InvalidParameterException(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } invalidParameterException := &cloudwatchlogs.InvalidParameterException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, invalidParameterException).Once() @@ -179,7 +187,8 @@ func TestPutLogEvents_OperationAbortedException(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } operationAbortedException := &cloudwatchlogs.OperationAbortedException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, operationAbortedException).Once() @@ -200,7 +209,8 @@ func TestPutLogEvents_ServiceUnavailableException(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } serviceUnavailableException := &cloudwatchlogs.ServiceUnavailableException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, serviceUnavailableException).Once() @@ -221,7 +231,8 @@ func TestPutLogEvents_UnknownException(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } unknownException := awserr.New("unknownException", "", nil) svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, unknownException).Once() @@ -242,7 +253,8 @@ func TestPutLogEvents_ThrottlingException(t *testing.T) { SequenceToken: &previousSequenceToken, } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } throttlingException := awserr.New(errCodeThrottlingException, "", nil) svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, throttlingException).Once() @@ -264,7 +276,8 @@ func TestPutLogEvents_ResourceNotFoundException(t *testing.T) { } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } awsErr := &cloudwatchlogs.ResourceNotFoundException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, awsErr).Once() @@ -291,7 +304,8 @@ func TestLogRetention_NeverExpire(t *testing.T) { } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } awsErr := &cloudwatchlogs.ResourceNotFoundException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, awsErr).Once() @@ -326,7 +340,8 @@ func TestLogRetention_RetentionDaysInputted(t *testing.T) { } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } awsErr := &cloudwatchlogs.ResourceNotFoundException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, awsErr).Once() @@ -362,7 +377,8 @@ func TestSetTags_NotCalled(t *testing.T) { } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } awsErr := &cloudwatchlogs.ResourceNotFoundException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, awsErr).Once() @@ -397,7 +413,8 @@ func TestSetTags_Called(t *testing.T) { } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: &expectedNextSequenceToken} + NextSequenceToken: &expectedNextSequenceToken, + } awsErr := &cloudwatchlogs.ResourceNotFoundException{} avalue := "avalue" @@ -433,7 +450,8 @@ func TestPutLogEvents_AllRetriesFail(t *testing.T) { } putLogEventsOutput := &cloudwatchlogs.PutLogEventsOutput{ - NextSequenceToken: nil} + NextSequenceToken: nil, + } awsErr := &cloudwatchlogs.ResourceNotFoundException{} svc.On("PutLogEvents", putLogEventsInput).Return(putLogEventsOutput, awsErr).Twice() diff --git a/internal/aws/cwlogs/pusher.go b/internal/aws/cwlogs/pusher.go index 93c68222e943..af8417dc8aab 100644 --- a/internal/aws/cwlogs/pusher.go +++ b/internal/aws/cwlogs/pusher.go @@ -29,9 +29,7 @@ const ( evenTimestampLimitInFuture = -2 * time.Hour // None of the log events in the batch can be more than 2 hours in the future. ) -var ( - maxEventPayloadBytes = defaultMaxEventPayloadBytes -) +var maxEventPayloadBytes = defaultMaxEventPayloadBytes // Event struct to present a log event. type Event struct { @@ -48,7 +46,8 @@ func NewEvent(timestampMs int64, message string) *Event { event := &Event{ InputLogEvent: &cloudwatchlogs.InputLogEvent{ Timestamp: aws.Int64(timestampMs), - Message: aws.String(message)}, + Message: aws.String(message), + }, } return event } @@ -115,7 +114,8 @@ func newEventBatch(key StreamKey) *eventBatch { putLogEventsInput: &cloudwatchlogs.PutLogEventsInput{ LogGroupName: aws.String(key.LogGroupName), LogStreamName: aws.String(key.LogStreamName), - LogEvents: make([]*cloudwatchlogs.InputLogEvent, 0, maxRequestEventCount)}, + LogEvents: make([]*cloudwatchlogs.InputLogEvent, 0, maxRequestEventCount), + }, } } @@ -194,7 +194,8 @@ type logPusher struct { // NewPusher creates a logPusher instance func NewPusher(streamKey StreamKey, retryCnt int, - svcStructuredLog Client, logger *zap.Logger) Pusher { + svcStructuredLog Client, logger *zap.Logger, +) Pusher { pusher := newLogPusher(streamKey, svcStructuredLog, logger) pusher.retryCnt = defaultRetryCount @@ -207,7 +208,8 @@ func NewPusher(streamKey StreamKey, retryCnt int, // Only create a logPusher, but not start the instance. func newLogPusher(streamKey StreamKey, - svcStructuredLog Client, logger *zap.Logger) *logPusher { + svcStructuredLog Client, logger *zap.Logger, +) *logPusher { pusher := &logPusher{ logGroupName: aws.String(streamKey.LogGroupName), logStreamName: aws.String(streamKey.LogStreamName), @@ -260,7 +262,6 @@ func (p *logPusher) pushEventBatch(req any) error { startTime := time.Now() err := p.svcStructuredLog.PutLogEvents(putLogEventsInput, p.retryCnt) - if err != nil { return err } diff --git a/internal/aws/cwlogs/pusher_test.go b/internal/aws/cwlogs/pusher_test.go index 5ba30bba0349..46249cc35515 100644 --- a/internal/aws/cwlogs/pusher_test.go +++ b/internal/aws/cwlogs/pusher_test.go @@ -83,7 +83,9 @@ func TestLogEventBatch_sortLogEvents(t *testing.T) { totalEvents := 10 logEventBatch := &eventBatch{ putLogEventsInput: &cloudwatchlogs.PutLogEventsInput{ - LogEvents: make([]*cloudwatchlogs.InputLogEvent, 0, totalEvents)}} + LogEvents: make([]*cloudwatchlogs.InputLogEvent, 0, totalEvents), + }, + } for i := 0; i < totalEvents; i++ { timestamp := rand.Int() @@ -120,8 +122,10 @@ func newMockPusher() *logPusher { // pusher Tests // -var timestampMs = time.Now().UnixNano() / 1e6 -var msg = "test log message" +var ( + timestampMs = time.Now().UnixNano() / 1e6 + msg = "test log message" +) func TestPusher_newLogEventBatch(t *testing.T) { p := newMockPusher() diff --git a/internal/aws/ecsutil/metadata_provider.go b/internal/aws/ecsutil/metadata_provider.go index 3968d88868ed..75698eedd26b 100644 --- a/internal/aws/ecsutil/metadata_provider.go +++ b/internal/aws/ecsutil/metadata_provider.go @@ -64,7 +64,6 @@ func (md *ecsMetadataProviderImpl) FetchTaskMetadata() (*TaskMetadata, error) { taskMetadata := &TaskMetadata{} err = json.NewDecoder(bytes.NewReader(resp)).Decode(taskMetadata) - if err != nil { return nil, fmt.Errorf("encountered unexpected error reading response from ECS Task Metadata Endpoint: %w", err) } @@ -82,7 +81,6 @@ func (md *ecsMetadataProviderImpl) FetchContainerMetadata() (*ContainerMetadata, containerMetadata := &ContainerMetadata{} err = json.NewDecoder(bytes.NewReader(resp)).Decode(containerMetadata) - if err != nil { return nil, fmt.Errorf("encountered unexpected error reading response from ECS Container Metadata Endpoint: %w", err) } diff --git a/internal/aws/k8s/k8sclient/helpers_test.go b/internal/aws/k8s/k8sclient/helpers_test.go index cce65edac1f5..fe15f1544cc6 100644 --- a/internal/aws/k8s/k8sclient/helpers_test.go +++ b/internal/aws/k8s/k8sclient/helpers_test.go @@ -10,11 +10,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) -type mockReflectorSyncChecker struct { -} +type mockReflectorSyncChecker struct{} func (m *mockReflectorSyncChecker) Check(_ cacheReflector, _ string) { - } var kubeConfigPath string @@ -54,7 +52,7 @@ users: if err != nil { t.Error(err) } - if err := os.WriteFile(tmpfile.Name(), []byte(content), 0600); err != nil { + if err := os.WriteFile(tmpfile.Name(), []byte(content), 0o600); err != nil { t.Error(err) } // overwrite the default kube config path diff --git a/internal/aws/k8s/k8sclient/job.go b/internal/aws/k8s/k8sclient/job.go index 3076e3546433..b565482285bd 100644 --- a/internal/aws/k8s/k8sclient/job.go +++ b/internal/aws/k8s/k8sclient/job.go @@ -27,8 +27,7 @@ type JobClient interface { JobToCronJob() map[string]string } -type noOpJobClient struct { -} +type noOpJobClient struct{} func (nc *noOpJobClient) JobToCronJob() map[string]string { return map[string]string{} diff --git a/internal/aws/k8s/k8sclient/replicaset.go b/internal/aws/k8s/k8sclient/replicaset.go index cfa73d773e67..7d911c6a6532 100644 --- a/internal/aws/k8s/k8sclient/replicaset.go +++ b/internal/aws/k8s/k8sclient/replicaset.go @@ -27,8 +27,7 @@ type ReplicaSetClient interface { ReplicaSetToDeployment() map[string]string } -type noOpReplicaSetClient struct { -} +type noOpReplicaSetClient struct{} func (nc *noOpReplicaSetClient) ReplicaSetToDeployment() map[string]string { return map[string]string{} diff --git a/internal/aws/proxy/conn.go b/internal/aws/proxy/conn.go index e0e850428b10..c9eb13f2e34a 100644 --- a/internal/aws/proxy/conn.go +++ b/internal/aws/proxy/conn.go @@ -60,7 +60,6 @@ var newAWSSession = func(roleArn string, region string, log *zap.Logger) (*sessi sess, err := session.NewSession(&aws.Config{ Credentials: stsCreds, }) - if err != nil { return nil, err } diff --git a/internal/aws/proxy/conn_test.go b/internal/aws/proxy/conn_test.go index 97584a897205..6be4d76f6655 100644 --- a/internal/aws/proxy/conn_test.go +++ b/internal/aws/proxy/conn_test.go @@ -43,7 +43,8 @@ func logSetup() (*zap.Logger, *observer.ObservedLogs) { } func setupMock(sess *session.Session) (f1 func(s *session.Session) (string, error), - f2 func(roleArn string, region string, logger *zap.Logger) (*session.Session, error)) { + f2 func(roleArn string, region string, logger *zap.Logger) (*session.Session, error), +) { f1 = getEC2Region f2 = newAWSSession m := mock{sn: sess} @@ -399,8 +400,7 @@ func TestGetSTSCredsFromPrimaryRegionEndpoint(t *testing.T) { "expected error message") } -type mockAWSErr struct { -} +type mockAWSErr struct{} func (m *mockAWSErr) Error() string { return "mockAWSErr" @@ -433,6 +433,7 @@ func (m *mockProvider) Retrieve() (credentials.Value, error) { func (m *mockProvider) IsExpired() bool { return true } + func TestSTSRegionalEndpointDisabled(t *testing.T) { logger, recordedLogs := logSetup() diff --git a/internal/aws/xray/telemetry/nop_sender.go b/internal/aws/xray/telemetry/nop_sender.go index c87ac6edcaf5..698967e99657 100644 --- a/internal/aws/xray/telemetry/nop_sender.go +++ b/internal/aws/xray/telemetry/nop_sender.go @@ -12,8 +12,7 @@ func NewNopSender() Sender { var nopSenderInstance Sender = &nopSender{} -type nopSender struct { -} +type nopSender struct{} func (n nopSender) Rotate() *xray.TelemetryRecord { return nil diff --git a/internal/aws/xray/testdata/sampleapp/sample.go b/internal/aws/xray/testdata/sampleapp/sample.go index ab0bd311dd7d..7510a660dddc 100644 --- a/internal/aws/xray/testdata/sampleapp/sample.go +++ b/internal/aws/xray/testdata/sampleapp/sample.go @@ -28,7 +28,8 @@ type Record struct { func main() { dynamo = dynamodb.New(session.Must(session.NewSession( &aws.Config{ - Region: aws.String("us-west-2")}, + Region: aws.String("us-west-2"), + }, ))) xray.AWS(dynamo.Client) diff --git a/internal/aws/xray/xray_client.go b/internal/aws/xray/xray_client.go index adb8d0ba7262..072d267a0c5c 100644 --- a/internal/aws/xray/xray_client.go +++ b/internal/aws/xray/xray_client.go @@ -20,9 +20,11 @@ import ( ) // Constant prefixes used to identify information in user-agent -const agentPrefix = "xray-otel-exporter/" -const execEnvPrefix = " exec-env/" -const osPrefix = " OS/" +const ( + agentPrefix = "xray-otel-exporter/" + execEnvPrefix = " exec-env/" + osPrefix = " OS/" +) // XRayClient represents X-Ray client. type XRayClient interface { diff --git a/internal/common/docker/images.go b/internal/common/docker/images.go index 8e5b3353f071..b97c35aa8aee 100644 --- a/internal/common/docker/images.go +++ b/internal/common/docker/images.go @@ -10,9 +10,7 @@ import ( "go.uber.org/zap" ) -var ( - extractImageRegexp = regexp.MustCompile(`^(?P([^/\s]+/)?([^:\s]+))(:(?P[^@\s]+))?(@sha256:(?P\d+))?$`) -) +var extractImageRegexp = regexp.MustCompile(`^(?P([^/\s]+/)?([^:\s]+))(:(?P[^@\s]+))?(@sha256:(?P\d+))?$`) type ImageRef struct { Repository string diff --git a/internal/common/testutil/testutil_test.go b/internal/common/testutil/testutil_test.go index 2f662ca8afc1..0b43ad8407a6 100644 --- a/internal/common/testutil/testutil_test.go +++ b/internal/common/testutil/testutil_test.go @@ -26,6 +26,7 @@ func TestGetAvailableLocalAddress(t *testing.T) { require.Error(t, err) require.Nil(t, ln1) } + func TestGetAvailableLocalUDPAddress(t *testing.T) { addr := GetAvailableLocalNetworkAddress(t, "udp") // Endpoint should be free. diff --git a/internal/coreinternal/aggregateutil/aggregate.go b/internal/coreinternal/aggregateutil/aggregate.go index 0cd986a33037..198ca09bee0f 100644 --- a/internal/coreinternal/aggregateutil/aggregate.go +++ b/internal/coreinternal/aggregateutil/aggregate.go @@ -283,7 +283,8 @@ func mergeHistogramDataPoints(dpsMap map[string]pmetric.HistogramDataPointSlice, } func mergeExponentialHistogramDataPoints(dpsMap map[string]pmetric.ExponentialHistogramDataPointSlice, - to pmetric.ExponentialHistogramDataPointSlice) { + to pmetric.ExponentialHistogramDataPointSlice, +) { for _, dps := range dpsMap { dp := to.AppendEmpty() dps.At(0).MoveTo(dp) @@ -316,7 +317,8 @@ func mergeExponentialHistogramDataPoints(dpsMap map[string]pmetric.ExponentialHi } func groupNumberDataPoints(dps pmetric.NumberDataPointSlice, useStartTime bool, - dpsByAttrsAndTs map[string]pmetric.NumberDataPointSlice) { + dpsByAttrsAndTs map[string]pmetric.NumberDataPointSlice, +) { var keyHashParts []any for i := 0; i < dps.Len(); i++ { if useStartTime { @@ -331,7 +333,8 @@ func groupNumberDataPoints(dps pmetric.NumberDataPointSlice, useStartTime bool, } func groupHistogramDataPoints(dps pmetric.HistogramDataPointSlice, useStartTime bool, - dpsByAttrsAndTs map[string]pmetric.HistogramDataPointSlice) { + dpsByAttrsAndTs map[string]pmetric.HistogramDataPointSlice, +) { for i := 0; i < dps.Len(); i++ { dp := dps.At(i) keyHashParts := make([]any, 0, dp.ExplicitBounds().Len()+4) @@ -352,7 +355,8 @@ func groupHistogramDataPoints(dps pmetric.HistogramDataPointSlice, useStartTime } func groupExponentialHistogramDataPoints(dps pmetric.ExponentialHistogramDataPointSlice, useStartTime bool, - dpsByAttrsAndTs map[string]pmetric.ExponentialHistogramDataPointSlice) { + dpsByAttrsAndTs map[string]pmetric.ExponentialHistogramDataPointSlice, +) { for i := 0; i < dps.Len(); i++ { dp := dps.At(i) keyHashParts := make([]any, 0, 5) diff --git a/internal/coreinternal/attraction/attraction_test.go b/internal/coreinternal/attraction/attraction_test.go index a107462efed2..6d2b3cbe5441 100644 --- a/internal/coreinternal/attraction/attraction_test.go +++ b/internal/coreinternal/attraction/attraction_test.go @@ -400,7 +400,6 @@ func TestAttributes_Extract(t *testing.T) { cfg := &Settings{ Actions: []ActionKeyValue{ - {Key: "user_key", RegexPattern: "^\\/api\\/v1\\/document\\/(?P.*)\\/update\\/(?P.*)$", Action: EXTRACT}, }, } @@ -853,7 +852,8 @@ func TestInvalidConfig(t *testing.T) { }, errorString: "error creating AttrProc due to missing required field \"pattern\" for action \"extract\" at the 0-th action", }, - {name: "set value for extract", + { + name: "set value for extract", actionLists: []ActionKeyValue{ {Key: "Key", RegexPattern: "(?P.*?)$", Value: "value", Action: EXTRACT}, }, @@ -915,7 +915,8 @@ func TestValidConfiguration(t *testing.T) { compiledRegex := regexp.MustCompile(`^\/api\/v1\/document\/(?P.*)\/update$`) assert.Equal(t, []attributeAction{ {Key: "one", Action: DELETE}, - {Key: "two", Action: INSERT, + { + Key: "two", Action: INSERT, AttributeValue: &av, }, {Key: "three", FromAttribute: "two", Action: UPDATE}, diff --git a/internal/coreinternal/goldendataset/traces_generator.go b/internal/coreinternal/goldendataset/traces_generator.go index cc4a8baf439d..ebb093c0d636 100644 --- a/internal/coreinternal/goldendataset/traces_generator.go +++ b/internal/coreinternal/goldendataset/traces_generator.go @@ -50,7 +50,8 @@ func GenerateTraces(tracePairsFile string, spanPairsFile string) ([]ptrace.Trace // // The generated resource spans. If err is not nil, some or all of the resource spans fields will be nil. func appendResourceSpan(tracingInputs *PICTTracingInputs, spanPairsFile string, - random io.Reader, resourceSpansSlice ptrace.ResourceSpansSlice) error { + random io.Reader, resourceSpansSlice ptrace.ResourceSpansSlice, +) error { resourceSpan := resourceSpansSlice.AppendEmpty() err := appendScopeSpans(tracingInputs, spanPairsFile, random, resourceSpan.ScopeSpans()) if err != nil { @@ -61,7 +62,8 @@ func appendResourceSpan(tracingInputs *PICTTracingInputs, spanPairsFile string, } func appendScopeSpans(tracingInputs *PICTTracingInputs, spanPairsFile string, - random io.Reader, scopeSpansSlice ptrace.ScopeSpansSlice) error { + random io.Reader, scopeSpansSlice ptrace.ScopeSpansSlice, +) error { var count int switch tracingInputs.InstrumentationLibrary { case LibraryNone: diff --git a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go index 921ebdc8c3c1..adb0c5dded54 100644 --- a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go +++ b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go @@ -16,9 +16,11 @@ import ( "time" ) -var ctimeRegexp = regexp.MustCompile(`%.`) -var invalidFractionalSecondsStrptime = regexp.MustCompile(`[^.,]%[Lfs]`) -var decimalsRegexp = regexp.MustCompile(`\d`) +var ( + ctimeRegexp = regexp.MustCompile(`%.`) + invalidFractionalSecondsStrptime = regexp.MustCompile(`[^.,]%[Lfs]`) + decimalsRegexp = regexp.MustCompile(`\d`) +) var ctimeSubstitutes = map[string]string{ "%Y": "2006", diff --git a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go index 6605ec424d24..6e80091d6a5c 100644 --- a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go +++ b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go @@ -16,12 +16,14 @@ import ( "github.com/stretchr/testify/require" ) -var format1 = "%Y-%m-%d %H:%M:%S.%f" -var format2 = "%Y-%m-%d %l:%M:%S.%L %P, %a" -var value1 = "2019-01-02 15:04:05.666666" -var value2 = "2019-01-02 3:04:05.666 pm, Wed" -var dt1 = time.Date(2019, 1, 2, 15, 4, 5, 666666000, time.UTC) -var dt2 = time.Date(2019, 1, 2, 15, 4, 5, 666000000, time.UTC) +var ( + format1 = "%Y-%m-%d %H:%M:%S.%f" + format2 = "%Y-%m-%d %l:%M:%S.%L %P, %a" + value1 = "2019-01-02 15:04:05.666666" + value2 = "2019-01-02 3:04:05.666 pm, Wed" + dt1 = time.Date(2019, 1, 2, 15, 4, 5, 666666000, time.UTC) + dt2 = time.Date(2019, 1, 2, 15, 4, 5, 666000000, time.UTC) +) func TestFormat(t *testing.T) { s, err := Format(format1, dt1) diff --git a/internal/coreinternal/timeutils/parser_test.go b/internal/coreinternal/timeutils/parser_test.go index 80d572ef2c70..256154c30332 100644 --- a/internal/coreinternal/timeutils/parser_test.go +++ b/internal/coreinternal/timeutils/parser_test.go @@ -19,40 +19,40 @@ func TestParseGoTimeBadLocation(t *testing.T) { func Test_setTimestampYear(t *testing.T) { t.Run("Normal", func(t *testing.T) { Now = func() time.Time { - return time.Date(2020, 06, 16, 3, 31, 34, 525, time.UTC) + return time.Date(2020, 0o6, 16, 3, 31, 34, 525, time.UTC) } - noYear := time.Date(0, 06, 16, 3, 31, 34, 525, time.UTC) + noYear := time.Date(0, 0o6, 16, 3, 31, 34, 525, time.UTC) yearAdded := SetTimestampYear(noYear) - expected := time.Date(2020, 06, 16, 3, 31, 34, 525, time.UTC) + expected := time.Date(2020, 0o6, 16, 3, 31, 34, 525, time.UTC) require.Equal(t, expected, yearAdded) }) t.Run("FutureOneDay", func(t *testing.T) { Now = func() time.Time { - return time.Date(2020, 01, 16, 3, 31, 34, 525, time.UTC) + return time.Date(2020, 0o1, 16, 3, 31, 34, 525, time.UTC) } - noYear := time.Date(0, 01, 17, 3, 31, 34, 525, time.UTC) + noYear := time.Date(0, 0o1, 17, 3, 31, 34, 525, time.UTC) yearAdded := SetTimestampYear(noYear) - expected := time.Date(2020, 01, 17, 3, 31, 34, 525, time.UTC) + expected := time.Date(2020, 0o1, 17, 3, 31, 34, 525, time.UTC) require.Equal(t, expected, yearAdded) }) t.Run("FutureEightDays", func(t *testing.T) { Now = func() time.Time { - return time.Date(2020, 01, 16, 3, 31, 34, 525, time.UTC) + return time.Date(2020, 0o1, 16, 3, 31, 34, 525, time.UTC) } - noYear := time.Date(0, 01, 24, 3, 31, 34, 525, time.UTC) + noYear := time.Date(0, 0o1, 24, 3, 31, 34, 525, time.UTC) yearAdded := SetTimestampYear(noYear) - expected := time.Date(2019, 01, 24, 3, 31, 34, 525, time.UTC) + expected := time.Date(2019, 0o1, 24, 3, 31, 34, 525, time.UTC) require.Equal(t, expected, yearAdded) }) t.Run("RolloverYear", func(t *testing.T) { Now = func() time.Time { - return time.Date(2020, 01, 01, 3, 31, 34, 525, time.UTC) + return time.Date(2020, 0o1, 0o1, 3, 31, 34, 525, time.UTC) } noYear := time.Date(0, 12, 31, 3, 31, 34, 525, time.UTC) diff --git a/internal/docker/matcher.go b/internal/docker/matcher.go index c0c14911a337..e54e9c75773f 100644 --- a/internal/docker/matcher.go +++ b/internal/docker/matcher.go @@ -56,7 +56,6 @@ func newStringMatcher(items []string) (*stringMatcher, error) { // by definition this must lead and end with '/' chars reText := item[1 : len(item)-1] re, err = regexp.Compile(reText) - if err != nil { return nil, fmt.Errorf("invalid regex item: %w", err) } diff --git a/internal/filter/filterset/config.go b/internal/filter/filterset/config.go index 7a60b641651e..f6c6c757d549 100644 --- a/internal/filter/filterset/config.go +++ b/internal/filter/filterset/config.go @@ -22,9 +22,7 @@ const ( MatchTypeFieldName = "match_type" ) -var ( - validMatchTypes = []MatchType{Regexp, Strict} -) +var validMatchTypes = []MatchType{Regexp, Strict} // Config configures the matching behavior of a FilterSet. type Config struct { diff --git a/internal/filter/filterset/regexp/regexpfilterset_test.go b/internal/filter/filterset/regexp/regexpfilterset_test.go index 6e8dfbf4ff6e..b6e87d15fde7 100644 --- a/internal/filter/filterset/regexp/regexpfilterset_test.go +++ b/internal/filter/filterset/regexp/regexpfilterset_test.go @@ -10,18 +10,16 @@ import ( "github.com/stretchr/testify/require" ) -var ( - validRegexpFilters = []string{ - "prefix/.*", - "prefix_.*", - ".*/suffix", - ".*_suffix", - ".*/contains/.*", - ".*_contains_.*", - "full/name/match", - "full_name_match", - } -) +var validRegexpFilters = []string{ + "prefix/.*", + "prefix_.*", + ".*/suffix", + ".*_suffix", + ".*/contains/.*", + ".*_contains_.*", + "full/name/match", + "full_name_match", +} func TestNewRegexpFilterSet(t *testing.T) { tests := []struct { diff --git a/internal/filter/filterset/strict/strictfilterset_test.go b/internal/filter/filterset/strict/strictfilterset_test.go index 63317917c534..9947b58971fa 100644 --- a/internal/filter/filterset/strict/strictfilterset_test.go +++ b/internal/filter/filterset/strict/strictfilterset_test.go @@ -9,13 +9,11 @@ import ( "github.com/stretchr/testify/assert" ) -var ( - validStrictFilters = []string{ - "exact_string_match", - ".*/suffix", - "(a|b)", - } -) +var validStrictFilters = []string{ + "exact_string_match", + ".*/suffix", + "(a|b)", +} func TestNewStrictFilterSet(t *testing.T) { tests := []struct { diff --git a/internal/k8sconfig/config.go b/internal/k8sconfig/config.go index 8d57fef8709d..d3391166762d 100644 --- a/internal/k8sconfig/config.go +++ b/internal/k8sconfig/config.go @@ -101,7 +101,6 @@ func CreateRestConfig(apiConf APIConfig) (*rest.Config, error) { } authConf, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig( loadingRules, configOverrides).ClientConfig() - if err != nil { return nil, fmt.Errorf("error connecting to k8s with auth_type=%s: %w", AuthTypeKubeConfig, err) } diff --git a/internal/k8stest/client.go b/internal/k8stest/client.go index 787cd5f7a81a..3de4092c4d51 100644 --- a/internal/k8stest/client.go +++ b/internal/k8stest/client.go @@ -41,5 +41,6 @@ func NewK8sClient(kubeconfigPath string) (*K8sClient, error) { mapper := restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(discoveryClient)) return &K8sClient{ - DynamicClient: dynamicClient, DiscoveryClient: discoveryClient, Mapper: mapper}, nil + DynamicClient: dynamicClient, DiscoveryClient: discoveryClient, Mapper: mapper, + }, nil } diff --git a/internal/kubelet/client_test.go b/internal/kubelet/client_test.go index f1ac1be5b478..a177e3404361 100644 --- a/internal/kubelet/client_test.go +++ b/internal/kubelet/client_test.go @@ -28,9 +28,11 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig" ) -const certPath = "./testdata/testcert.crt" -const keyFile = "./testdata/testkey.key" -const errSignedByUnknownCA = "tls: failed to verify certificate: x509: certificate signed by unknown authority" +const ( + certPath = "./testdata/testcert.crt" + keyFile = "./testdata/testkey.key" + errSignedByUnknownCA = "tls: failed to verify certificate: x509: certificate signed by unknown authority" +) func TestClient(t *testing.T) { tr := &fakeRoundTripper{} diff --git a/internal/metadataproviders/aws/ec2/metadata_test.go b/internal/metadataproviders/aws/ec2/metadata_test.go index 39fb4c43f0a1..1cdb0f53c497 100644 --- a/internal/metadataproviders/aws/ec2/metadata_test.go +++ b/internal/metadataproviders/aws/ec2/metadata_test.go @@ -39,8 +39,7 @@ func TestMetadataProviderGetError(t *testing.T) { } func TestMetadataProvider_available(t *testing.T) { - type fields struct { - } + type fields struct{} type args struct { ctx context.Context sess *session.Session diff --git a/internal/otelarrow/admission2/boundedqueue.go b/internal/otelarrow/admission2/boundedqueue.go index e0cd95e3bb2c..026ad341c317 100644 --- a/internal/otelarrow/admission2/boundedqueue.go +++ b/internal/otelarrow/admission2/boundedqueue.go @@ -15,8 +15,10 @@ import ( "google.golang.org/grpc/status" ) -var ErrTooMuchWaiting = status.Error(grpccodes.ResourceExhausted, "rejecting request, too much pending data") -var ErrRequestTooLarge = status.Errorf(grpccodes.InvalidArgument, "rejecting request, request is too large") +var ( + ErrTooMuchWaiting = status.Error(grpccodes.ResourceExhausted, "rejecting request, too much pending data") + ErrRequestTooLarge = status.Errorf(grpccodes.InvalidArgument, "rejecting request, request is too large") +) // BoundedQueue is a LIFO-oriented admission-controlled Queue. type BoundedQueue struct { diff --git a/internal/otelarrow/test/e2e_test.go b/internal/otelarrow/test/e2e_test.go index 348956d2d681..9c5f75d64da0 100644 --- a/internal/otelarrow/test/e2e_test.go +++ b/internal/otelarrow/test/e2e_test.go @@ -78,13 +78,15 @@ type testConsumer struct { var _ consumer.Traces = &testConsumer{} -type ExpConfig = otelarrowexporter.Config -type RecvConfig = otelarrowreceiver.Config -type CfgFunc func(*ExpConfig, *RecvConfig) -type GenFunc func(int) ptrace.Traces -type MkGen func() GenFunc -type EndFunc func(t *testing.T, tp testParams, testCon *testConsumer, expect [][]ptrace.Traces) (rops, eops map[string]int) -type ConsumerErrFunc func(t *testing.T, err error) +type ( + ExpConfig = otelarrowexporter.Config + RecvConfig = otelarrowreceiver.Config + CfgFunc func(*ExpConfig, *RecvConfig) + GenFunc func(int) ptrace.Traces + MkGen func() GenFunc + EndFunc func(t *testing.T, tp testParams, testCon *testConsumer, expect [][]ptrace.Traces) (rops, eops map[string]int) + ConsumerErrFunc func(t *testing.T, err error) +) func (*testConsumer) Capabilities() consumer.Capabilities { return consumer.Capabilities{} @@ -462,7 +464,7 @@ func TestIntegrationTracesSimple(t *testing.T) { defer cancel() // until 10 threads can write 1000 spans - var params = testParams{ + params := testParams{ threadCount: 10, requestWhileTrue: func(test *testConsumer) bool { return test.sink.SpanCount() < 1000 @@ -483,7 +485,7 @@ func TestIntegrationDeadlinePropagation(t *testing.T) { defer cancel() // Until at least one span is written. - var params = testParams{ + params := testParams{ threadCount: 1, requestWhileTrue: func(test *testConsumer) bool { return test.sink.SpanCount() < 1 @@ -596,7 +598,7 @@ func TestIntegrationSelfTracing(t *testing.T) { defer cancel() // until 2 Arrow stream spans are received from self instrumentation - var params = testParams{ + params := testParams{ threadCount: 10, requestWhileTrue: func(test *testConsumer) bool { cnt := 0 diff --git a/internal/pdatautil/logs_test.go b/internal/pdatautil/logs_test.go index 48329fac7876..75b51344a24e 100644 --- a/internal/pdatautil/logs_test.go +++ b/internal/pdatautil/logs_test.go @@ -142,13 +142,15 @@ func TestGroupByResourceLogs(t *testing.T) { }, { name: "single", - input: []resourceLogs{newResourceLogs(1, - newScopeLogs(11, 101, 102, 103), - ), + input: []resourceLogs{ + newResourceLogs(1, + newScopeLogs(11, 101, 102, 103), + ), }, - expected: []resourceLogs{newResourceLogs(1, - newScopeLogs(11, 101, 102, 103), - ), + expected: []resourceLogs{ + newResourceLogs(1, + newScopeLogs(11, 101, 102, 103), + ), }, }, { diff --git a/internal/splunk/common.go b/internal/splunk/common.go index c6b4f67e6e4d..c7cc3c2ecb40 100644 --- a/internal/splunk/common.go +++ b/internal/splunk/common.go @@ -38,9 +38,7 @@ const ( metricNamePattern = "^metric_name:([A-Za-z\\.:][A-Za-z0-9_\\.:]*)$" ) -var ( - metricNameRegexp = regexp.MustCompile(metricNamePattern) -) +var metricNameRegexp = regexp.MustCompile(metricNamePattern) // AccessTokenPassthroughConfig configures passing through access tokens. type AccessTokenPassthroughConfig struct { diff --git a/internal/sqlquery/scraper_test.go b/internal/sqlquery/scraper_test.go index 208657c7c3e7..f7883589f9f9 100644 --- a/internal/sqlquery/scraper_test.go +++ b/internal/sqlquery/scraper_test.go @@ -378,17 +378,18 @@ func TestScraper_FakeDB_MultiRows_Error(t *testing.T) { Client: NewDbClient(db, "", logger, TelemetryConfig{}), Logger: logger, Query: Query{ - Metrics: []MetricCfg{{ - MetricName: "my.col.0", - ValueColumn: "col_0", - Description: "my description 0", - Unit: "my-unit-0", - }, { - MetricName: "my.col.1", - ValueColumn: "col_1", - Description: "my description 1", - Unit: "my-unit-1", - }, + Metrics: []MetricCfg{ + { + MetricName: "my.col.0", + ValueColumn: "col_0", + Description: "my description 0", + Unit: "my-unit-0", + }, { + MetricName: "my.col.1", + ValueColumn: "col_1", + Description: "my description 1", + Unit: "my-unit-1", + }, }, }, }