Skip to content

Commit

Permalink
run go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
BinaryFissionGames committed Apr 18, 2022
1 parent 957d32c commit 1a6cd54
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 79 deletions.
2 changes: 1 addition & 1 deletion receiver/activedirectorydsreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ import (

type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
Metrics metadata.MetricsSettings `mapstructure:"metrics"`
Metrics metadata.MetricsSettings `mapstructure:"metrics"`
}
130 changes: 65 additions & 65 deletions receiver/activedirectorydsreceiver/counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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{
{
Expand Down
3 changes: 1 addition & 2 deletions receiver/activedirectorydsreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

const (
defaultCollectionInterval = 10 * time.Second
typeStr = "active_directory_ds"
typeStr = "active_directory_ds"
)

func NewFactory() component.ReceiverFactory {
Expand All @@ -37,7 +37,6 @@ func NewFactory() component.ReceiverFactory {
)
}


func createDefaultConfig() config.Receiver {
return &Config{
ScraperControllerSettings: scraperhelper.ScraperControllerSettings{
Expand Down
1 change: 0 additions & 1 deletion receiver/activedirectorydsreceiver/factory_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion receiver/activedirectorydsreceiver/factory_others_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion receiver/activedirectorydsreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestNewFactory(t *testing.T) {

func TestDefaultConfig(t *testing.T) {
t.Parallel()

conf := createDefaultConfig()
require.NotNil(t, conf)
}
8 changes: 4 additions & 4 deletions receiver/activedirectorydsreceiver/factory_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions receiver/activedirectorydsreceiver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion receiver/activedirectorydsreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 1a6cd54

Please sign in to comment.