diff --git a/receiver/aerospikereceiver/client.go b/receiver/aerospikereceiver/client.go index 18991cb0158d..1e6fc0cd90a0 100644 --- a/receiver/aerospikereceiver/client.go +++ b/receiver/aerospikereceiver/client.go @@ -71,7 +71,6 @@ func nodeGetterFactory(cfg *clientConfig, policy *as.ClientPolicy, authEnabled b authEnabled, ) return cluster, err - } // newASClient creates a new defaultASClient connected to the given host and port diff --git a/receiver/aerospikereceiver/cluster/node_test.go b/receiver/aerospikereceiver/cluster/node_test.go index f2cf325acc1e..fe564197808a 100644 --- a/receiver/aerospikereceiver/cluster/node_test.go +++ b/receiver/aerospikereceiver/cluster/node_test.go @@ -70,7 +70,6 @@ func TestNode_NewConnNode(t *testing.T) { _, err = _newConnNode(cPolicy, host, authEnabled, factoryFuncNegLogin) connFactoryNegLogin.AssertExpectations(t) require.ErrorContains(t, err, "ResultCode: NOT_AUTHENTICATED") - } func TestNode_RequestInfo(t *testing.T) { diff --git a/receiver/aerospikereceiver/scraper.go b/receiver/aerospikereceiver/scraper.go index ba421a565b6d..b512a3d32107 100644 --- a/receiver/aerospikereceiver/scraper.go +++ b/receiver/aerospikereceiver/scraper.go @@ -383,7 +383,6 @@ func (r *aerospikeReceiver) emitNamespace(info map[string]string, now pcommon.Ti addPartialIfError(errs, r.mb.RecordAerospikeNamespaceTransactionCountDataPoint(now, v, metadata.AttributeTransactionTypeWrite, metadata.AttributeTransactionResultSuccess)) case "client_write_timeout": addPartialIfError(errs, r.mb.RecordAerospikeNamespaceTransactionCountDataPoint(now, v, metadata.AttributeTransactionTypeWrite, metadata.AttributeTransactionResultTimeout)) - } } diff --git a/receiver/apachereceiver/scraper_test.go b/receiver/apachereceiver/scraper_test.go index 883a047a5f91..cf332a609103 100644 --- a/receiver/apachereceiver/scraper_test.go +++ b/receiver/apachereceiver/scraper_test.go @@ -75,7 +75,6 @@ func TestScraperFailedStart(t *testing.T) { } func TestParseScoreboard(t *testing.T) { - t.Run("test freq count", func(t *testing.T) { scoreboard := `S_DD_L_GGG_____W__IIII_C________________W__________________________________.........................____WR______W____W________________________C______________________________________W_W____W______________R_________R________C_________WK_W________K_____W__C__________W___R______.............................................................................................................................` results := parseScoreboard(scoreboard) diff --git a/receiver/awscontainerinsightreceiver/factory.go b/receiver/awscontainerinsightreceiver/factory.go index aa833d239189..45da2ff968e7 100644 --- a/receiver/awscontainerinsightreceiver/factory.go +++ b/receiver/awscontainerinsightreceiver/factory.go @@ -58,7 +58,6 @@ func createMetricsReceiver( baseCfg component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { - rCfg := baseCfg.(*Config) return newAWSContainerInsightReceiver(params.TelemetrySettings, rCfg, consumer) } diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go index 536bf767cf3e..2604ad8bb7e3 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go @@ -196,7 +196,6 @@ func (c *Cadvisor) addEbsVolumeInfo(tags map[string]string, ebsVolumeIDsUsedAsPV } func (c *Cadvisor) addECSMetrics(cadvisormetrics []*extractors.CAdvisorMetric) { - if len(cadvisormetrics) == 0 { c.logger.Warn("cadvisor can't collect any metrics!") } @@ -300,7 +299,6 @@ func (c *Cadvisor) decorateMetrics(cadvisormetrics []*extractors.CAdvisorMetric) // add tags for EKS if c.containerOrchestrator == ci.EKS { - tags[ci.ClusterNameKey] = c.hostInfo.GetClusterName() out := c.k8sDecorator.Decorate(m) @@ -308,7 +306,6 @@ func (c *Cadvisor) decorateMetrics(cadvisormetrics []*extractors.CAdvisorMetric) result = append(result, out) } } - } return result diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/diskio_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/diskio_extractor_test.go index f3bf4c2f9b5a..ddfbbd476604 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/diskio_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/diskio_extractor_test.go @@ -14,7 +14,6 @@ import ( ) func TestDiskIOStats(t *testing.T) { - result := testutils.LoadContainerInfo(t, "./testdata/PreInfoContainer.json") result2 := testutils.LoadContainerInfo(t, "./testdata/CurInfoContainer.json") // for eks node-level metrics diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_helpers_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_helpers_test.go index b0f6985d102b..45e4f83e63ef 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_helpers_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_helpers_test.go @@ -83,7 +83,6 @@ func AssertContainsTaggedField( expectedFields map[string]any, expectedTags map[string]string, ) { - actualFields := cadvisorMetric.GetFields() actualTags := cadvisorMetric.GetTags() if !reflect.DeepEqual(expectedTags, actualTags) { diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_test.go index 3cb09509b14e..31d1ff2d070a 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractor_test.go @@ -120,5 +120,4 @@ func TestMergeMetrics(t *testing.T) { require.Len(t, mergedMetrics, 1) assert.Equal(t, expected.GetTags(), mergedMetrics[0].GetTags()) assert.Equal(t, expected.GetFields(), mergedMetrics[0].GetFields()) - } diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/fs_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/fs_extractor_test.go index 1c6c8a8f2696..c6933f049a79 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/fs_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/fs_extractor_test.go @@ -135,5 +135,4 @@ func TestFSStatsWithAllowList(t *testing.T) { assert.Equal(t, "tmpfs", cMetrics[0].tags["device"]) assert.Equal(t, "/dev/xvda1", cMetrics[1].tags["device"]) assert.Equal(t, "overlay", cMetrics[2].tags["device"]) - } diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor.go index 3affa24971fd..18b65c87e27b 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor.go @@ -31,7 +31,6 @@ func (n *NetMetricExtractor) HasValue(info *cinfo.ContainerInfo) bool { } func (n *NetMetricExtractor) GetValue(info *cinfo.ContainerInfo, _ CPUMemInfoProvider, containerType string) []*CAdvisorMetric { - // Just a protection here, there is no Container level Net metrics if containerType == ci.TypePod || containerType == ci.TypeContainer { return nil diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup.go index 4f04191d4966..cce6b10419f6 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup.go @@ -85,7 +85,6 @@ func newCGroupScanner(ctx context.Context, mountConfigPath string, logger *zap.L } func (c *cgroupScanner) refresh() { - if c.ecsTaskInfoProvider == nil { return } diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup_test.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup_test.go index 363bf0242eba..0e62a7b772c4 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup_test.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/cgroup_test.go @@ -45,7 +45,6 @@ func TestGetCGroupPathForTask(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := getCGroupPathForTask(cgroupMount, controller, tt.input, clusterName) if tt.err != nil { @@ -96,7 +95,6 @@ func TestGetCGroupPathFromARN(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := getTaskCgroupPathFromARN(tt.input) if tt.err != nil { @@ -110,7 +108,6 @@ func TestGetCGroupPathFromARN(t *testing.T) { } func TestGetCGroupMountPoint(t *testing.T) { - tests := []struct { name string input string @@ -149,7 +146,6 @@ func TestGetCGroupMountPoint(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := getCGroupMountPoint(tt.input) if tt.err != nil { @@ -160,7 +156,6 @@ func TestGetCGroupMountPoint(t *testing.T) { } }) } - } func TestGetCPUReservedInTask(t *testing.T) { @@ -217,7 +212,6 @@ func TestGetCPUReservedInTask(t *testing.T) { assert.Equal(t, tt.expectRes, got) }) } - } func TestGetMEMReservedInTask(t *testing.T) { @@ -337,5 +331,4 @@ func TestGetCPUReservedAndMemReserved(t *testing.T) { assert.Equal(t, int64(0), cgroup.getCPUReserved()) assert.Equal(t, int64(0), cgroup.getMemReserved()) - } diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_instance_info_test.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_instance_info_test.go index a4982975186d..b23b7ddbd0a2 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_instance_info_test.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_instance_info_test.go @@ -28,7 +28,6 @@ func (mi *MockHostInfo) GetInstanceIPReadyC() chan bool { } func TestECSInstanceInfo(t *testing.T) { - var ctx, cancel = context.WithCancel(context.Background()) defer cancel() instanceReadyC := make(chan bool) @@ -81,5 +80,4 @@ func TestECSInstanceInfo(t *testing.T) { assert.Equal(t, "", ecsinstanceinfo.GetClusterName()) assert.Equal(t, "", ecsinstanceinfo.GetContainerInstanceID()) - } diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info.go index 0b0e1b64c52b..c998f11e1b42 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info.go @@ -79,7 +79,6 @@ func (ti *taskInfo) getTasksInfo(ctx context.Context) (ecsTasksInfo *ECSTasksInf } func (ti *taskInfo) refresh(ctx context.Context) { - ecsTasksInfo := ti.getTasksInfo(ctx) runningTaskCount := int64(0) var tasks []ECSTask @@ -100,7 +99,6 @@ func (ti *taskInfo) refresh(ctx context.Context) { if len(ti.runningTasksInfo) != 0 && ti.runningTaskCount != 0 && !isClosed(ti.readyC) { close(ti.readyC) } - } func (ti *taskInfo) getRunningTaskCount() int64 { diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info_test.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info_test.go index bcbd46b8228a..ed629895353d 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info_test.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecs_task_info_test.go @@ -18,7 +18,6 @@ import ( ) func TestECSTaskInfoSuccess(t *testing.T) { - ctx := context.Background() taskReadyC := make(chan bool) @@ -48,7 +47,6 @@ func TestECSTaskInfoSuccess(t *testing.T) { assert.Equal(t, int64(1), ecsTaskinfo.getRunningTaskCount()) assert.NotEmpty(t, ecsTaskinfo.getRunningTasksInfo()) - } func TestECSTaskInfoFail(t *testing.T) { @@ -88,5 +86,4 @@ func TestECSTaskInfoFail(t *testing.T) { assert.NotNil(t, ecsTaskinfo) assert.Equal(t, int64(0), ecsTaskinfo.getRunningTaskCount()) assert.Empty(t, ecsTaskinfo.getRunningTasksInfo()) - } diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go index 8e52a9934923..6b66ce5163a6 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go @@ -123,7 +123,6 @@ func NewECSInfo(refreshInterval time.Duration, hostIPProvider hostIPProvider, ho } func (e *EcsInfo) initContainerInfo(ctx context.Context) { - <-e.hostIPProvider.GetInstanceIPReadyC() e.logger.Info("instance ip is ready and begin initializing ecs container info") @@ -133,7 +132,6 @@ func (e *EcsInfo) initContainerInfo(ctx context.Context) { } func (e *EcsInfo) initTaskInfo(ctx context.Context) { - <-e.hostIPProvider.GetInstanceIPReadyC() e.logger.Info("instance ip is ready and begin initializing ecs task info") @@ -144,7 +142,6 @@ func (e *EcsInfo) initTaskInfo(ctx context.Context) { } func (e *EcsInfo) initCgroupScanner(ctx context.Context) { - <-e.isContainerInfoReadyC <-e.isTaskInfoReadyC diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo_test.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo_test.go index 31176b61e9b8..5f5efcb442d5 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo_test.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo_test.go @@ -48,7 +48,6 @@ func (ii *MockTaskInfo) getRunningTaskCount() int64 { return ii.runningTaskCount } func (ii *MockTaskInfo) getRunningTasksInfo() []ECSTask { - return ii.tasks } @@ -76,7 +75,6 @@ func (c *MockCgroupScanner) getMEMReservedInTask(_ string, _ string, _ []ECSCont func TestNewECSInfo(t *testing.T) { // test the case when containerInstanceInfor fails to initialize containerInstanceInfoCreatorOpt := func(ei *EcsInfo) { - ei.containerInstanceInfoCreator = func(context.Context, hostIPProvider, time.Duration, *zap.Logger, doer, chan bool) containerInstanceInfoProvider { return &MockInstanceInfo{ clusterName: "Cluster-name", @@ -131,5 +129,4 @@ func TestNewECSInfo(t *testing.T) { assert.Equal(t, int64(1024), ecsinfo.GetCPUReserved()) assert.Equal(t, int64(1024), ecsinfo.GetMemReserved()) - } diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils.go index fabff9689f84..fdacc74098f3 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils.go @@ -43,7 +43,6 @@ func GetContainerInstanceIDFromArn(arn string) (containerInstanceID string, err } err = errors.New("Can't get ecs container instance id from ContainerInstance arn: " + arn) return - } // Check the channel is closed or not. @@ -94,7 +93,6 @@ func request(ctx context.Context, endpoint string, client doer) ([]byte, error) return nil, fmt.Errorf("response from %s, execeeds the maximum length: %v", endpoint, maxHTTPResponseLength) } return body, nil - } func clientGet(ctx context.Context, url string, client doer) (resp *http.Response, err error) { diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils_test.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils_test.go index 2b1663265489..8fb99ad91318 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils_test.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/utils_test.go @@ -24,7 +24,6 @@ func (m *mockHTTPClient) Do(_ *http.Request) (*http.Response, error) { } func TestGetContainerInstanceIDFromArn(t *testing.T) { - oldFormatARN := "arn:aws:ecs:region:aws_account_id:task/task-id" result, _ := GetContainerInstanceIDFromArn(oldFormatARN) assert.Equal(t, "task-id", result, "Expected to be equal") @@ -39,7 +38,6 @@ func TestGetContainerInstanceIDFromArn(t *testing.T) { } func TestIsClosed(t *testing.T) { - channel := make(chan bool) assert.False(t, isClosed(channel)) @@ -47,11 +45,9 @@ func TestIsClosed(t *testing.T) { close(channel) assert.True(t, isClosed(channel)) - } func TestRequestSuccessWithKnownLength(t *testing.T) { - respBody := "body" response := &http.Response{ StatusCode: http.StatusOK, @@ -72,11 +68,9 @@ func TestRequestSuccessWithKnownLength(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, body) - } func TestRequestSuccessWithUnknownLength(t *testing.T) { - respBody := "body" response := &http.Response{ StatusCode: http.StatusOK, @@ -97,11 +91,9 @@ func TestRequestSuccessWithUnknownLength(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, body) - } func TestRequestWithFailedStatus(t *testing.T) { - respBody := "body" response := &http.Response{ Status: "Bad Request", @@ -123,11 +115,9 @@ func TestRequestWithFailedStatus(t *testing.T) { assert.Nil(t, body) assert.Error(t, err) - } func TestRequestWithLargeContentLength(t *testing.T) { - respBody := "body" response := &http.Response{ StatusCode: http.StatusOK, @@ -148,5 +138,4 @@ func TestRequestWithLargeContentLength(t *testing.T) { assert.Nil(t, body) assert.Error(t, err) - } diff --git a/receiver/awscontainerinsightreceiver/internal/k8sapiserver/k8sapiserver.go b/receiver/awscontainerinsightreceiver/internal/k8sapiserver/k8sapiserver.go index bc9c593ca14e..c64912388264 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8sapiserver/k8sapiserver.go +++ b/receiver/awscontainerinsightreceiver/internal/k8sapiserver/k8sapiserver.go @@ -246,7 +246,6 @@ func (k *K8sAPIServer) Shutdown() error { } func (k *K8sAPIServer) startLeaderElection(ctx context.Context, lock resourcelock.Interface) { - for { leaderelection.RunOrDie(ctx, leaderelection.LeaderElectionConfig{ Lock: lock, diff --git a/receiver/awscontainerinsightreceiver/receiver.go b/receiver/awscontainerinsightreceiver/receiver.go index 01dd1deedf94..d7c4293188b4 100644 --- a/receiver/awscontainerinsightreceiver/receiver.go +++ b/receiver/awscontainerinsightreceiver/receiver.go @@ -44,7 +44,6 @@ func newAWSContainerInsightReceiver( settings component.TelemetrySettings, config *Config, nextConsumer consumer.Metrics) (receiver.Metrics, error) { - r := &awsContainerInsightReceiver{ settings: settings, nextConsumer: nextConsumer, @@ -79,7 +78,6 @@ func (acir *awsContainerInsightReceiver) Start(ctx context.Context, host compone } } if acir.config.ContainerOrchestrator == ci.ECS { - ecsInfo, err := ecsinfo.NewECSInfo(acir.config.CollectionInterval, hostinfo, host, acir.settings) if err != nil { return err @@ -134,7 +132,6 @@ func (acir *awsContainerInsightReceiver) Shutdown(context.Context) error { } return errs - } // collectData collects container stats from cAdvisor and k8s api server (if it is an elected leader) diff --git a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator.go b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator.go index 3086b491ee0b..a8da66e22996 100644 --- a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator.go +++ b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator.go @@ -20,13 +20,11 @@ type metricDataAccumulator struct { // getMetricsData generates OT Metrics data from task metadata and docker stats func (acc *metricDataAccumulator) getMetricsData(containerStatsMap map[string]*ContainerStats, metadata ecsutil.TaskMetadata, logger *zap.Logger) { - taskMetrics := ECSMetrics{} timestamp := pcommon.NewTimestampFromTime(time.Now()) taskResource := taskResource(metadata) for _, containerMetadata := range metadata.Containers { - containerResource := containerResource(containerMetadata, logger) taskResource.Attributes().Range(func(k string, av pcommon.Value) bool { av.CopyTo(containerResource.Attributes().PutEmpty(k)) @@ -36,11 +34,9 @@ func (acc *metricDataAccumulator) getMetricsData(containerStatsMap map[string]*C stats, ok := containerStatsMap[containerMetadata.DockerID] if ok && !isEmptyStats(stats) { - containerMetrics := convertContainerMetrics(stats, logger, containerMetadata) acc.accumulate(convertToOTLPMetrics(containerPrefix, containerMetrics, containerResource, timestamp)) aggregateTaskMetrics(&taskMetrics, containerMetrics) - } else if containerMetadata.FinishedAt != "" && containerMetadata.StartedAt != "" { duration, err := calculateDuration(containerMetadata.StartedAt, containerMetadata.FinishedAt) @@ -50,7 +46,6 @@ func (acc *metricDataAccumulator) getMetricsData(containerStatsMap map[string]*C } acc.accumulate(convertStoppedContainerDataToOTMetrics(containerPrefix, containerResource, timestamp, duration)) - } } overrideWithTaskLevelLimit(&taskMetrics, metadata) diff --git a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator_test.go b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator_test.go index c04d685db20f..f2f1d2182f10 100644 --- a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator_test.go +++ b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/accumulator_test.go @@ -226,7 +226,6 @@ func TestIsEmptyStats(t *testing.T) { } func TestCalculateDuration(t *testing.T) { - startTime := "2020-10-02T00:15:07.620912337Z" endTime := "2020-10-03T15:14:06.620913372Z" result, err := calculateDuration(startTime, endTime) @@ -250,5 +249,4 @@ func TestCalculateDuration(t *testing.T) { result, err = calculateDuration(startTime, endTime) require.Error(t, err) require.EqualValues(t, 0, result) - } diff --git a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper.go b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper.go index 3f527cfc33ed..71ab05cede39 100644 --- a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper.go +++ b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper.go @@ -26,7 +26,6 @@ func getContainerMetrics(stats *ContainerStats, logger *zap.Logger) ECSMetrics { if stats.CPU != nil && stats.CPU.CPUUsage != nil && stats.PreviousCPU != nil && stats.PreviousCPU.CPUUsage != nil { - numOfCores := (uint64)(len(stats.CPU.CPUUsage.PerCPUUsage)) timeDiffSinceLastRead := (float64)(stats.Read.Sub(stats.PreviousRead).Nanoseconds()) diff --git a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper_test.go b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper_test.go index 2507e7bf5e16..20c982e3f195 100644 --- a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper_test.go +++ b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper_test.go @@ -96,7 +96,6 @@ func TestGetContainerMetricsMissingMemory(t *testing.T) { } func TestGetContainerDereferenceCheck(t *testing.T) { - tests := []struct { memoryStats *MemoryStats testName string @@ -421,7 +420,6 @@ func TestExtractStorageUsageDereferenceCheck(t *testing.T) { require.NotPanics(t, func() { extractStorageUsage(disk) }) - } func TestGetNetworkStats(t *testing.T) { diff --git a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/resource_test.go b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/resource_test.go index c01e92d901ea..9a11ee93a11c 100644 --- a/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/resource_test.go +++ b/receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/resource_test.go @@ -195,5 +195,4 @@ func TestGetNameFromCluster(t *testing.T) { clusterName = getNameFromCluster("") require.LessOrEqual(t, 0, len(clusterName)) - } diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go index 43b5568e7854..a7afe38b292d 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go @@ -84,7 +84,6 @@ func (u Unmarshaler) Unmarshal(records [][]byte) (plog.Logs, error) { builders[attrs] = lb } lb.AddLog(log) - } } } diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go index a35361d6bf64..9fd61356c1b5 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go @@ -97,7 +97,6 @@ func TestUnmarshal(t *testing.T) { } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { - got, err := unmarshaler.Unmarshal(testCase.records) if testCase.wantErr != nil { require.Error(t, err) diff --git a/receiver/awsfirehosereceiver/logs_receiver.go b/receiver/awsfirehosereceiver/logs_receiver.go index a7b8c0628525..2bf02f3bd400 100644 --- a/receiver/awsfirehosereceiver/logs_receiver.go +++ b/receiver/awsfirehosereceiver/logs_receiver.go @@ -37,7 +37,6 @@ func newLogsReceiver( unmarshalers map[string]unmarshaler.LogsUnmarshaler, nextConsumer consumer.Logs, ) (receiver.Logs, error) { - recordType := config.RecordType if recordType == "" { recordType = defaultLogsRecordType diff --git a/receiver/awsfirehosereceiver/metrics_receiver.go b/receiver/awsfirehosereceiver/metrics_receiver.go index db24595ccc48..2bb466292aa9 100644 --- a/receiver/awsfirehosereceiver/metrics_receiver.go +++ b/receiver/awsfirehosereceiver/metrics_receiver.go @@ -37,7 +37,6 @@ func newMetricsReceiver( unmarshalers map[string]unmarshaler.MetricsUnmarshaler, nextConsumer consumer.Metrics, ) (receiver.Metrics, error) { - recordType := config.RecordType if recordType == "" { recordType = defaultMetricsRecordType diff --git a/receiver/awsxrayreceiver/internal/translator/http.go b/receiver/awsxrayreceiver/internal/translator/http.go index 3459c14a3c4e..bac348352e62 100644 --- a/receiver/awsxrayreceiver/internal/translator/http.go +++ b/receiver/awsxrayreceiver/internal/translator/http.go @@ -51,5 +51,4 @@ func addHTTP(seg *awsxray.Segment, span ptrace.Span) { addInt64(&lengthPointer, conventions.AttributeHTTPResponseContentLength, attrs) } } - } diff --git a/receiver/awsxrayreceiver/internal/translator/translator.go b/receiver/awsxrayreceiver/internal/translator/translator.go index 1e21ecc324dc..e3a05d40d560 100644 --- a/receiver/awsxrayreceiver/internal/translator/translator.go +++ b/receiver/awsxrayreceiver/internal/translator/translator.go @@ -75,7 +75,6 @@ func ToTraces(rawSeg []byte, recorder telemetry.Recorder) (ptrace.Traces, int, e } func segToSpans(seg awsxray.Segment, traceID, parentID *string, spans ptrace.SpanSlice) (ptrace.Span, error) { - span := spans.AppendEmpty() err := populateSpan(&seg, traceID, parentID, span) @@ -111,7 +110,6 @@ func segToSpans(seg awsxray.Segment, traceID, parentID *string, spans ptrace.Spa } func populateSpan(seg *awsxray.Segment, traceID, parentID *string, span ptrace.Span) error { - attrs := span.Attributes() attrs.Clear() attrs.EnsureCapacity(initAttrCapacity) @@ -129,13 +127,11 @@ func populateSpan(seg *awsxray.Segment, traceID, parentID *string, span ptrace.S if err != nil { return err } - } else { traceIDBytes, err = decodeXRayTraceID(seg.TraceID) if err != nil { return err } - } // decode parent id diff --git a/receiver/awsxrayreceiver/internal/translator/translator_test.go b/receiver/awsxrayreceiver/internal/translator/translator_test.go index f241cca3ef34..c0f32a852a79 100644 --- a/receiver/awsxrayreceiver/internal/translator/translator_test.go +++ b/receiver/awsxrayreceiver/internal/translator/translator_test.go @@ -1122,5 +1122,4 @@ func TestDecodeXRaySpanID(t *testing.T) { // null point _, err = decodeXRaySpanID(nil) assert.Error(t, err) - } diff --git a/receiver/awsxrayreceiver/receiver.go b/receiver/awsxrayreceiver/receiver.go index c6ccb4b75e33..c45c3cb6cb90 100644 --- a/receiver/awsxrayreceiver/receiver.go +++ b/receiver/awsxrayreceiver/receiver.go @@ -41,7 +41,6 @@ type xrayReceiver struct { func newReceiver(config *Config, consumer consumer.Traces, set receiver.Settings) (receiver.Traces, error) { - set.Logger.Info("Going to listen on endpoint for X-Ray segments", zap.String(udppoller.Transport, config.Endpoint)) poller, err := udppoller.New(&udppoller.Config{ diff --git a/receiver/azureblobreceiver/blobclient.go b/receiver/azureblobreceiver/blobclient.go index c9e030b59c93..b3243834d05d 100644 --- a/receiver/azureblobreceiver/blobclient.go +++ b/receiver/azureblobreceiver/blobclient.go @@ -24,7 +24,6 @@ type azureBlobClient struct { var _ blobClient = (*azureBlobClient)(nil) func (bc *azureBlobClient) readBlob(ctx context.Context, containerName string, blobName string) (*bytes.Buffer, error) { - defer func() { _, blobDeleteErr := bc.serviceClient.DeleteBlob(ctx, containerName, blobName, nil) if blobDeleteErr != nil { diff --git a/receiver/azureblobreceiver/blobeventhandler.go b/receiver/azureblobreceiver/blobeventhandler.go index 44fa7c44080b..d096240db7dc 100644 --- a/receiver/azureblobreceiver/blobeventhandler.go +++ b/receiver/azureblobreceiver/blobeventhandler.go @@ -37,7 +37,6 @@ const ( ) func (p *azureBlobEventHandler) run(ctx context.Context) error { - if p.hub != nil { return nil } @@ -65,7 +64,6 @@ func (p *azureBlobEventHandler) run(ctx context.Context) error { } func (p *azureBlobEventHandler) newMessageHandler(ctx context.Context, event *eventhub.Event) error { - type eventData struct { Topic string Subject string @@ -112,7 +110,6 @@ func (p *azureBlobEventHandler) newMessageHandler(ctx context.Context, event *ev } func (p *azureBlobEventHandler) close(ctx context.Context) error { - if p.hub != nil { err := p.hub.Close(ctx) if err != nil { diff --git a/receiver/azureblobreceiver/blobeventhandler_test.go b/receiver/azureblobreceiver/blobeventhandler_test.go index a8ad6190431c..9ccf1b30c1b8 100644 --- a/receiver/azureblobreceiver/blobeventhandler_test.go +++ b/receiver/azureblobreceiver/blobeventhandler_test.go @@ -50,7 +50,6 @@ func TestNewMessageHangdler(t *testing.T) { logsDataConsumer.AssertNumberOfCalls(t, "consumeLogsJSON", 1) tracesDataConsumer.AssertNumberOfCalls(t, "consumeTracesJSON", 1) blobClient.AssertNumberOfCalls(t, "readBlob", 2) - } func getEvent(eventData []byte) *eventhub.Event { diff --git a/receiver/azureblobreceiver/factory.go b/receiver/azureblobreceiver/factory.go index 91d71f253008..440bcf1ecb51 100644 --- a/receiver/azureblobreceiver/factory.go +++ b/receiver/azureblobreceiver/factory.go @@ -60,7 +60,6 @@ func (f *blobReceiverFactory) createLogsReceiver( cfg component.Config, nextConsumer consumer.Logs, ) (receiver.Logs, error) { - receiver, err := f.getReceiver(set, cfg) if err != nil { @@ -79,7 +78,6 @@ func (f *blobReceiverFactory) createTracesReceiver( cfg component.Config, nextConsumer consumer.Traces, ) (receiver.Traces, error) { - receiver, err := f.getReceiver(set, cfg) if err != nil { @@ -94,7 +92,6 @@ func (f *blobReceiverFactory) createTracesReceiver( func (f *blobReceiverFactory) getReceiver( set receiver.Settings, cfg component.Config) (component.Component, error) { - var err error r := f.receivers.GetOrAdd(cfg, func() component.Component { receiverConfig, ok := cfg.(*Config) diff --git a/receiver/azureblobreceiver/receiver.go b/receiver/azureblobreceiver/receiver.go index 9d0b569b268d..93dadc33534a 100644 --- a/receiver/azureblobreceiver/receiver.go +++ b/receiver/azureblobreceiver/receiver.go @@ -57,7 +57,6 @@ func (b *blobReceiver) setNextTracesConsumer(nextTracesConsumer consumer.Traces) } func (b *blobReceiver) consumeLogsJSON(ctx context.Context, json []byte) error { - if b.nextLogsConsumer == nil { return nil } diff --git a/receiver/azureeventhubreceiver/azureresourcelogs_unmarshaler.go b/receiver/azureeventhubreceiver/azureresourcelogs_unmarshaler.go index 6b0b6329f893..3c3c6a04387d 100644 --- a/receiver/azureeventhubreceiver/azureresourcelogs_unmarshaler.go +++ b/receiver/azureeventhubreceiver/azureresourcelogs_unmarshaler.go @@ -45,6 +45,5 @@ func newAzureResourceLogsUnmarshaler(buildInfo component.BuildInfo, logger *zap. // OpenTelemetry representation; the bodies of the // OpenTelemetry log records are empty. func (r AzureResourceLogsEventUnmarshaler) UnmarshalLogs(event *eventhub.Event) (plog.Logs, error) { - return r.unmarshaler.UnmarshalLogs(event.Data) } diff --git a/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go b/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go index fcf82c9b3b15..efef7e72a60a 100644 --- a/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go +++ b/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go @@ -51,7 +51,6 @@ type azureMetricRecord struct { } func newAzureResourceMetricsUnmarshaler(buildInfo component.BuildInfo, logger *zap.Logger) eventMetricsUnmarshaler { - return azureResourceMetricsUnmarshaler{ buildInfo: buildInfo, logger: logger, @@ -64,7 +63,6 @@ func newAzureResourceMetricsUnmarshaler(buildInfo component.BuildInfo, logger *z // metric record appears as fields and attributes in the // OpenTelemetry representation; func (r azureResourceMetricsUnmarshaler) UnmarshalMetrics(event *eventhub.Event) (pmetric.Metrics, error) { - md := pmetric.NewMetrics() var azureMetrics azureMetricRecords diff --git a/receiver/azureeventhubreceiver/eventhubhandler.go b/receiver/azureeventhubreceiver/eventhubhandler.go index 0a8aeadd0d62..bf48cb1047f9 100644 --- a/receiver/azureeventhubreceiver/eventhubhandler.go +++ b/receiver/azureeventhubreceiver/eventhubhandler.go @@ -123,7 +123,6 @@ func (h *eventhubHandler) run(ctx context.Context, host component.Host) error { } func (h *eventhubHandler) setUpOnePartition(ctx context.Context, partitionID string, applyOffset bool) error { - receiverOptions := []eventhub.ReceiveOption{} if applyOffset && h.config.Offset != "" { receiverOptions = append(receiverOptions, eventhub.ReceiveWithStartingOffset(h.config.Offset)) @@ -151,7 +150,6 @@ func (h *eventhubHandler) setUpOnePartition(ctx context.Context, partitionID str } func (h *eventhubHandler) newMessageHandler(ctx context.Context, event *eventhub.Event) error { - err := h.dataConsumer.consume(ctx, event) if err != nil { h.settings.Logger.Error("error decoding message", zap.Error(err)) @@ -162,7 +160,6 @@ func (h *eventhubHandler) newMessageHandler(ctx context.Context, event *eventhub } func (h *eventhubHandler) close(ctx context.Context) error { - if h.hub != nil { err := h.hub.Close(ctx) if err != nil { @@ -178,12 +175,10 @@ func (h *eventhubHandler) close(ctx context.Context) error { } func (h *eventhubHandler) setDataConsumer(dataConsumer dataConsumer) { - h.dataConsumer = dataConsumer } func newEventhubHandler(config *Config, settings receiver.Settings) *eventhubHandler { - return &eventhubHandler{ config: config, settings: settings, diff --git a/receiver/azureeventhubreceiver/eventhubhandler_test.go b/receiver/azureeventhubreceiver/eventhubhandler_test.go index 5058ffe168e4..438f71bddc5d 100644 --- a/receiver/azureeventhubreceiver/eventhubhandler_test.go +++ b/receiver/azureeventhubreceiver/eventhubhandler_test.go @@ -74,7 +74,6 @@ func (m *mockDataConsumer) setNextTracesConsumer(nextTracesConsumer consumer.Tra func (m *mockDataConsumer) setNextMetricsConsumer(_ consumer.Metrics) {} func (m *mockDataConsumer) consume(ctx context.Context, event *eventhub.Event) error { - logsContext := m.obsrecv.StartLogsOp(ctx) logs, err := m.logsUnmarshaler.UnmarshalLogs(event) diff --git a/receiver/azureeventhubreceiver/factory.go b/receiver/azureeventhubreceiver/factory.go index 0b20556b7bcc..c0c5f624134f 100644 --- a/receiver/azureeventhubreceiver/factory.go +++ b/receiver/azureeventhubreceiver/factory.go @@ -49,7 +49,6 @@ func (f *eventhubReceiverFactory) createLogsReceiver( cfg component.Config, nextConsumer consumer.Logs, ) (receiver.Logs, error) { - receiver, err := f.getReceiver(pipeline.SignalLogs, cfg, settings) if err != nil { return nil, err @@ -66,7 +65,6 @@ func (f *eventhubReceiverFactory) createMetricsReceiver( cfg component.Config, nextConsumer consumer.Metrics, ) (receiver.Metrics, error) { - receiver, err := f.getReceiver(pipeline.SignalMetrics, cfg, settings) if err != nil { return nil, err @@ -83,7 +81,6 @@ func (f *eventhubReceiverFactory) createTracesReceiver( cfg component.Config, nextConsumer consumer.Traces, ) (receiver.Traces, error) { - receiver, err := f.getReceiver(pipeline.SignalTraces, cfg, settings) if err != nil { return nil, err @@ -99,7 +96,6 @@ func (f *eventhubReceiverFactory) getReceiver( cfg component.Config, settings receiver.Settings, ) (component.Component, error) { - var err error r := f.receivers.GetOrAdd(cfg, func() component.Component { receiverConfig, ok := cfg.(*Config) diff --git a/receiver/azureeventhubreceiver/rawlogs_unmarshaler.go b/receiver/azureeventhubreceiver/rawlogs_unmarshaler.go index 8d7811086859..d0e0b5c3cf1c 100644 --- a/receiver/azureeventhubreceiver/rawlogs_unmarshaler.go +++ b/receiver/azureeventhubreceiver/rawlogs_unmarshaler.go @@ -15,14 +15,12 @@ type rawLogsUnmarshaler struct { } func newRawLogsUnmarshaler(logger *zap.Logger) eventLogsUnmarshaler { - return rawLogsUnmarshaler{ logger: logger, } } func (r rawLogsUnmarshaler) UnmarshalLogs(event *eventhub.Event) (plog.Logs, error) { - l := plog.NewLogs() lr := l.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty() slice := lr.Body().SetEmptyBytes() diff --git a/receiver/azureeventhubreceiver/receiver.go b/receiver/azureeventhubreceiver/receiver.go index 09320b2ba2ba..f190e1b276e7 100644 --- a/receiver/azureeventhubreceiver/receiver.go +++ b/receiver/azureeventhubreceiver/receiver.go @@ -88,7 +88,6 @@ func (receiver *eventhubReceiver) consume(ctx context.Context, event *eventhub.E } func (receiver *eventhubReceiver) consumeLogs(ctx context.Context, event *eventhub.Event) error { - if receiver.nextLogsConsumer == nil { return nil } @@ -112,7 +111,6 @@ func (receiver *eventhubReceiver) consumeLogs(ctx context.Context, event *eventh } func (receiver *eventhubReceiver) consumeMetrics(ctx context.Context, event *eventhub.Event) error { - if receiver.nextMetricsConsumer == nil { return nil } @@ -137,7 +135,6 @@ func (receiver *eventhubReceiver) consumeMetrics(ctx context.Context, event *eve } func (receiver *eventhubReceiver) consumeTraces(ctx context.Context, event *eventhub.Event) error { - if receiver.nextTracesConsumer == nil { return nil } @@ -169,7 +166,6 @@ func newReceiver( eventHandler *eventhubHandler, settings receiver.Settings, ) (component.Component, error) { - obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: settings.ID, Transport: "event", diff --git a/receiver/azuremonitorreceiver/scraper.go b/receiver/azuremonitorreceiver/scraper.go index 1e4449016647..3e86b5608b88 100644 --- a/receiver/azuremonitorreceiver/scraper.go +++ b/receiver/azuremonitorreceiver/scraper.go @@ -220,7 +220,6 @@ func (s *azureScraper) loadCredentials() (err error) { } func (s *azureScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { - s.getResources(ctx) resourcesIDsWithDefinitions := make(chan string) @@ -323,7 +322,6 @@ func (s *azureScraper) getResourcesFilter() string { } func (s *azureScraper) getResourceMetricsDefinitions(ctx context.Context, resourceID string) { - if time.Since(s.resources[resourceID].metricsDefinitionsUpdated).Seconds() < s.cfg.CacheResourcesDefinitions { return } @@ -339,7 +337,6 @@ func (s *azureScraper) getResourceMetricsDefinitions(ctx context.Context, resour } for _, v := range nextResult.Value { - timeGrain := *v.MetricAvailabilities[0].TimeGrain name := *v.Name.Value compositeKey := metricsCompositeKey{timeGrain: timeGrain} @@ -374,7 +371,6 @@ func (s *azureScraper) getResourceMetricsValues(ctx context.Context, resourceID res := *s.resources[resourceID] for compositeKey, metricsByGrain := range res.metricsByCompositeKey { - if time.Since(metricsByGrain.metricsValuesUpdated).Seconds() < float64(timeGrains[compositeKey.timeGrain]) { continue } @@ -383,7 +379,6 @@ func (s *azureScraper) getResourceMetricsValues(ctx context.Context, resourceID start := 0 for start < len(metricsByGrain.metrics) { - end := start + s.cfg.MaximumNumberOfMetricsInACall if end > len(metricsByGrain.metrics) { end = len(metricsByGrain.metrics) @@ -410,9 +405,7 @@ func (s *azureScraper) getResourceMetricsValues(ctx context.Context, resourceID } for _, metric := range result.Value { - for _, timeseriesElement := range metric.Timeseries { - if timeseriesElement.Data != nil { attributes := map[string]*string{} for name, value := range res.attributes { diff --git a/receiver/azuremonitorreceiver/scraper_test.go b/receiver/azuremonitorreceiver/scraper_test.go index 2f5b671fc6ee..cd53f3abf940 100644 --- a/receiver/azuremonitorreceiver/scraper_test.go +++ b/receiver/azuremonitorreceiver/scraper_test.go @@ -64,7 +64,6 @@ func armMonitorMetricsClientFuncMock(string, azcore.TokenCredential, *arm.Client } func TestAzureScraperStart(t *testing.T) { - cfg := createDefaultConfig().(*Config) tests := []struct { @@ -340,7 +339,6 @@ func TestAzureScraperScrape(t *testing.T) { pmetrictest.IgnoreMetricsOrder(), )) }) - } } diff --git a/receiver/bigipreceiver/config_test.go b/receiver/bigipreceiver/config_test.go index a08fea071d12..79c547aca55e 100644 --- a/receiver/bigipreceiver/config_test.go +++ b/receiver/bigipreceiver/config_test.go @@ -114,7 +114,6 @@ func TestValidate(t *testing.T) { } else { require.NoError(t, actualErr) } - }) } } diff --git a/receiver/carbonreceiver/factory.go b/receiver/carbonreceiver/factory.go index 7c3a59ae62b2..2715415adef1 100644 --- a/receiver/carbonreceiver/factory.go +++ b/receiver/carbonreceiver/factory.go @@ -51,7 +51,6 @@ func createMetricsReceiver( cfg component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { - rCfg := cfg.(*Config) return newMetricsReceiver(params, *rCfg, consumer) } diff --git a/receiver/carbonreceiver/receiver.go b/receiver/carbonreceiver/receiver.go index ab1ef95a2069..8869550f572f 100644 --- a/receiver/carbonreceiver/receiver.go +++ b/receiver/carbonreceiver/receiver.go @@ -43,7 +43,6 @@ func newMetricsReceiver( config Config, nextConsumer consumer.Metrics, ) (receiver.Metrics, error) { - if config.Endpoint == "" { return nil, errEmptyEndpoint } diff --git a/receiver/cloudflarereceiver/logs.go b/receiver/cloudflarereceiver/logs.go index 3570d8146665..956b38118ca4 100644 --- a/receiver/cloudflarereceiver/logs.go +++ b/receiver/cloudflarereceiver/logs.go @@ -113,7 +113,6 @@ func (l *logsReceiver) startListening(ctx context.Context, host component.Host) l.logger.Error("ServeTLS failed", zap.Error(err)) componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(err)) } - } else { l.logger.Debug("Starting Serve", zap.String("address", l.cfg.Endpoint)) @@ -126,7 +125,6 @@ func (l *logsReceiver) startListening(ctx context.Context, host component.Host) l.logger.Error("Serve failed", zap.Error(err)) componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(err)) } - } }() return nil diff --git a/receiver/cloudflarereceiver/logs_test.go b/receiver/cloudflarereceiver/logs_test.go index 5d7be14fc1c4..2ae786eb142e 100644 --- a/receiver/cloudflarereceiver/logs_test.go +++ b/receiver/cloudflarereceiver/logs_test.go @@ -317,7 +317,6 @@ func TestHandleRequest(t *testing.T) { consumer = consumertest.NewErr(errors.New("consumer failed")) if tc.permanentFailure { consumer = consumertest.NewErr(consumererror.NewPermanent(errors.New("consumer failed"))) - } } else { consumer = &consumertest.LogsSink{} diff --git a/receiver/cloudfoundryreceiver/receiver.go b/receiver/cloudfoundryreceiver/receiver.go index 9581b2f16839..1fb4bf93ce71 100644 --- a/receiver/cloudfoundryreceiver/receiver.go +++ b/receiver/cloudfoundryreceiver/receiver.go @@ -48,7 +48,6 @@ func newCloudFoundryMetricsReceiver( settings receiver.Settings, config Config, nextConsumer consumer.Metrics) (*cloudFoundryReceiver, error) { - obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: settings.ID, Transport: transport, @@ -72,7 +71,6 @@ func newCloudFoundryLogsReceiver( settings receiver.Settings, config Config, nextConsumer consumer.Logs) (*cloudFoundryReceiver, error) { - obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: settings.ID, Transport: transport, @@ -152,7 +150,6 @@ func (cfr *cloudFoundryReceiver) streamMetrics( ctx context.Context, stream loggregator.EnvelopeStream, host component.Host) { - for { // Blocks until non-empty result or context is cancelled (returns nil in that case) envelopes := stream() @@ -192,7 +189,6 @@ func (cfr *cloudFoundryReceiver) streamLogs( ctx context.Context, stream loggregator.EnvelopeStream, host component.Host) { - for { envelopes := stream() if envelopes == nil { diff --git a/receiver/cloudfoundryreceiver/stream.go b/receiver/cloudfoundryreceiver/stream.go index 027639a7c065..338e28e081e1 100644 --- a/receiver/cloudfoundryreceiver/stream.go +++ b/receiver/cloudfoundryreceiver/stream.go @@ -26,7 +26,6 @@ func newEnvelopeStreamFactory( authTokenProvider *UAATokenProvider, httpConfig confighttp.ClientConfig, host component.Host) (*EnvelopeStreamFactory, error) { - httpClient, err := httpConfig.ToClient(ctx, host, settings) if err != nil { return nil, fmt.Errorf("creating HTTP client for Cloud Foundry RLP Gateway: %w", err) diff --git a/receiver/collectdreceiver/receiver.go b/receiver/collectdreceiver/receiver.go index 58c40959817e..5b8d282ca7b3 100644 --- a/receiver/collectdreceiver/receiver.go +++ b/receiver/collectdreceiver/receiver.go @@ -42,7 +42,6 @@ func newCollectdReceiver( defaultAttrsPrefix string, nextConsumer consumer.Metrics, createSettings receiver.Settings) (receiver.Metrics, error) { - r := &collectdReceiver{ logger: logger, nextConsumer: nextConsumer, diff --git a/receiver/collectdreceiver/receiver_test.go b/receiver/collectdreceiver/receiver_test.go index 7deed3c2a564..20c2d402d3fc 100644 --- a/receiver/collectdreceiver/receiver_test.go +++ b/receiver/collectdreceiver/receiver_test.go @@ -212,7 +212,6 @@ func createWantedMetrics(wantedRequestBody wantedBody) pmetric.Metrics { } func assertMetricsAreEqual(t *testing.T, expectedData []pmetric.Metrics, actualData []pmetric.Metrics) { - for i := 0; i < len(expectedData); i++ { err := pmetrictest.CompareMetrics(expectedData[i], actualData[i]) require.NoError(t, err) diff --git a/receiver/couchdbreceiver/client_test.go b/receiver/couchdbreceiver/client_test.go index 9d0a277c0bca..980c936e1bf1 100644 --- a/receiver/couchdbreceiver/client_test.go +++ b/receiver/couchdbreceiver/client_test.go @@ -139,7 +139,6 @@ func TestGet(t *testing.T) { func TestGetNodeStats(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if strings.Contains(r.URL.Path, "/invalid_json") { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"}`)) diff --git a/receiver/couchdbreceiver/factory_test.go b/receiver/couchdbreceiver/factory_test.go index d46c79f63f75..68c611271bb5 100644 --- a/receiver/couchdbreceiver/factory_test.go +++ b/receiver/couchdbreceiver/factory_test.go @@ -49,7 +49,6 @@ func TestCreateMetrics(t *testing.T) { ) require.NoError(t, err) - }, }, } diff --git a/receiver/datadogreceiver/factory.go b/receiver/datadogreceiver/factory.go index 6403be658d3b..e025207f2c99 100644 --- a/receiver/datadogreceiver/factory.go +++ b/receiver/datadogreceiver/factory.go @@ -23,7 +23,6 @@ func NewFactory() receiver.Factory { createDefaultConfig, receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability), receiver.WithTraces(createTracesReceiver, metadata.TracesStability)) - } func createDefaultConfig() component.Config { diff --git a/receiver/datadogreceiver/internal/translator/series_test.go b/receiver/datadogreceiver/internal/translator/series_test.go index e3d0400a0edf..516edfd68277 100644 --- a/receiver/datadogreceiver/internal/translator/series_test.go +++ b/receiver/datadogreceiver/internal/translator/series_test.go @@ -30,7 +30,6 @@ func testPointsToDatadogPoints(points []testPoint) [][]*float64 { datadogPoints[i] = []*float64{float64Ptr(float64(point.Ts)), float64Ptr(point.Value)} } return datadogPoints - } func TestHandleMetricsPayloadV2(t *testing.T) { diff --git a/receiver/datadogreceiver/internal/translator/sketches.go b/receiver/datadogreceiver/internal/translator/sketches.go index cbe31c9e3e0a..bb1283301906 100644 --- a/receiver/datadogreceiver/internal/translator/sketches.go +++ b/receiver/datadogreceiver/internal/translator/sketches.go @@ -208,7 +208,6 @@ func mapSketchBucketsToHistogramBuckets(sketchKeys []int32, sketchCounts []uint3 positiveBuckets[highestCountIdx] += additionalCount } } - } return negativeBuckets, positiveBuckets, zeroCount, nil diff --git a/receiver/datadogreceiver/internal/translator/tags_test.go b/receiver/datadogreceiver/internal/translator/tags_test.go index f7fbff04d296..40630ef71e6f 100644 --- a/receiver/datadogreceiver/internal/translator/tags_test.go +++ b/receiver/datadogreceiver/internal/translator/tags_test.go @@ -97,7 +97,6 @@ func TestGetMetricAttributes(t *testing.T) { return true }) }) - } } @@ -142,7 +141,6 @@ func TestDatadogTagToKeyValuePair(t *testing.T) { assert.Equal(t, c.expectedValue, value, "Expected value %s, got %s", c.expectedValue, value) }) } - } func TestTranslateDataDogKeyToOtel(t *testing.T) { diff --git a/receiver/datadogreceiver/internal/translator/traces_translator_test.go b/receiver/datadogreceiver/internal/translator/traces_translator_test.go index 595242f25bdc..c0d43fae9600 100644 --- a/receiver/datadogreceiver/internal/translator/traces_translator_test.go +++ b/receiver/datadogreceiver/internal/translator/traces_translator_test.go @@ -75,7 +75,6 @@ func getTraces(t *testing.T) (traces pb.Traces) { t.Fatal(err) } return traces - } func TestTracePayloadV05Unmarshalling(t *testing.T) { diff --git a/receiver/datadogreceiver/receiver_test.go b/receiver/datadogreceiver/receiver_test.go index 1588f7240d13..7283c8ba2f77 100644 --- a/receiver/datadogreceiver/receiver_test.go +++ b/receiver/datadogreceiver/receiver_test.go @@ -180,7 +180,6 @@ func TestDatadogResponse(t *testing.T) { require.Equal(t, tc.expectedStatus, resp.StatusCode) }) } - } func TestDatadogInfoEndpoint(t *testing.T) { diff --git a/receiver/elasticsearchreceiver/scraper_test.go b/receiver/elasticsearchreceiver/scraper_test.go index 38d3f0b74f82..f5c592b6b867 100644 --- a/receiver/elasticsearchreceiver/scraper_test.go +++ b/receiver/elasticsearchreceiver/scraper_test.go @@ -258,7 +258,6 @@ func TestScrapingError(t *testing.T) { _, err = sc.scrape(context.Background()) require.True(t, scrapererror.IsPartialScrapeError(err)) require.EqualError(t, err, err404.Error()) - }, }, { @@ -285,7 +284,6 @@ func TestScrapingError(t *testing.T) { _, err = sc.scrape(context.Background()) require.True(t, scrapererror.IsPartialScrapeError(err)) require.EqualError(t, err, err404.Error()) - }, }, { diff --git a/receiver/filelogreceiver/storage_test.go b/receiver/filelogreceiver/storage_test.go index c01da5bfcb21..906a2351502b 100644 --- a/receiver/filelogreceiver/storage_test.go +++ b/receiver/filelogreceiver/storage_test.go @@ -174,7 +174,6 @@ func (l *recallLogger) close() error { func expectLogs(sink *consumertest.LogsSink, expected []string) func() bool { return func() bool { - if sink.LogRecordCount() != len(expected) { return false } diff --git a/receiver/filestatsreceiver/integration_test.go b/receiver/filestatsreceiver/integration_test.go index a9069dbde579..04338777824e 100644 --- a/receiver/filestatsreceiver/integration_test.go +++ b/receiver/filestatsreceiver/integration_test.go @@ -46,5 +46,4 @@ func Test_Integration(t *testing.T) { pmetrictest.IgnoreTimestamp(), ), ).Run(t) - } diff --git a/receiver/flinkmetricsreceiver/config_test.go b/receiver/flinkmetricsreceiver/config_test.go index 44751d4317ec..68b137fa728e 100644 --- a/receiver/flinkmetricsreceiver/config_test.go +++ b/receiver/flinkmetricsreceiver/config_test.go @@ -56,7 +56,6 @@ func TestValidate(t *testing.T) { } else { require.NoError(t, actualErr) } - }) } } diff --git a/receiver/fluentforwardreceiver/factory.go b/receiver/fluentforwardreceiver/factory.go index 14abfd1dba35..13ecbbdbdaf1 100644 --- a/receiver/fluentforwardreceiver/factory.go +++ b/receiver/fluentforwardreceiver/factory.go @@ -31,7 +31,6 @@ func createLogsReceiver( cfg component.Config, consumer consumer.Logs, ) (receiver.Logs, error) { - rCfg := cfg.(*Config) return newFluentReceiver(params, rCfg, consumer) } diff --git a/receiver/githubreceiver/factory.go b/receiver/githubreceiver/factory.go index 239b3ccadf29..a8936fa5d484 100644 --- a/receiver/githubreceiver/factory.go +++ b/receiver/githubreceiver/factory.go @@ -67,7 +67,6 @@ func createMetricsReceiver( cfg component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { - // check that the configuration is valid conf, ok := cfg.(*Config) if !ok { diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go index 95e24bc9be47..927a444322ad 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go @@ -153,7 +153,6 @@ func (ghs *githubScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { ghs.mb.RecordVcsRepositoryRefTimeDataPoint(now, age, branch.Repository.Name, branch.Name, refType) ghs.mb.RecordVcsRepositoryRefLinesAddedDataPoint(now, int64(additions), branch.Repository.Name, branch.Name, refType) ghs.mb.RecordVcsRepositoryRefLinesDeletedDataPoint(now, int64(deletions), branch.Repository.Name, branch.Name, refType) - } // Get the contributor count for each of the repositories @@ -179,7 +178,6 @@ func (ghs *githubScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { age := getAge(pr.CreatedAt, pr.MergedAt) ghs.mb.RecordVcsRepositoryChangeTimeToMergeDataPoint(now, age, name, pr.HeadRefName) - } else { open++ diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper_test.go b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper_test.go index da17a909aee5..8a0178865d65 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper_test.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper_test.go @@ -196,7 +196,6 @@ func TestScrape(t *testing.T) { pmetrictest.IgnoreTimestamp(), pmetrictest.IgnoreStartTimestamp(), )) - }) } } diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/helpers.go b/receiver/githubreceiver/internal/scraper/githubscraper/helpers.go index 740411422d33..a2f4d0a0d9a4 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/helpers.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/helpers.go @@ -128,7 +128,6 @@ func (ghs *githubScraper) createClients() (gClient graphql.Client, rClient *gith gClient = graphql.NewClient(defaultGraphURL, ghs.client) if ghs.cfg.ClientConfig.Endpoint != "" { - // Given endpoint set as `https://myGHEserver.com` we need to join the path // with `api/graphql` gu, err := url.JoinPath(ghs.cfg.ClientConfig.Endpoint, "api/graphql") @@ -260,7 +259,6 @@ func (ghs *githubScraper) evalCommits( additions += c.Nodes[b].Additions deletions += c.Nodes[b].Deletions } - } return additions, deletions, age, nil } diff --git a/receiver/googlecloudmonitoringreceiver/factory.go b/receiver/googlecloudmonitoringreceiver/factory.go index ca3e239f33d4..6996314eb08d 100644 --- a/receiver/googlecloudmonitoringreceiver/factory.go +++ b/receiver/googlecloudmonitoringreceiver/factory.go @@ -37,7 +37,6 @@ func createMetricsReceiver( baseCfg component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { - rCfg := baseCfg.(*Config) r := newGoogleCloudMonitoringReceiver(rCfg, settings.Logger) diff --git a/receiver/googlecloudpubsubreceiver/factory.go b/receiver/googlecloudpubsubreceiver/factory.go index 107ce002596b..e8ff793fb3b8 100644 --- a/receiver/googlecloudpubsubreceiver/factory.go +++ b/receiver/googlecloudpubsubreceiver/factory.go @@ -70,7 +70,6 @@ func (factory *pubsubReceiverFactory) CreateTraces( params receiver.Settings, cfg component.Config, consumer consumer.Traces) (receiver.Traces, error) { - err := cfg.(*Config).validateForTrace() if err != nil { return nil, err @@ -88,7 +87,6 @@ func (factory *pubsubReceiverFactory) CreateMetrics( params receiver.Settings, cfg component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { - err := cfg.(*Config).validateForMetric() if err != nil { return nil, err @@ -106,7 +104,6 @@ func (factory *pubsubReceiverFactory) CreateLogs( params receiver.Settings, cfg component.Config, consumer consumer.Logs) (receiver.Logs, error) { - err := cfg.(*Config).validateForLog() if err != nil { return nil, err diff --git a/receiver/googlecloudpubsubreceiver/internal/handler.go b/receiver/googlecloudpubsubreceiver/internal/handler.go index 666790db97cc..fbb466fed8cb 100644 --- a/receiver/googlecloudpubsubreceiver/internal/handler.go +++ b/receiver/googlecloudpubsubreceiver/internal/handler.go @@ -57,7 +57,6 @@ func NewHandler( clientID string, subscription string, callback func(ctx context.Context, message *pubsubpb.ReceivedMessage) error) (*StreamHandler, error) { - handler := StreamHandler{ logger: logger, client: client, diff --git a/receiver/googlecloudpubsubreceiver/internal/log_entry_test.go b/receiver/googlecloudpubsubreceiver/internal/log_entry_test.go index cf2df7f95f2c..a5b959b06013 100644 --- a/receiver/googlecloudpubsubreceiver/internal/log_entry_test.go +++ b/receiver/googlecloudpubsubreceiver/internal/log_entry_test.go @@ -64,7 +64,6 @@ func generateLog(t *testing.T, log Log) (pcommon.Resource, plog.LogRecord, error } func TestTranslateLogEntry(t *testing.T) { - tests := []struct { input string want Log diff --git a/receiver/googlecloudpubsubreceiver/receiver.go b/receiver/googlecloudpubsubreceiver/receiver.go index 504546201e2e..31b53a3c2851 100644 --- a/receiver/googlecloudpubsubreceiver/receiver.go +++ b/receiver/googlecloudpubsubreceiver/receiver.go @@ -170,7 +170,6 @@ func (receiver *pubsubReceiver) handleCloudLoggingLogEntry(ctx context.Context, lr.CopyTo(ills.LogRecords().AppendEmpty()) return receiver.logsConsumer.ConsumeLogs(ctx, out) - } func decompress(payload []byte, compression compression) ([]byte, error) { diff --git a/receiver/googlecloudspannerreceiver/factory.go b/receiver/googlecloudspannerreceiver/factory.go index 60b6c5af5b42..6bffce4cc43d 100644 --- a/receiver/googlecloudspannerreceiver/factory.go +++ b/receiver/googlecloudspannerreceiver/factory.go @@ -46,7 +46,6 @@ func createMetricsReceiver( baseCfg component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { - rCfg := baseCfg.(*Config) r := newGoogleCloudSpannerReceiver(settings.Logger, rCfg) diff --git a/receiver/googlecloudspannerreceiver/internal/filterfactory/filterbuilder.go b/receiver/googlecloudspannerreceiver/internal/filterfactory/filterbuilder.go index 8e7827734b52..b9a0a2a43abe 100644 --- a/receiver/googlecloudspannerreceiver/internal/filterfactory/filterbuilder.go +++ b/receiver/googlecloudspannerreceiver/internal/filterfactory/filterbuilder.go @@ -57,7 +57,6 @@ func (b filterBuilder) buildFilterByMetricPositiveTotalLimit() (map[string]filte func (b filterBuilder) handleLowCardinalityGroups(groups []*metadata.MetricsMetadata, remainingTotalLimit int, filterByMetric map[string]filter.ItemFilter) (int, error) { - if len(groups) == 0 { return remainingTotalLimit, nil } @@ -73,7 +72,6 @@ func (b filterBuilder) handleLowCardinalityGroups(groups []*metadata.MetricsMeta func (b filterBuilder) handleHighCardinalityGroups(groups []*metadata.MetricsMetadata, remainingTotalLimit int, filterByMetric map[string]filter.ItemFilter) (int, error) { - if len(groups) == 0 { return remainingTotalLimit, nil } @@ -94,7 +92,6 @@ func (b filterBuilder) handleHighCardinalityGroups(groups []*metadata.MetricsMet func (b filterBuilder) constructFiltersForGroups(totalLimitPerMetric int, limitPerMetricByTimestamp int, groups []*metadata.MetricsMetadata, remainingTotalLimit int, filterByMetric map[string]filter.ItemFilter) (int, error) { - newTotalLimit := remainingTotalLimit for _, metadataItem := range groups { diff --git a/receiver/googlecloudspannerreceiver/internal/metadata/metricsbuilder_test.go b/receiver/googlecloudspannerreceiver/internal/metadata/metricsbuilder_test.go index 294e7aa0f57c..3ddbfde3ff78 100644 --- a/receiver/googlecloudspannerreceiver/internal/metadata/metricsbuilder_test.go +++ b/receiver/googlecloudspannerreceiver/internal/metadata/metricsbuilder_test.go @@ -29,7 +29,6 @@ type mockItemFilterResolver struct { func (r *mockItemFilterResolver) Resolve(string) (filter.ItemFilter, error) { args := r.Called() return args.Get(0).(filter.ItemFilter), args.Error(1) - } func (r *mockItemFilterResolver) Shutdown() error { @@ -345,7 +344,6 @@ func executeShutdown(t *testing.T, metricsBuilder MetricsBuilder, expectError bo func executeMockedShutdown(t *testing.T, metricsBuilder MetricsBuilder, filterResolver *mockItemFilterResolver, expectedError error) { - filterResolver.On("Shutdown").Return(expectedError) _ = metricsBuilder.Shutdown() filterResolver.AssertExpectations(t) diff --git a/receiver/googlecloudspannerreceiver/internal/metadata/metricsmetadata.go b/receiver/googlecloudspannerreceiver/internal/metadata/metricsmetadata.go index cb21d8b88b38..497f3c1a1479 100644 --- a/receiver/googlecloudspannerreceiver/internal/metadata/metricsmetadata.go +++ b/receiver/googlecloudspannerreceiver/internal/metadata/metricsmetadata.go @@ -112,7 +112,6 @@ func (metadata *MetricsMetadata) RowToMetricsDataPoints(databaseID *datasource.D func (metadata *MetricsMetadata) toMetricsDataPoints(databaseID *datasource.DatabaseID, timestamp time.Time, labelValues []LabelValue, metricValues []MetricValue) []*MetricsDataPoint { - dataPoints := make([]*MetricsDataPoint, len(metricValues)) for i, metricValue := range metricValues { diff --git a/receiver/googlecloudspannerreceiver/internal/metadata/metricvalue.go b/receiver/googlecloudspannerreceiver/internal/metadata/metricvalue.go index d5f78b5c1710..0bb81e368886 100644 --- a/receiver/googlecloudspannerreceiver/internal/metadata/metricvalue.go +++ b/receiver/googlecloudspannerreceiver/internal/metadata/metricvalue.go @@ -142,7 +142,6 @@ func newNullFloat64MetricValue(metadata MetricValueMetadata, valueHolder any) Me func NewMetricValueMetadata(name string, columnName string, dataType MetricType, unit string, valueType ValueType) (MetricValueMetadata, error) { - var newMetricValueFunc newMetricValueFunction var valueHolderFunc valueHolderFunction diff --git a/receiver/googlecloudspannerreceiver/internal/statsreader/currentstatsreader.go b/receiver/googlecloudspannerreceiver/internal/statsreader/currentstatsreader.go index 955c2e53b235..3c6c50a06a45 100644 --- a/receiver/googlecloudspannerreceiver/internal/statsreader/currentstatsreader.go +++ b/receiver/googlecloudspannerreceiver/internal/statsreader/currentstatsreader.go @@ -41,7 +41,6 @@ func newCurrentStatsReader( database *datasource.Database, metricsMetadata *metadata.MetricsMetadata, config ReaderConfig) *currentStatsReader { - return ¤tStatsReader{ logger: logger, database: database, diff --git a/receiver/googlecloudspannerreceiver/internal/statsreader/databasereader.go b/receiver/googlecloudspannerreceiver/internal/statsreader/databasereader.go index 38b37ea28ccf..8574ce9b3044 100644 --- a/receiver/googlecloudspannerreceiver/internal/statsreader/databasereader.go +++ b/receiver/googlecloudspannerreceiver/internal/statsreader/databasereader.go @@ -26,7 +26,6 @@ func NewDatabaseReader(ctx context.Context, serviceAccountPath string, readerConfig ReaderConfig, logger *zap.Logger) (*DatabaseReader, error) { - database, err := datasource.NewDatabase(ctx, databaseID, serviceAccountPath) if err != nil { return nil, fmt.Errorf("error occurred during client instantiation for database %q: %w", databaseID.ID(), err) diff --git a/receiver/googlecloudspannerreceiver/internal/statsreader/intervalstatsreader.go b/receiver/googlecloudspannerreceiver/internal/statsreader/intervalstatsreader.go index 485edbee0d47..03ffbc0ff337 100644 --- a/receiver/googlecloudspannerreceiver/internal/statsreader/intervalstatsreader.go +++ b/receiver/googlecloudspannerreceiver/internal/statsreader/intervalstatsreader.go @@ -37,7 +37,6 @@ func newIntervalStatsReader( database *datasource.Database, metricsMetadata *metadata.MetricsMetadata, config ReaderConfig) *intervalStatsReader { - reader := currentStatsReader{ logger: logger, database: database, diff --git a/receiver/googlecloudspannerreceiver/internal/statsreader/timestampsgenerator_test.go b/receiver/googlecloudspannerreceiver/internal/statsreader/timestampsgenerator_test.go index 93b666cf31a8..b95099274bd3 100644 --- a/receiver/googlecloudspannerreceiver/internal/statsreader/timestampsgenerator_test.go +++ b/receiver/googlecloudspannerreceiver/internal/statsreader/timestampsgenerator_test.go @@ -74,7 +74,6 @@ func TestPullTimestampsWithDifference(t *testing.T) { } assert.Equal(t, upperBound, timestamps[expectedAmountOfTimestamps]) - } func TestShiftToStartOfMinute(t *testing.T) { diff --git a/receiver/googlecloudspannerreceiver/receiver.go b/receiver/googlecloudspannerreceiver/receiver.go index ef2397c3adfa..b13a0621288b 100644 --- a/receiver/googlecloudspannerreceiver/receiver.go +++ b/receiver/googlecloudspannerreceiver/receiver.go @@ -111,7 +111,6 @@ func (r *googleCloudSpannerReceiver) initialize(ctx context.Context) error { func (r *googleCloudSpannerReceiver) initializeProjectReaders(ctx context.Context, parsedMetadata []*metadata.MetricsMetadata) error { - readerConfig := statsreader.ReaderConfig{ BackfillEnabled: r.config.BackfillEnabled, TopMetricsQueryMaxRows: r.config.TopMetricsQueryMaxRows, diff --git a/receiver/haproxyreceiver/scraper.go b/receiver/haproxyreceiver/scraper.go index c6ab3f304843..851efef2d342 100644 --- a/receiver/haproxyreceiver/scraper.go +++ b/receiver/haproxyreceiver/scraper.go @@ -40,10 +40,8 @@ type scraper struct { } func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { - var records []map[string]string if u, notURLerr := url.Parse(s.cfg.Endpoint); notURLerr == nil && strings.HasPrefix(u.Scheme, "http") { - resp, err := s.httpClient.Get(s.cfg.Endpoint + ";csv") if err != nil { return pmetric.NewMetrics(), err diff --git a/receiver/hostmetricsreceiver/integration_test.go b/receiver/hostmetricsreceiver/integration_test.go index 303223f47194..2238b2fed0b5 100644 --- a/receiver/hostmetricsreceiver/integration_test.go +++ b/receiver/hostmetricsreceiver/integration_test.go @@ -55,7 +55,6 @@ func Test_ProcessScrape(t *testing.T) { pmetrictest.IgnoreTimestamp(), ), ).Run(t) - } func Test_ProcessScrapeWithCustomRootPath(t *testing.T) { @@ -88,7 +87,6 @@ func Test_ProcessScrapeWithCustomRootPath(t *testing.T) { pmetrictest.IgnoreTimestamp(), ), ).Run(t) - } func Test_ProcessScrapeWithBadRootPathAndEnvVar(t *testing.T) { @@ -121,5 +119,4 @@ func Test_ProcessScrapeWithBadRootPathAndEnvVar(t *testing.T) { pmetrictest.IgnoreTimestamp(), ), ).Run(t) - } diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go index 480a7f3d14f1..9886f24ed413 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go @@ -171,7 +171,6 @@ func TestCpuUtilizationCalculator_Calculate(t *testing.T) { } func Test_cpuUtilization(t *testing.T) { - timeStart := cpu.TimesStat{ CPU: "cpu0", User: 1.5, @@ -196,7 +195,6 @@ func Test_cpuUtilization(t *testing.T) { assert.InDelta(t, expectedUtilization.User, actualUtilization.User, 0.00001) assert.InDelta(t, expectedUtilization.System, actualUtilization.System, 0.00001) assert.InDelta(t, expectedUtilization.Idle, actualUtilization.Idle, 0.00001) - } func Test_cpuTimeByCpu(t *testing.T) { diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_linux.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_linux.go index 3ad37064d458..5572a97ca198 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_linux.go @@ -44,7 +44,6 @@ func parseSwapsFile(r io.Reader) ([]*pageFileStats, error) { return nil, fmt.Errorf("couldn't read file %q: %w", swapsFilePath, err) } return nil, fmt.Errorf("unexpected end-of-file in %q", swapsFilePath) - } // Check header headerFields are as expected diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go index ec94be5a8a1f..631c308f65c0 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go @@ -189,7 +189,6 @@ func assertPagingUtilizationMetricValid(t *testing.T, hostPagingUtilizationMetri } func assertPagingOperationsMetricValid(t *testing.T, pagingMetric []pmetric.Metric, startTime pcommon.Timestamp, removeAttribute bool) { - type test struct { name string description string diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go index c937b58558d7..c6b788c57d1c 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go @@ -1318,5 +1318,4 @@ func TestScrapeMetrics_CpuUtilizationWhenCpuTimesIsDisabled(t *testing.T) { } }) } - } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go index fda6a06bb7d0..35d5e1611902 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go @@ -130,13 +130,11 @@ func TestCpuUtilizationCalculator_Calculate(t *testing.T) { assert.InDelta(t, test.expectedUtilization.User, recorder.cpuUtilization.User, 0.00001) assert.InDelta(t, test.expectedUtilization.Iowait, recorder.cpuUtilization.Iowait, 0.00001) } - }) } } func Test_cpuUtilization(t *testing.T) { - startTime := pcommon.Timestamp(1640097435776827000) halfSecondLater := pcommon.Timestamp(uint64(startTime) + uint64(time.Second.Nanoseconds()/2)) startStat := &cpu.TimesStat{ @@ -159,5 +157,4 @@ func Test_cpuUtilization(t *testing.T) { assert.InDelta(t, expectedUtilization.User, actualUtilization.User, 0.00001) assert.InDelta(t, expectedUtilization.System, actualUtilization.System, 0.00001) assert.InDelta(t, expectedUtilization.Iowait, actualUtilization.Iowait, 0.00001) - } diff --git a/receiver/httpcheckreceiver/config_test.go b/receiver/httpcheckreceiver/config_test.go index 905de862e827..eb77a724c4d5 100644 --- a/receiver/httpcheckreceiver/config_test.go +++ b/receiver/httpcheckreceiver/config_test.go @@ -115,7 +115,6 @@ func TestValidate(t *testing.T) { } else { require.NoError(t, actualErr) } - }) } } diff --git a/receiver/httpcheckreceiver/scraper_test.go b/receiver/httpcheckreceiver/scraper_test.go index d85180eed0bb..8f9b05a48490 100644 --- a/receiver/httpcheckreceiver/scraper_test.go +++ b/receiver/httpcheckreceiver/scraper_test.go @@ -195,7 +195,6 @@ func TestNilClient(t *testing.T) { actualMetrics, err := scraper.scrape(context.Background()) require.EqualError(t, err, errClientNotInit.Error()) require.NoError(t, pmetrictest.CompareMetrics(pmetric.NewMetrics(), actualMetrics)) - } func TestScraperMultipleTargets(t *testing.T) { diff --git a/receiver/jaegerreceiver/config_test.go b/receiver/jaegerreceiver/config_test.go index 01d92eb056b1..ee9a05b6e23d 100644 --- a/receiver/jaegerreceiver/config_test.go +++ b/receiver/jaegerreceiver/config_test.go @@ -236,7 +236,6 @@ func TestInvalidConfig(t *testing.T) { err := component.ValidateConfig(cfg) assert.Error(t, err, tC.err) - }) } } diff --git a/receiver/jaegerreceiver/factory.go b/receiver/jaegerreceiver/factory.go index 9316f47732d7..6409641fc85f 100644 --- a/receiver/jaegerreceiver/factory.go +++ b/receiver/jaegerreceiver/factory.go @@ -47,7 +47,6 @@ var once sync.Once func logDeprecation(logger *zap.Logger) { once.Do(func() { logger.Warn("jaeger receiver will deprecate Thrift-gen and replace it with Proto-gen to be compatbible to jaeger 1.42.0 and higher. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/18485 for more details.") - }) } diff --git a/receiver/jmxreceiver/internal/subprocess/subprocess_test.go b/receiver/jmxreceiver/internal/subprocess/subprocess_test.go index 7ef92c5593a5..4b7ebdd9409e 100644 --- a/receiver/jmxreceiver/internal/subprocess/subprocess_test.go +++ b/receiver/jmxreceiver/internal/subprocess/subprocess_test.go @@ -65,5 +65,4 @@ func TestPidAccessors(t *testing.T) { subprocess.pid.setPid(123) require.Equal(t, 123, subprocess.pid.getPid()) require.Equal(t, 123, subprocess.Pid()) - } diff --git a/receiver/k8sclusterreceiver/internal/metadata/metadata.go b/receiver/k8sclusterreceiver/internal/metadata/metadata.go index 291dab4d6338..a630239cb754 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/metadata.go +++ b/receiver/k8sclusterreceiver/internal/metadata/metadata.go @@ -135,7 +135,6 @@ func GetMetadataUpdate(oldMetadata, newMetadata map[metadataPkg.ResourceID]*Kube // If the delta between old (oldProps) and new (newProps) revisions of a // resource end up being empty, nil is returned. func getMetadataDelta(oldProps, newProps map[string]string) *metadataPkg.MetadataDelta { - toAdd, toRemove, toUpdate := map[string]string{}, map[string]string{}, map[string]string{} // If metadata exist in the previous revision as well, collect if diff --git a/receiver/k8sclusterreceiver/internal/node/nodes_test.go b/receiver/k8sclusterreceiver/internal/node/nodes_test.go index 72209e7a4372..0910c73fc32d 100644 --- a/receiver/k8sclusterreceiver/internal/node/nodes_test.go +++ b/receiver/k8sclusterreceiver/internal/node/nodes_test.go @@ -93,7 +93,6 @@ func TestNodeOptionalMetrics(t *testing.T) { pmetrictest.IgnoreScopeMetricsOrder(), ), ) - } func TestNodeConditionValue(t *testing.T) { type args struct { diff --git a/receiver/k8sclusterreceiver/receiver_test.go b/receiver/k8sclusterreceiver/receiver_test.go index 533a625ea713..ac579e38f2c0 100644 --- a/receiver/k8sclusterreceiver/receiver_test.go +++ b/receiver/k8sclusterreceiver/receiver_test.go @@ -226,7 +226,6 @@ func setupReceiver( logsConsumer consumer.Logs, initialSyncTimeout time.Duration, tt componenttest.TestTelemetry) *kubernetesReceiver { - distribution := distributionKubernetes if osQuotaClient != nil { distribution = distributionOpenShift diff --git a/receiver/k8sclusterreceiver/watcher_test.go b/receiver/k8sclusterreceiver/watcher_test.go index 29b5d2901ea9..5acda18ca7e1 100644 --- a/receiver/k8sclusterreceiver/watcher_test.go +++ b/receiver/k8sclusterreceiver/watcher_test.go @@ -185,7 +185,6 @@ func TestPrepareSharedInformerFactory(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - obs, logs := observer.New(zap.WarnLevel) obsLogger := zap.New(obs) rw := &resourceWatcher{