func NewModuleMonitor(opts Options) (*ModuleMonitor, error) {
	if opts.SysprobeSocketPath != "" {
		net.SetSystemProbePath(opts.SysprobeSocketPath)
	}

	metricNameFn := MetricName
	if opts.MetricNameFn != nil {
		metricNameFn = opts.MetricNameFn
	}

	flusher, err := newStatsdFlusher(opts)
	if err != nil {
		log.Warnf("could not create statsd flusher: %s", err)
	}

	apiFlusher, err := newAPIFlusher(opts, flusher)
	if err != nil {
		log.Warnf("could not create api flusher: %s", err)
	} else {
		flusher = apiFlusher
	}

	if flusher == nil {
		return nil, fmt.Errorf("can't emit system-probe heartbeat metrics")
	}

	return &ModuleMonitor{
		enabledModulesFn: SystemProbeEnabledModules,
		metricNameFn:     metricNameFn,
		flusher:          flusher,
		exit:             make(chan struct{}),
	}, nil
}
// NewModuleMonitor returns a new ModuleMonitor
NewModuleMonitor returns a new ModuleMonitor
// NewModuleMonitor returns a new ModuleMonitor
func NewModuleMonitor(opts Options) (*ModuleMonitor, error) {
	if opts.SysprobeSocketPath != "" {
		net.SetSystemProbePath(opts.SysprobeSocketPath)
	}
	metricNameFn := MetricName
	if opts.MetricNameFn != nil {
		metricNameFn = opts.MetricNameFn
	}
	flusher, err := newStatsdFlusher(opts)
	if err != nil {
		log.Warnf("could not create statsd flusher: %s", err)
	}
	apiFlusher, err := newAPIFlusher(opts, flusher)
	if err != nil {
		log.Warnf("could not create api flusher: %s", err)
	} else {
		flusher = apiFlusher
	}
	if flusher == nil {
		return nil, fmt.Errorf("can't emit system-probe heartbeat metrics")
	}
	return &ModuleMonitor{
		enabledModulesFn: SystemProbeEnabledModules,
		metricNameFn:     metricNameFn,
		flusher:          flusher,
		exit:             make(chan struct{}),
	}, nil
}
func NewModuleMonitor ( opts Options ) ( * ModuleMonitor , error ) { if opts . SysprobeSocketPath != " " { net . SetSystemProbePath ( opts . SysprobeSocketPath ) } metricNameFn := MetricName if opts . MetricNameFn != nil { metricNameFn = opts . MetricNameFn } flusher , err := newStatsdFlusher ( opts ) if err != nil { log . Warnf ( " " , err ) } apiFlusher , err := newAPIFlusher ( opts , flusher ) if err != nil { log . Warnf ( " " , err ) } else { flusher = apiFlusher } if flusher == nil { return nil , fmt . Errorf ( " " ) } return & ModuleMonitor { enabledModulesFn : SystemProbeEnabledModules , metricNameFn : metricNameFn , flusher : flusher , exit : make ( chan struct { } ) , } , nil }
NewModuleMonitor returns a new ModuleMonitor
NewModuleMonitor returns a new ModuleMonitor