Skip to content

Commit

Permalink
[chore][receiver/windowsperfcounters] Fix lint on Windows (open-telem…
Browse files Browse the repository at this point in the history
…etry#30674)

**Description:**
Fixing lint issues when GOOS=windows. This is in preparation to
eventually include lint with GOOS=windows as part of CI.

**Link to tracking Issue:**
N/A

**Testing:**
`make` on component folder on a Windows box

**Documentation:**
N/A

---------

Co-authored-by: Daniel Jaglowski <[email protected]>
  • Loading branch information
pjanotti and djaglowski committed Jan 22, 2024
1 parent 5fce801 commit 148d97c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion receiver/windowsperfcountersreceiver/factory_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// createMetricsReceiver creates a metrics receiver based on provided config.
func createMetricsReceiver(
ctx context.Context,
_ context.Context,
params receiver.CreateSettings,
cfg component.Config,
consumer consumer.Metrics,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,9 @@ func initializeMetricDps(metric pmetric.Metric, now pcommon.Timestamp, counterVa
if counterValue.InstanceName != "" {
dp.Attributes().PutStr(instanceLabelName, counterValue.InstanceName)
}
if attributes != nil {
for attKey, attVal := range attributes {
dp.Attributes().PutStr(attKey, attVal)
}

for attKey, attVal := range attributes {
dp.Attributes().PutStr(attKey, attVal)
}

dp.SetTimestamp(now)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (

type mockPerfCounter struct {
counterValues []winperfcounters.CounterValue
metricRep MetricRep
path string
scrapeErr error
closeErr error
Expand Down Expand Up @@ -57,9 +56,8 @@ func Test_WindowsPerfCounterScraper(t *testing.T) {
name string
cfg *Config

mockCounterPath string
startMessage string
startErr string
startMessage string
startErr string

expectedMetricPath string
}
Expand Down Expand Up @@ -175,8 +173,10 @@ func Test_WindowsPerfCounterScraper(t *testing.T) {

require.NoError(t, err)
expectedMetrics, err := golden.ReadMetrics(test.expectedMetricPath)
pmetrictest.CompareMetrics(expectedMetrics, actualMetrics, pmetrictest.IgnoreMetricValues())
require.NoError(t, err)

// TODO: Metrics comparison is failing, not verifying the result until that is fixed.
_ = pmetrictest.CompareMetrics(expectedMetrics, actualMetrics, pmetrictest.IgnoreMetricValues())
})
}
}
Expand Down Expand Up @@ -340,7 +340,8 @@ func TestScrape(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
mpc := mockPerfCounter{counterValues: test.mockCounterValues}
s := &scraper{cfg: &test.cfg, newWatcher: mockPerfCounterFactory(mpc)}
testConfig := test.cfg
s := &scraper{cfg: &testConfig, newWatcher: mockPerfCounterFactory(mpc)}
errs := s.start(context.Background(), componenttest.NewNopHost())
require.NoError(t, errs)

Expand Down

0 comments on commit 148d97c

Please sign in to comment.