diff --git a/receiver/activedirectorydsreceiver/config.go b/receiver/activedirectorydsreceiver/config.go index 6d402221c323..ab5af808489d 100644 --- a/receiver/activedirectorydsreceiver/config.go +++ b/receiver/activedirectorydsreceiver/config.go @@ -22,5 +22,5 @@ import ( type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` - Metrics metadata.MetricsSettings `mapstructure:"metrics"` + Metrics metadata.MetricsSettings `mapstructure:"metrics"` } diff --git a/receiver/activedirectorydsreceiver/counters.go b/receiver/activedirectorydsreceiver/counters.go index e5ce25236828..7f75502fe87e 100644 --- a/receiver/activedirectorydsreceiver/counters.go +++ b/receiver/activedirectorydsreceiver/counters.go @@ -20,38 +20,38 @@ package activedirectorydsreceiver // import "github.com/open-telemetry/opentelem import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/winperfcounters" type watchers struct { - DRAInboundBytesCompressed winperfcounters.PerfCounterWatcher - DRAInboundBytesNotCompressed winperfcounters.PerfCounterWatcher - DRAOutboundBytesCompressed winperfcounters.PerfCounterWatcher - DRAOutboundBytesNotCompressed winperfcounters.PerfCounterWatcher - DRAInboundFullSyncObjectsRemaining winperfcounters.PerfCounterWatcher - DRAInboundObjects winperfcounters.PerfCounterWatcher - DRAOutboundObjects winperfcounters.PerfCounterWatcher - DRAInboundProperties winperfcounters.PerfCounterWatcher - DRAOutboundProperties winperfcounters.PerfCounterWatcher - DRAInboundValuesDNs winperfcounters.PerfCounterWatcher - DRAInboundValuesTotal winperfcounters.PerfCounterWatcher - DRAOutboundValuesDNs winperfcounters.PerfCounterWatcher - DRAOutboundValuesTotal winperfcounters.PerfCounterWatcher - DRAPendingReplicationOperations winperfcounters.PerfCounterWatcher - DRASyncFailuresSchemaMismatch winperfcounters.PerfCounterWatcher - DRASyncRequestsSuccessful winperfcounters.PerfCounterWatcher - DRASyncRequestsMade winperfcounters.PerfCounterWatcher - DSDirectoryReads winperfcounters.PerfCounterWatcher - DSDirectoryWrites winperfcounters.PerfCounterWatcher - DSDirectorySearches winperfcounters.PerfCounterWatcher - DSClientBinds winperfcounters.PerfCounterWatcher - DSServerBinds winperfcounters.PerfCounterWatcher - DSNameCacheHitRate winperfcounters.PerfCounterWatcher - DSNotifyQueueSize winperfcounters.PerfCounterWatcher + DRAInboundBytesCompressed winperfcounters.PerfCounterWatcher + DRAInboundBytesNotCompressed winperfcounters.PerfCounterWatcher + DRAOutboundBytesCompressed winperfcounters.PerfCounterWatcher + DRAOutboundBytesNotCompressed winperfcounters.PerfCounterWatcher + DRAInboundFullSyncObjectsRemaining winperfcounters.PerfCounterWatcher + DRAInboundObjects winperfcounters.PerfCounterWatcher + DRAOutboundObjects winperfcounters.PerfCounterWatcher + DRAInboundProperties winperfcounters.PerfCounterWatcher + DRAOutboundProperties winperfcounters.PerfCounterWatcher + DRAInboundValuesDNs winperfcounters.PerfCounterWatcher + DRAInboundValuesTotal winperfcounters.PerfCounterWatcher + DRAOutboundValuesDNs winperfcounters.PerfCounterWatcher + DRAOutboundValuesTotal winperfcounters.PerfCounterWatcher + DRAPendingReplicationOperations winperfcounters.PerfCounterWatcher + DRASyncFailuresSchemaMismatch winperfcounters.PerfCounterWatcher + DRASyncRequestsSuccessful winperfcounters.PerfCounterWatcher + DRASyncRequestsMade winperfcounters.PerfCounterWatcher + DSDirectoryReads winperfcounters.PerfCounterWatcher + DSDirectoryWrites winperfcounters.PerfCounterWatcher + DSDirectorySearches winperfcounters.PerfCounterWatcher + DSClientBinds winperfcounters.PerfCounterWatcher + DSServerBinds winperfcounters.PerfCounterWatcher + DSNameCacheHitRate winperfcounters.PerfCounterWatcher + DSNotifyQueueSize winperfcounters.PerfCounterWatcher DSSecurityDescriptorPropagationsEvents winperfcounters.PerfCounterWatcher - DSSearchSubOperations winperfcounters.PerfCounterWatcher - DSSecurityDescripterSubOperations winperfcounters.PerfCounterWatcher - DSThreadsInUse winperfcounters.PerfCounterWatcher - LDAPClientSessions winperfcounters.PerfCounterWatcher - LDAPBindTime winperfcounters.PerfCounterWatcher - LDAPSuccessfulBinds winperfcounters.PerfCounterWatcher - LDAPSearches winperfcounters.PerfCounterWatcher + DSSearchSubOperations winperfcounters.PerfCounterWatcher + DSSecurityDescripterSubOperations winperfcounters.PerfCounterWatcher + DSThreadsInUse winperfcounters.PerfCounterWatcher + LDAPClientSessions winperfcounters.PerfCounterWatcher + LDAPBindTime winperfcounters.PerfCounterWatcher + LDAPSuccessfulBinds winperfcounters.PerfCounterWatcher + LDAPSearches winperfcounters.PerfCounterWatcher } func getWatchers() (*watchers, error) { @@ -214,51 +214,51 @@ func getWatchers() (*watchers, error) { if err != nil { return nil, err } - + return &watchers{ - DRAInboundBytesCompressed: DRAInboundBytesCompressed, - DRAInboundBytesNotCompressed: DRAInboundBytesNotCompressed, - DRAOutboundBytesCompressed: DRAOutboundBytesCompressed, - DRAOutboundBytesNotCompressed: DRAOutboundBytesNotCompressed, - DRAInboundFullSyncObjectsRemaining: DRAInboundFullSyncObjectsRemaining, - DRAInboundObjects: DRAInboundObjects, - DRAOutboundObjects: DRAOutboundObjects, - DRAInboundProperties: DRAInboundProperties, - DRAOutboundProperties: DRAOutboundProperties, - DRAInboundValuesDNs: DRAInboundValuesDNs, - DRAInboundValuesTotal: DRAInboundValuesTotal, - DRAOutboundValuesDNs: DRAOutboundValuesDNs, - DRAOutboundValuesTotal: DRAOutboundValuesTotal, - DRAPendingReplicationOperations: DRAPendingReplicationOperations, - DRASyncFailuresSchemaMismatch: DRASyncFailuresSchemaMismatch, - DRASyncRequestsSuccessful: DRASyncRequestsSuccessful, - DRASyncRequestsMade: DRASyncRequestsMade, - DSDirectoryReads: DSDirectoryReads, - DSDirectoryWrites: DSDirectoryWrites, - DSDirectorySearches: DSDirectorySearches, - DSClientBinds: DSClientBinds, - DSServerBinds: DSServerBinds, - DSNameCacheHitRate: DSNameCacheHitRate, - DSNotifyQueueSize: DSNotifyQueueSize, + DRAInboundBytesCompressed: DRAInboundBytesCompressed, + DRAInboundBytesNotCompressed: DRAInboundBytesNotCompressed, + DRAOutboundBytesCompressed: DRAOutboundBytesCompressed, + DRAOutboundBytesNotCompressed: DRAOutboundBytesNotCompressed, + DRAInboundFullSyncObjectsRemaining: DRAInboundFullSyncObjectsRemaining, + DRAInboundObjects: DRAInboundObjects, + DRAOutboundObjects: DRAOutboundObjects, + DRAInboundProperties: DRAInboundProperties, + DRAOutboundProperties: DRAOutboundProperties, + DRAInboundValuesDNs: DRAInboundValuesDNs, + DRAInboundValuesTotal: DRAInboundValuesTotal, + DRAOutboundValuesDNs: DRAOutboundValuesDNs, + DRAOutboundValuesTotal: DRAOutboundValuesTotal, + DRAPendingReplicationOperations: DRAPendingReplicationOperations, + DRASyncFailuresSchemaMismatch: DRASyncFailuresSchemaMismatch, + DRASyncRequestsSuccessful: DRASyncRequestsSuccessful, + DRASyncRequestsMade: DRASyncRequestsMade, + DSDirectoryReads: DSDirectoryReads, + DSDirectoryWrites: DSDirectoryWrites, + DSDirectorySearches: DSDirectorySearches, + DSClientBinds: DSClientBinds, + DSServerBinds: DSServerBinds, + DSNameCacheHitRate: DSNameCacheHitRate, + DSNotifyQueueSize: DSNotifyQueueSize, DSSecurityDescriptorPropagationsEvents: DSSecurityDescriptorPropagationsEvents, - DSSearchSubOperations: DSSearchSubOperations, - DSSecurityDescripterSubOperations: DSSecurityDescripterSubOperations, - DSThreadsInUse: DSThreadsInUse, - LDAPClientSessions: LDAPClientSessions, - LDAPBindTime: LDAPBindTime, - LDAPSuccessfulBinds: LDAPSuccessfulBinds, - LDAPSearches: LDAPSearches, + DSSearchSubOperations: DSSearchSubOperations, + DSSecurityDescripterSubOperations: DSSecurityDescripterSubOperations, + DSThreadsInUse: DSThreadsInUse, + LDAPClientSessions: LDAPClientSessions, + LDAPBindTime: LDAPBindTime, + LDAPSuccessfulBinds: LDAPSuccessfulBinds, + LDAPSearches: LDAPSearches, }, nil } const ( instanceName = "NTDS" - object = "DirectoryServices" + object = "DirectoryServices" ) func createWatcher(counterName string) (winperfcounters.PerfCounterWatcher, error) { conf := winperfcounters.ObjectConfig{ - Object: object, + Object: object, Instances: []string{instanceName}, Counters: []winperfcounters.CounterConfig{ { diff --git a/receiver/activedirectorydsreceiver/factory.go b/receiver/activedirectorydsreceiver/factory.go index 837d47cf76f8..3acdd7adf729 100644 --- a/receiver/activedirectorydsreceiver/factory.go +++ b/receiver/activedirectorydsreceiver/factory.go @@ -26,7 +26,7 @@ import ( const ( defaultCollectionInterval = 10 * time.Second - typeStr = "active_directory_ds" + typeStr = "active_directory_ds" ) func NewFactory() component.ReceiverFactory { @@ -37,7 +37,6 @@ func NewFactory() component.ReceiverFactory { ) } - func createDefaultConfig() config.Receiver { return &Config{ ScraperControllerSettings: scraperhelper.ScraperControllerSettings{ diff --git a/receiver/activedirectorydsreceiver/factory_others.go b/receiver/activedirectorydsreceiver/factory_others.go index 07664dc1bceb..fcb6d2490a7e 100644 --- a/receiver/activedirectorydsreceiver/factory_others.go +++ b/receiver/activedirectorydsreceiver/factory_others.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/collector/consumer" ) - var errReceiverNotSupported = fmt.Errorf("The '%s' receiver is only supported on Windows", typeStr) func createMetricsReceiver( diff --git a/receiver/activedirectorydsreceiver/factory_others_test.go b/receiver/activedirectorydsreceiver/factory_others_test.go index 82422db6ca7b..6ab71f6d09d0 100644 --- a/receiver/activedirectorydsreceiver/factory_others_test.go +++ b/receiver/activedirectorydsreceiver/factory_others_test.go @@ -28,7 +28,7 @@ import ( func TestCreateMetricsReceiver(t *testing.T) { t.Parallel() - + recv, err := createMetricsReceiver(context.Background(), component.ReceiverCreateSettings{}, &Config{}, &consumertest.MetricsSink{}) require.Nil(t, recv) require.ErrorIs(t, err, errReceiverNotSupported) diff --git a/receiver/activedirectorydsreceiver/factory_test.go b/receiver/activedirectorydsreceiver/factory_test.go index 0a1222b6b5e8..f291f2656a1c 100644 --- a/receiver/activedirectorydsreceiver/factory_test.go +++ b/receiver/activedirectorydsreceiver/factory_test.go @@ -29,7 +29,7 @@ func TestNewFactory(t *testing.T) { func TestDefaultConfig(t *testing.T) { t.Parallel() - + conf := createDefaultConfig() require.NotNil(t, conf) } diff --git a/receiver/activedirectorydsreceiver/factory_windows.go b/receiver/activedirectorydsreceiver/factory_windows.go index 8f9cec482659..880ca6f1dd5f 100644 --- a/receiver/activedirectorydsreceiver/factory_windows.go +++ b/receiver/activedirectorydsreceiver/factory_windows.go @@ -42,16 +42,16 @@ func createMetricsReceiver( adds := newActiveDirectoryDSScraper(c.Metrics) scraper, err := scraperhelper.NewScraper( - typeStr, - adds.scrape, - scraperhelper.WithStart(adds.start), + typeStr, + adds.scrape, + scraperhelper.WithStart(adds.start), scraperhelper.WithShutdown(adds.shutdown), ) if err != nil { return nil, err } - + return scraperhelper.NewScraperControllerReceiver( &c.ScraperControllerSettings, params, diff --git a/receiver/activedirectorydsreceiver/integration_test.go b/receiver/activedirectorydsreceiver/integration_test.go index cf61710a3572..4e4acb7feca9 100644 --- a/receiver/activedirectorydsreceiver/integration_test.go +++ b/receiver/activedirectorydsreceiver/integration_test.go @@ -33,16 +33,16 @@ import ( TestIntegration test scraping metrics from a running Active Directory domain controller. The domain controller must be set up locally outside of this test in order for it to pass. */ -func TestIntegration(t *testing.T){ +func TestIntegration(t *testing.T) { t.Parallel() - + fact := NewFactory() consumer := &consumertest.MetricsSink{} recv, err := fact.CreateMetricsReceiver(context.Background(), componenttest.NewNopReceiverCreateSettings(), fact.CreateDefaultConfig(), consumer) require.NoError(t, err) - + err = recv.Start(context.Background(), componenttest.NewNopHost()) require.NoError(t, err) diff --git a/receiver/activedirectorydsreceiver/scraper_test.go b/receiver/activedirectorydsreceiver/scraper_test.go index 20b4b72b1790..078eedbe59e0 100644 --- a/receiver/activedirectorydsreceiver/scraper_test.go +++ b/receiver/activedirectorydsreceiver/scraper_test.go @@ -208,7 +208,7 @@ func TestScrape(t *testing.T) { t.Run("Double shutdown does not error", func(t *testing.T) { t.Parallel() - + mockWatchers := &watchers{ DRAInboundBytesCompressed: mockPerfCounterWatcher{val: 0}, DRAInboundBytesNotCompressed: mockPerfCounterWatcher{val: 1},