Skip to content

Commit

Permalink
[chore][receiver/activedirectoryds] Fix lint on Windows issues (open-…
Browse files Browse the repository at this point in the history
…telemetry#29796)

**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
  • Loading branch information
pjanotti authored Dec 14, 2023
1 parent 66a8793 commit c49dbc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions receiver/activedirectorydsreceiver/counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const (
draOutboundObjects = "DRA Outbound Objects/sec"
draInboundProperties = "DRA Inbound Properties Total/sec"
draOutboundProperties = "DRA Outbound Properties/sec"
draInboundValuesDNs = "DRA Inbound Values (DNs only)/sec"
draInboundValuesDNs = "DRA Inbound Values (DNs only)/sec" //revive:disable-line:var-naming
draInboundValuesTotal = "DRA Inbound Values Total/sec"
draOutboundValuesDNs = "DRA Outbound Values (DNs only)/sec"
draOutboundValuesDNs = "DRA Outbound Values (DNs only)/sec" //revive:disable-line:var-naming
draOutboundValuesTotal = "DRA Outbound Values Total/sec"
draPendingReplicationOperations = "DRA Pending Replication Operations"
draSyncFailuresSchemaMismatch = "DRA Sync Failures on Schema Mismatch"
Expand Down
2 changes: 1 addition & 1 deletion receiver/activedirectorydsreceiver/factory_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
var errConfigNotActiveDirectory = fmt.Errorf("config is not valid for the '%s' receiver", metadata.Type)

func createMetricsReceiver(
ctx context.Context,
_ context.Context,
params receiver.CreateSettings,
rConf component.Config,
consumer consumer.Metrics,
Expand Down
10 changes: 6 additions & 4 deletions receiver/activedirectorydsreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func newActiveDirectoryDSScraper(mbc metadata.MetricsBuilderConfig, params recei
}
}

func (a *activeDirectoryDSScraper) start(ctx context.Context, host component.Host) error {
func (a *activeDirectoryDSScraper) start(_ context.Context, _ component.Host) error {
watchers, err := getWatchers(defaultWatcherCreater{})
if err != nil {
return fmt.Errorf("failed to create performance counter watchers: %w", err)
Expand All @@ -45,7 +45,7 @@ func (a *activeDirectoryDSScraper) start(ctx context.Context, host component.Hos
return nil
}

func (a *activeDirectoryDSScraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
func (a *activeDirectoryDSScraper) scrape(_ context.Context) (pmetric.Metrics, error) {
var multiErr error
now := pcommon.NewTimestampFromTime(time.Now())

Expand Down Expand Up @@ -103,6 +103,7 @@ func (a *activeDirectoryDSScraper) scrape(ctx context.Context) (pmetric.Metrics,
a.mb.RecordActiveDirectoryDsReplicationPropertyRateDataPoint(now, draOutboundProperties, metadata.AttributeDirectionSent)
}

//revive:disable-next-line:var-naming
draInboundValuesDNs, dnsErr := a.w.Scrape(draInboundValuesDNs)
multiErr = multierr.Append(multiErr, dnsErr)
if dnsErr == nil {
Expand All @@ -116,6 +117,7 @@ func (a *activeDirectoryDSScraper) scrape(ctx context.Context) (pmetric.Metrics,
a.mb.RecordActiveDirectoryDsReplicationValueRateDataPoint(now, otherValuesInbound, metadata.AttributeDirectionReceived, metadata.AttributeValueTypeOther)
}

//revive:disable-next-line:var-naming
draOutboundValuesDNs, dnsErr := a.w.Scrape(draOutboundValuesDNs)
multiErr = multierr.Append(multiErr, dnsErr)
if dnsErr == nil {
Expand Down Expand Up @@ -245,10 +247,10 @@ func (a *activeDirectoryDSScraper) scrape(ctx context.Context) (pmetric.Metrics,
}

if multiErr != nil {
return pmetric.Metrics(a.mb.Emit()), scrapererror.NewPartialScrapeError(multiErr, len(multierr.Errors(multiErr)))
return a.mb.Emit(), scrapererror.NewPartialScrapeError(multiErr, len(multierr.Errors(multiErr)))
}

return pmetric.Metrics(a.mb.Emit()), nil
return a.mb.Emit(), nil
}

func (a *activeDirectoryDSScraper) shutdown(_ context.Context) error {
Expand Down

0 comments on commit c49dbc1

Please sign in to comment.