diff --git a/internal/memorylimiter/cgroups/mountpoint.go b/internal/memorylimiter/cgroups/mountpoint.go index 28da20fdbc..03f2cfa3d5 100644 --- a/internal/memorylimiter/cgroups/mountpoint.go +++ b/internal/memorylimiter/cgroups/mountpoint.go @@ -131,7 +131,6 @@ func NewMountPointFromLine(line string) (*MountPoint, error) { // the host file system path in the mount namespace the *MountPoint belongs to. func (mp *MountPoint) Translate(absPath string) (string, error) { relPath, err := filepath.Rel(mp.Root, absPath) - if err != nil { return "", err } diff --git a/internal/sharedcomponent/sharedcomponent.go b/internal/sharedcomponent/sharedcomponent.go index 10ccba36bd..397e978483 100644 --- a/internal/sharedcomponent/sharedcomponent.go +++ b/internal/sharedcomponent/sharedcomponent.go @@ -102,8 +102,10 @@ func (c *Component[V]) Start(ctx context.Context, host component.Host) error { return nil } -var _ component.Host = (*hostWrapper)(nil) -var _ componentstatus.Reporter = (*hostWrapper)(nil) +var ( + _ component.Host = (*hostWrapper)(nil) + _ componentstatus.Reporter = (*hostWrapper)(nil) +) type hostWrapper struct { host component.Host diff --git a/internal/sharedcomponent/sharedcomponent_test.go b/internal/sharedcomponent/sharedcomponent_test.go index c65e59918e..bb4d1e8848 100644 --- a/internal/sharedcomponent/sharedcomponent_test.go +++ b/internal/sharedcomponent/sharedcomponent_test.go @@ -82,7 +82,8 @@ func TestSharedComponent(t *testing.T) { ShutdownFunc: func(context.Context) error { calledStop++ return wantErr - }} + }, + } comps := NewMap[component.ID, *baseComponent]() got, err := comps.LoadOrStore( @@ -198,8 +199,10 @@ func TestReportStatusOnStartShutdown(t *testing.T) { } } -var _ component.Host = (*testHost)(nil) -var _ componentstatus.Reporter = (*testHost)(nil) +var ( + _ component.Host = (*testHost)(nil) + _ componentstatus.Reporter = (*testHost)(nil) +) type testHost struct { component.Host diff --git a/otelcol/config_test.go b/otelcol/config_test.go index e0455330bd..adcf0eca4c 100644 --- a/otelcol/config_test.go +++ b/otelcol/config_test.go @@ -37,7 +37,7 @@ func (c *errConfig) Validate() error { } func TestConfigValidate(t *testing.T) { - var testCases = []struct { + testCases := []struct { name string // test case name (also file name containing config yaml) cfgFn func() *Config expected error diff --git a/otelcol/configprovider_test.go b/otelcol/configprovider_test.go index a1ea023b9a..a2f93f8e4c 100644 --- a/otelcol/configprovider_test.go +++ b/otelcol/configprovider_test.go @@ -17,9 +17,8 @@ import ( ) func newConfig(yamlBytes []byte, factories Factories) (*Config, error) { - var stringMap = map[string]interface{}{} + stringMap := map[string]interface{}{} err := yaml.Unmarshal(yamlBytes, stringMap) - if err != nil { return nil, err } diff --git a/otelcol/internal/configunmarshaler/configs_test.go b/otelcol/internal/configunmarshaler/configs_test.go index efbf97194b..ce1dc84328 100644 --- a/otelcol/internal/configunmarshaler/configs_test.go +++ b/otelcol/internal/configunmarshaler/configs_test.go @@ -77,7 +77,7 @@ func TestUnmarshal(t *testing.T) { func TestUnmarshalError(t *testing.T) { for _, tk := range testKinds { t.Run(tk.kind, func(t *testing.T) { - var testCases = []struct { + testCases := []struct { name string conf *confmap.Conf // string that the error must contain diff --git a/otelcol/unmarshaler_test.go b/otelcol/unmarshaler_test.go index 309e6e4c10..7e0e34ac5b 100644 --- a/otelcol/unmarshaler_test.go +++ b/otelcol/unmarshaler_test.go @@ -71,7 +71,7 @@ func TestUnmarshalUnknownTopLevel(t *testing.T) { } func TestPipelineConfigUnmarshalError(t *testing.T) { - var testCases = []struct { + testCases := []struct { // test case name (also file name containing config yaml) name string conf *confmap.Conf @@ -141,7 +141,7 @@ func TestPipelineConfigUnmarshalError(t *testing.T) { } func TestServiceUnmarshalError(t *testing.T) { - var testCases = []struct { + testCases := []struct { // test case name (also file name containing config yaml) name string conf *confmap.Conf diff --git a/pdata/internal/cmd/pdatagen/internal/packages.go b/pdata/internal/cmd/pdatagen/internal/packages.go index 8b0e2bb47d..952d630a5a 100644 --- a/pdata/internal/cmd/pdatagen/internal/packages.go +++ b/pdata/internal/cmd/pdatagen/internal/packages.go @@ -46,7 +46,7 @@ type PackageInfo struct { func (p *Package) GenerateFiles() error { for _, s := range p.structs { path := filepath.Join(p.info.path, "generated_"+strings.ToLower(s.getName())+".go") - if err := os.WriteFile(path, s.generate(p.info), 0600); err != nil { + if err := os.WriteFile(path, s.generate(p.info), 0o600); err != nil { return err } } @@ -57,7 +57,7 @@ func (p *Package) GenerateFiles() error { func (p *Package) GenerateTestFiles() error { for _, s := range p.structs { path := filepath.Join(p.info.path, "generated_"+strings.ToLower(s.getName())+"_test.go") - if err := os.WriteFile(path, s.generateTests(p.info), 0600); err != nil { + if err := os.WriteFile(path, s.generateTests(p.info), 0o600); err != nil { return err } } @@ -72,7 +72,7 @@ func (p *Package) GenerateInternalFiles() error { for _, s := range p.structs { path := filepath.Join("internal", "generated_wrapper_"+strings.ToLower(s.getName())+".go") - if err := os.WriteFile(path, s.generateInternal(p.info), 0600); err != nil { + if err := os.WriteFile(path, s.generateInternal(p.info), 0o600); err != nil { return err } } diff --git a/pdata/internal/cmd/pdatagen/internal/pmetric_package.go b/pdata/internal/cmd/pdatagen/internal/pmetric_package.go index e6e8e3a190..87cde55da8 100644 --- a/pdata/internal/cmd/pdatagen/internal/pmetric_package.go +++ b/pdata/internal/cmd/pdatagen/internal/pmetric_package.go @@ -517,6 +517,7 @@ var sumField = &optionalPrimitiveValue{ defaultVal: "float64(0.0)", testVal: "float64(17.13)", } + var minField = &optionalPrimitiveValue{ fieldName: "Min", returnType: "float64", diff --git a/pdata/internal/cmd/pdatagen/internal/pprofile_package.go b/pdata/internal/cmd/pdatagen/internal/pprofile_package.go index 1700332125..2ca3edb479 100644 --- a/pdata/internal/cmd/pdatagen/internal/pprofile_package.go +++ b/pdata/internal/cmd/pdatagen/internal/pprofile_package.go @@ -398,6 +398,7 @@ var locationSlice = &sliceOfPtrs{ structName: "LocationSlice", element: location, } + var location = &messageValueStruct{ structName: "Location", description: "// Location describes function and line table debug information.", diff --git a/pdata/pcommon/timestamp_test.go b/pdata/pcommon/timestamp_test.go index edd94596ec..3fa5ffbc5b 100644 --- a/pdata/pcommon/timestamp_test.go +++ b/pdata/pcommon/timestamp_test.go @@ -11,7 +11,7 @@ import ( ) func TestUnixNanosConverters(t *testing.T) { - t1 := time.Date(2020, 03, 24, 1, 13, 23, 789, time.UTC) + t1 := time.Date(2020, 3, 24, 1, 13, 23, 789, time.UTC) // nolint:gosec tun := Timestamp(t1.UnixNano()) diff --git a/pdata/plog/fuzz_test.go b/pdata/plog/fuzz_test.go index c47fed13fb..4654c164b3 100644 --- a/pdata/plog/fuzz_test.go +++ b/pdata/plog/fuzz_test.go @@ -8,9 +8,7 @@ import ( "testing" ) -var ( - unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." -) +var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." func FuzzUnmarshalJsonLogs(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { diff --git a/pdata/plog/json_test.go b/pdata/plog/json_test.go index 160e5b7909..ccdf9d1739 100644 --- a/pdata/plog/json_test.go +++ b/pdata/plog/json_test.go @@ -14,8 +14,10 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" ) -var _ Marshaler = (*JSONMarshaler)(nil) -var _ Unmarshaler = (*JSONUnmarshaler)(nil) +var ( + _ Marshaler = (*JSONMarshaler)(nil) + _ Unmarshaler = (*JSONUnmarshaler)(nil) +) var logsOTLP = func() Logs { ld := NewLogs() diff --git a/pdata/plog/plogotlp/fuzz_test.go b/pdata/plog/plogotlp/fuzz_test.go index 3203ee8e34..4236d7f9a9 100644 --- a/pdata/plog/plogotlp/fuzz_test.go +++ b/pdata/plog/plogotlp/fuzz_test.go @@ -8,9 +8,7 @@ import ( "testing" ) -var ( - unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." -) +var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." func FuzzRequestUnmarshalJSON(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { diff --git a/pdata/plog/plogotlp/request_test.go b/pdata/plog/plogotlp/request_test.go index 5520d1ef02..4bea3ac652 100644 --- a/pdata/plog/plogotlp/request_test.go +++ b/pdata/plog/plogotlp/request_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportRequest{} -var _ json.Marshaler = ExportRequest{} +var ( + _ json.Unmarshaler = ExportRequest{} + _ json.Marshaler = ExportRequest{} +) var logsRequestJSON = []byte(` { diff --git a/pdata/plog/plogotlp/response_test.go b/pdata/plog/plogotlp/response_test.go index 9d26bf2219..ba9a79ab16 100644 --- a/pdata/plog/plogotlp/response_test.go +++ b/pdata/plog/plogotlp/response_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportResponse{} -var _ json.Marshaler = ExportResponse{} +var ( + _ json.Unmarshaler = ExportResponse{} + _ json.Marshaler = ExportResponse{} +) func TestExportResponseJSON(t *testing.T) { jsonStr := `{"partialSuccess": {"rejectedLogRecords":1, "errorMessage":"nothing"}}` diff --git a/pdata/pmetric/metrics_test.go b/pdata/pmetric/metrics_test.go index 6e4c5ff2c1..cd11d13953 100644 --- a/pdata/pmetric/metrics_test.go +++ b/pdata/pmetric/metrics_test.go @@ -810,6 +810,7 @@ func generateTestProtoGaugeMetric() *otlpmetrics.Metric { }, } } + func generateTestProtoSumMetric() *otlpmetrics.Metric { return &otlpmetrics.Metric{ Name: "my_metric_double", diff --git a/pdata/pmetric/pmetricotlp/request_test.go b/pdata/pmetric/pmetricotlp/request_test.go index d6fe9dbaa2..e6eaab4888 100644 --- a/pdata/pmetric/pmetricotlp/request_test.go +++ b/pdata/pmetric/pmetricotlp/request_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportRequest{} -var _ json.Marshaler = ExportRequest{} +var ( + _ json.Unmarshaler = ExportRequest{} + _ json.Marshaler = ExportRequest{} +) var metricsRequestJSON = []byte(` { diff --git a/pdata/pmetric/pmetricotlp/response_test.go b/pdata/pmetric/pmetricotlp/response_test.go index a8b689aacc..bf1f70b418 100644 --- a/pdata/pmetric/pmetricotlp/response_test.go +++ b/pdata/pmetric/pmetricotlp/response_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportResponse{} -var _ json.Marshaler = ExportResponse{} +var ( + _ json.Unmarshaler = ExportResponse{} + _ json.Marshaler = ExportResponse{} +) func TestExportResponseJSON(t *testing.T) { jsonStr := `{"partialSuccess": {"rejectedDataPoints":1, "errorMessage":"nothing"}}` diff --git a/pdata/pprofile/fuzz_test.go b/pdata/pprofile/fuzz_test.go index 46b204a845..1079d77971 100644 --- a/pdata/pprofile/fuzz_test.go +++ b/pdata/pprofile/fuzz_test.go @@ -8,9 +8,7 @@ import ( "testing" ) -var ( - unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." -) +var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." func FuzzUnmarshalProfiles(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { diff --git a/pdata/pprofile/json_test.go b/pdata/pprofile/json_test.go index 1fa8480a53..3158f54f0f 100644 --- a/pdata/pprofile/json_test.go +++ b/pdata/pprofile/json_test.go @@ -13,8 +13,10 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" ) -var _ Marshaler = (*JSONMarshaler)(nil) -var _ Unmarshaler = (*JSONUnmarshaler)(nil) +var ( + _ Marshaler = (*JSONMarshaler)(nil) + _ Unmarshaler = (*JSONUnmarshaler)(nil) +) var profilesOTLP = func() Profiles { startTimestamp := pcommon.Timestamp(1684617382541971000) diff --git a/pdata/pprofile/pprofileotlp/fuzz_test.go b/pdata/pprofile/pprofileotlp/fuzz_test.go index c3e8a1b937..fb0067b5a6 100644 --- a/pdata/pprofile/pprofileotlp/fuzz_test.go +++ b/pdata/pprofile/pprofileotlp/fuzz_test.go @@ -8,9 +8,7 @@ import ( "testing" ) -var ( - unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." -) +var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." func FuzzRequestUnmarshalJSON(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { diff --git a/pdata/pprofile/pprofileotlp/request_test.go b/pdata/pprofile/pprofileotlp/request_test.go index d45845c960..eedac7506c 100644 --- a/pdata/pprofile/pprofileotlp/request_test.go +++ b/pdata/pprofile/pprofileotlp/request_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportRequest{} -var _ json.Marshaler = ExportRequest{} +var ( + _ json.Unmarshaler = ExportRequest{} + _ json.Marshaler = ExportRequest{} +) var profilesRequestJSON = []byte(` { diff --git a/pdata/pprofile/pprofileotlp/response_test.go b/pdata/pprofile/pprofileotlp/response_test.go index a7cede8fe9..4e675f4899 100644 --- a/pdata/pprofile/pprofileotlp/response_test.go +++ b/pdata/pprofile/pprofileotlp/response_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportResponse{} -var _ json.Marshaler = ExportResponse{} +var ( + _ json.Unmarshaler = ExportResponse{} + _ json.Marshaler = ExportResponse{} +) func TestExportResponseJSON(t *testing.T) { jsonStr := `{"partialSuccess": {"rejectedProfiles":1, "errorMessage":"nothing"}}` diff --git a/pdata/ptrace/fuzz_test.go b/pdata/ptrace/fuzz_test.go index d35a00c80b..efccc8e01a 100644 --- a/pdata/ptrace/fuzz_test.go +++ b/pdata/ptrace/fuzz_test.go @@ -8,9 +8,7 @@ import ( "testing" ) -var ( - unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." -) +var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." func FuzzUnmarshalJSONTraces(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { diff --git a/pdata/ptrace/json_test.go b/pdata/ptrace/json_test.go index 8e1b683fc1..46e07a0405 100644 --- a/pdata/ptrace/json_test.go +++ b/pdata/ptrace/json_test.go @@ -13,8 +13,10 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" ) -var _ Marshaler = (*JSONMarshaler)(nil) -var _ Unmarshaler = (*JSONUnmarshaler)(nil) +var ( + _ Marshaler = (*JSONMarshaler)(nil) + _ Unmarshaler = (*JSONUnmarshaler)(nil) +) var tracesOTLP = func() Traces { startTimestamp := pcommon.Timestamp(1684617382541971000) diff --git a/pdata/ptrace/ptraceotlp/fuzz_test.go b/pdata/ptrace/ptraceotlp/fuzz_test.go index d6d866e9de..c40310f49a 100644 --- a/pdata/ptrace/ptraceotlp/fuzz_test.go +++ b/pdata/ptrace/ptraceotlp/fuzz_test.go @@ -8,9 +8,7 @@ import ( "testing" ) -var ( - unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." -) +var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling." func FuzzRequestUnmarshalJSON(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { diff --git a/pdata/ptrace/ptraceotlp/request_test.go b/pdata/ptrace/ptraceotlp/request_test.go index 444ae74b71..98880ed4b1 100644 --- a/pdata/ptrace/ptraceotlp/request_test.go +++ b/pdata/ptrace/ptraceotlp/request_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportRequest{} -var _ json.Marshaler = ExportRequest{} +var ( + _ json.Unmarshaler = ExportRequest{} + _ json.Marshaler = ExportRequest{} +) var tracesRequestJSON = []byte(` { diff --git a/pdata/ptrace/ptraceotlp/response_test.go b/pdata/ptrace/ptraceotlp/response_test.go index c893557a07..8c228504d5 100644 --- a/pdata/ptrace/ptraceotlp/response_test.go +++ b/pdata/ptrace/ptraceotlp/response_test.go @@ -12,8 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var _ json.Unmarshaler = ExportResponse{} -var _ json.Marshaler = ExportResponse{} +var ( + _ json.Unmarshaler = ExportResponse{} + _ json.Marshaler = ExportResponse{} +) func TestExportResponseJSON(t *testing.T) { jsonStr := `{"partialSuccess": {"rejectedSpans":1, "errorMessage":"nothing"}}` diff --git a/pdata/testdata/log.go b/pdata/testdata/log.go index 5d2a0a194f..be9c8b2bce 100644 --- a/pdata/testdata/log.go +++ b/pdata/testdata/log.go @@ -10,9 +10,7 @@ import ( "go.opentelemetry.io/collector/pdata/plog" ) -var ( - logTimestamp = pcommon.NewTimestampFromTime(time.Date(2020, 2, 11, 20, 26, 13, 789, time.UTC)) -) +var logTimestamp = pcommon.NewTimestampFromTime(time.Date(2020, 2, 11, 20, 26, 13, 789, time.UTC)) func GenerateLogs(count int) plog.Logs { ld := plog.NewLogs() diff --git a/pipeline/pipeline_test.go b/pipeline/pipeline_test.go index 8f897260fb..23bb5c836a 100644 --- a/pipeline/pipeline_test.go +++ b/pipeline/pipeline_test.go @@ -42,7 +42,7 @@ func TestMarshalText(t *testing.T) { func TestUnmarshalText(t *testing.T) { validSignal := globalsignal.MustNewSignal("valid") - var testCases = []struct { + testCases := []struct { idStr string expectedErr bool expectedID ID diff --git a/pipeline/pipelineprofiles/config.go b/pipeline/pipelineprofiles/config.go index e1cd9136cf..6802cf15c9 100644 --- a/pipeline/pipelineprofiles/config.go +++ b/pipeline/pipelineprofiles/config.go @@ -7,6 +7,4 @@ import ( "go.opentelemetry.io/collector/pipeline/internal/globalsignal" ) -var ( - SignalProfiles = globalsignal.MustNewSignal("profiles") -) +var SignalProfiles = globalsignal.MustNewSignal("profiles") diff --git a/processor/batchprocessor/batch_processor_test.go b/processor/batchprocessor/batch_processor_test.go index 5791ddbd69..c4fa2b9147 100644 --- a/processor/batchprocessor/batch_processor_test.go +++ b/processor/batchprocessor/batch_processor_test.go @@ -218,9 +218,11 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Attributes: attribute.NewSet(attribute.String("processor", "batch")), Count: uint64(expectedBatchesNum), - Bounds: []float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, + Bounds: []float64{ + 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100_000, 200_000, 300_000, 400_000, 500_000, 600_000, 700_000, 800_000, 900_000, - 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000}, + 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000, + }, BucketCounts: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint64(expectedBatchesNum), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Sum: int64(sizeSum), Min: metricdata.NewExtrema(int64(sizeSum / expectedBatchesNum)), @@ -343,9 +345,11 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Attributes: attribute.NewSet(attribute.String("processor", "batch")), Count: uint64(expectedBatchesNum), - Bounds: []float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, + Bounds: []float64{ + 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100_000, 200_000, 300_000, 400_000, 500_000, 600_000, 700_000, 800_000, 900_000, - 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000}, + 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000, + }, BucketCounts: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, uint64(expectedBatchesNum - 1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Sum: int64(sizeSum), Min: metricdata.NewExtrema(int64(minSize)), @@ -601,9 +605,11 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Attributes: attribute.NewSet(attribute.String("processor", "batch")), Count: uint64(expectedBatchesNum), - Bounds: []float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, + Bounds: []float64{ + 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100_000, 200_000, 300_000, 400_000, 500_000, 600_000, 700_000, 800_000, 900_000, - 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000}, + 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000, + }, BucketCounts: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint64(expectedBatchesNum), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Sum: int64(size), Min: metricdata.NewExtrema(int64(size / int(expectedBatchesNum))), @@ -975,9 +981,11 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Attributes: attribute.NewSet(attribute.String("processor", "batch")), Count: uint64(expectedBatchesNum), - Bounds: []float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, + Bounds: []float64{ + 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100_000, 200_000, 300_000, 400_000, 500_000, 600_000, 700_000, 800_000, 900_000, - 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000}, + 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000, + }, BucketCounts: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint64(expectedBatchesNum), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Sum: int64(size), Min: metricdata.NewExtrema(int64(size / int(expectedBatchesNum))), diff --git a/processor/batchprocessor/metrics.go b/processor/batchprocessor/metrics.go index 0e5ddafd8e..01621ad86e 100644 --- a/processor/batchprocessor/metrics.go +++ b/processor/batchprocessor/metrics.go @@ -38,7 +38,6 @@ func newBatchProcessorTelemetry(set processor.Settings, currentMetadataCardinali set.TelemetrySettings, metadata.WithProcessorBatchMetadataCardinalityCallback(func() int64 { return int64(currentMetadataCardinality()) }, attrs), ) - if err != nil { return nil, err } diff --git a/processor/processor_test.go b/processor/processor_test.go index d38b0b5758..03c821964b 100644 --- a/processor/processor_test.go +++ b/processor/processor_test.go @@ -17,7 +17,7 @@ import ( ) func TestNewFactory(t *testing.T) { - var testType = component.MustNewType("test") + testType := component.MustNewType("test") defaultCfg := struct{}{} f := NewFactory( testType, @@ -33,7 +33,7 @@ func TestNewFactory(t *testing.T) { } func TestNewFactoryWithOptions(t *testing.T) { - var testType = component.MustNewType("test") + testType := component.MustNewType("test") defaultCfg := struct{}{} f := NewFactory( testType, diff --git a/processor/processorhelper/traces.go b/processor/processorhelper/traces.go index 941168985a..f6389a2272 100644 --- a/processor/processorhelper/traces.go +++ b/processor/processorhelper/traces.go @@ -65,7 +65,6 @@ func NewTraces( obs.recordInOut(ctx, spansIn, spansOut) return nextConsumer.ConsumeTraces(ctx, td) }, bs.consumerOptions...) - if err != nil { return nil, err } diff --git a/processor/processorprofiles/processor_test.go b/processor/processorprofiles/processor_test.go index 3e735a6926..1e743e67bf 100644 --- a/processor/processorprofiles/processor_test.go +++ b/processor/processorprofiles/processor_test.go @@ -16,7 +16,7 @@ import ( ) func TestNewFactoryWithProfiles(t *testing.T) { - var testType = component.MustNewType("test") + testType := component.MustNewType("test") defaultCfg := struct{}{} factory := NewFactory( testType,