...

Source file src/github.com/launchdarkly/go-server-sdk/v6/ldcomponents/no_events.go

Documentation: github.com/launchdarkly/go-server-sdk/v6/ldcomponents

     1  package ldcomponents
     2  
     3  import (
     4  	ldevents "github.com/launchdarkly/go-sdk-events/v2"
     5  	"github.com/launchdarkly/go-server-sdk/v6/subsystems"
     6  )
     7  
     8  type nullEventProcessorFactory struct{}
     9  
    10  // NoEvents returns a configuration object that disables analytics events.
    11  //
    12  // Storing this in the Events field of [github.com/launchdarkly/go-server-sdk/v6.Config] causes the
    13  // SDK to discard all analytics events and not send them to LaunchDarkly, regardless of any other configuration.
    14  //
    15  //	config := ld.Config{
    16  //	    Events: ldcomponents.NoEvents(),
    17  //	}
    18  func NoEvents() subsystems.ComponentConfigurer[ldevents.EventProcessor] {
    19  	return nullEventProcessorFactory{}
    20  }
    21  
    22  func (f nullEventProcessorFactory) Build(
    23  	context subsystems.ClientContext,
    24  ) (ldevents.EventProcessor, error) {
    25  	return ldevents.NewNullEventProcessor(), nil
    26  }
    27  
    28  // This method implements a hidden interface in ldclient_events.go, as a hint to the SDK that this is
    29  // the stub implementation of EventProcessorFactory and therefore LDClient does not need to bother
    30  // generating events at all.
    31  func (f nullEventProcessorFactory) IsNullEventProcessorFactory() bool {
    32  	return true
    33  }
    34  

View as plain text