integration

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_INTERVAL                     = 60
	LAST_UPDATE_EVENT_TYPE               = "IntegrationLastUpdate"
	LAST_UPDATE_INTEGRATION_ID_ATTR_NAME = "integrationId"
	LAST_UPDATE_COMPONENT_ID_ATTR_NAME   = "componentId"
)

Variables

This section is empty.

Functions

func NewConfigWithFile

func NewConfigWithFile(configFile string) error

func NewConfigWithPaths

func NewConfigWithPaths() error

Types

type Component added in v2.1.0

type Component interface {
	Identifiable
	Start(ctx context.Context, wg *sync.WaitGroup) error
	Execute(ctx context.Context) error
	ExecuteSync(ctx context.Context) error
	Shutdown(ctx context.Context) error
}

type ExecuteSyncFunc added in v2.1.0

type ExecuteSyncFunc func(ctx context.Context, li *LabsIntegration) error

type Identifiable added in v2.1.0

type Identifiable interface {
	GetId() string
}

type InfraIntegrationArgs

type InfraIntegrationArgs struct {
	nriSdkArgs.DefaultArgumentList
	ConfigPath  string `help:"Path to configuration"`
	ShowVersion bool   `default:"false" help:"Print build information and exit"`
	EnvPrefix   string `default:"" help:"Prefix to use for environment variable lookup"`
}

type LabsIntegration

type LabsIntegration struct {
	Name         string
	Id           string
	BuildInfo    build.BuildInfo
	App          *newrelic.Application
	Integration  *nriSdk.Integration
	Logger       *logrus.Logger
	Interval     time.Duration
	NrClient     *nrClient.NewRelic
	RunAsService bool
	DryRun       bool
	// contains filtered or unexported fields
}

func NewInfraIntegration

func NewInfraIntegration(
	name, id string,
	labsIntegrationOpts ...LabsIntegrationOpt,
) (*LabsIntegration, error)

func NewLambdaIntegration

func NewLambdaIntegration(
	name, id, appName string,
	labsIntegrationOpts ...LabsIntegrationOpt,
) (*LabsIntegration, error)

func NewStandaloneIntegration

func NewStandaloneIntegration(
	name, id, appName string,
	labsIntegrationOpts ...LabsIntegrationOpt,
) (*LabsIntegration, error)

func (*LabsIntegration) AddComponent added in v2.1.0

func (i *LabsIntegration) AddComponent(
	c Component,
)

func (*LabsIntegration) AddEvent

func (i *LabsIntegration) AddEvent(
	ctx context.Context,
	eventType string,
	attributes map[string]interface{},
) error

func (*LabsIntegration) AddEventImmediate added in v2.1.0

func (i *LabsIntegration) AddEventImmediate(
	ctx context.Context,
	eventType string,
	attributes map[string]interface{},
) error

func (*LabsIntegration) AddLastUpdateTimestamp added in v2.1.0

func (i *LabsIntegration) AddLastUpdateTimestamp(
	ctx context.Context,
	componentId string,
) error

func (*LabsIntegration) AddSchedule added in v2.1.0

func (i *LabsIntegration) AddSchedule(
	crontab string,
	components []Component,
)

func (*LabsIntegration) GetAccountId added in v2.1.0

func (i *LabsIntegration) GetAccountId() int

func (*LabsIntegration) GetApiKey

func (i *LabsIntegration) GetApiKey() string

func (*LabsIntegration) GetLastUpdateTimestamp added in v2.1.0

func (i *LabsIntegration) GetLastUpdateTimestamp(
	ctx context.Context,
	componentId string,
) (*time.Time, error)

func (*LabsIntegration) GetLicenseKey

func (i *LabsIntegration) GetLicenseKey() string

func (*LabsIntegration) GetRegion

func (i *LabsIntegration) GetRegion() region.Name

func (*LabsIntegration) Run

func (i *LabsIntegration) Run(ctx context.Context) error

func (*LabsIntegration) Shutdown

func (i *LabsIntegration) Shutdown(ctx context.Context)

func (*LabsIntegration) UseLastUpdate added in v2.1.0

func (i *LabsIntegration) UseLastUpdate(
	ctx context.Context,
	lastUpdateFunc LastUpdateFunc,
	componentId string,
) error

type LabsIntegrationOpt

type LabsIntegrationOpt func(li *LabsIntegration) error

func WithAccountId

func WithAccountId() LabsIntegrationOpt

func WithApiKey

func WithApiKey() LabsIntegrationOpt

func WithClient

func WithClient() LabsIntegrationOpt

func WithEvents

func WithEvents(ctx context.Context) LabsIntegrationOpt

func WithInterval

func WithInterval(defaultInterval int) LabsIntegrationOpt

func WithLastUpdate added in v2.1.0

func WithLastUpdate() LabsIntegrationOpt

func WithLicenseKey

func WithLicenseKey() LabsIntegrationOpt

func WithLogs

func WithLogs(ctx context.Context) LabsIntegrationOpt

type LastUpdateFunc added in v2.1.0

type LastUpdateFunc func(lastUpdate time.Time) error

type SimpleComponent added in v2.1.0

type SimpleComponent struct {
	// contains filtered or unexported fields
}

func NewSimpleComponent added in v2.1.0

func NewSimpleComponent(
	id string,
	i *LabsIntegration,
	executeFunc ExecuteSyncFunc,
) *SimpleComponent

func (*SimpleComponent) Execute added in v2.1.0

func (s *SimpleComponent) Execute(
	ctx context.Context,
) error

func (*SimpleComponent) ExecuteSync added in v2.1.0

func (s *SimpleComponent) ExecuteSync(
	ctx context.Context,
) error

func (*SimpleComponent) GetId added in v2.1.0

func (s *SimpleComponent) GetId() string

func (*SimpleComponent) Shutdown added in v2.1.0

func (t *SimpleComponent) Shutdown(ctx context.Context) error

func (*SimpleComponent) Start added in v2.1.0

func (s *SimpleComponent) Start(ctx context.Context, wg *sync.WaitGroup) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL