func getWatchers()

in receiver/activedirectorydsreceiver/counters.go [84:220]


func getWatchers(wc watcherCreator) (*watchers, error) {
	var err error

	w := &watchers{
		counterNameToWatcher: make(map[string]winperfcounters.PerfCounterWatcher),
	}

	if w.counterNameToWatcher[draInboundBytesCompressed], err = wc.Create(draInboundBytesCompressed); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draInboundBytesNotCompressed], err = wc.Create(draInboundBytesNotCompressed); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draOutboundBytesCompressed], err = wc.Create(draOutboundBytesCompressed); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draOutboundBytesNotCompressed], err = wc.Create(draOutboundBytesNotCompressed); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draInboundFullSyncObjectsRemaining], err = wc.Create(draInboundFullSyncObjectsRemaining); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draInboundObjects], err = wc.Create(draInboundObjects); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draOutboundObjects], err = wc.Create(draOutboundObjects); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draInboundProperties], err = wc.Create(draInboundProperties); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draOutboundProperties], err = wc.Create(draOutboundProperties); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draInboundValuesDNs], err = wc.Create(draInboundValuesDNs); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draInboundValuesTotal], err = wc.Create(draInboundValuesTotal); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draOutboundValuesDNs], err = wc.Create(draOutboundValuesDNs); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draOutboundValuesTotal], err = wc.Create(draOutboundValuesTotal); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draPendingReplicationOperations], err = wc.Create(draPendingReplicationOperations); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draSyncFailuresSchemaMismatch], err = wc.Create(draSyncFailuresSchemaMismatch); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draSyncRequestsSuccessful], err = wc.Create(draSyncRequestsSuccessful); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[draSyncRequestsMade], err = wc.Create(draSyncRequestsMade); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsDirectoryReads], err = wc.Create(dsDirectoryReads); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsDirectoryWrites], err = wc.Create(dsDirectoryWrites); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsDirectorySearches], err = wc.Create(dsDirectorySearches); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsClientBinds], err = wc.Create(dsClientBinds); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsServerBinds], err = wc.Create(dsServerBinds); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsNameCacheHitRate], err = wc.Create(dsNameCacheHitRate); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsNotifyQueueSize], err = wc.Create(dsNotifyQueueSize); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsSecurityDescriptorPropagationsEvents], err = wc.Create(dsSecurityDescriptorPropagationsEvents); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsSearchSubOperations], err = wc.Create(dsSearchSubOperations); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsSecurityDescriptorSubOperations], err = wc.Create(dsSecurityDescriptorSubOperations); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[dsThreadsInUse], err = wc.Create(dsThreadsInUse); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[ldapClientSessions], err = wc.Create(ldapClientSessions); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[ldapBindTime], err = wc.Create(ldapBindTime); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[ldapSuccessfulBinds], err = wc.Create(ldapSuccessfulBinds); err != nil {
		return nil, err
	}

	if w.counterNameToWatcher[ldapSearches], err = wc.Create(ldapSearches); err != nil {
		return nil, err
	}

	return w, nil
}