internal

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertPollOptions added in v0.62.0

type AlertPollOptions struct {
	PageNum  int
	PageSize int
}

type GetAccessLogsOptions added in v0.78.0

type GetAccessLogsOptions struct {
	// The oldest date to look back for the events
	MinDate time.Time
	// the newest time to accept events
	MaxDate time.Time
	// If true, only return successful access attempts; if false, only return failed access attempts
	// If nil, return both successful and failed access attempts
	AuthResult *bool
	// Maximum number of entries to return
	NLogs int
}

GetAccessLogsOptions are the options to use for making a request to get Access Logs

type GetEventsOptions added in v0.71.0

type GetEventsOptions struct {
	// Which page of the paginated events
	PageNum int
	// How large the Pages will be
	PageSize int
	// The list of Event Types https://www.mongodb.com/docs/atlas/reference/api/events-projects-get-all/#event-type-values
	// to grab from the API
	EventTypes []string
	// The oldest date to look back for the events
	MinDate time.Time
	// the newest time to accept events
	MaxDate time.Time
}

GetEventsOptions are the options to use for making a request to get Project Events

type MongoDBAtlasClient

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

MongoDBAtlasClient wraps the official MongoDB Atlas client to manage pagination and mapping to OpenTelmetry metric and log structures.

func NewMongoDBAtlasClient

func NewMongoDBAtlasClient(
	publicKey string,
	privateKey string,
	backoffConfig configretry.BackOffConfig,
	log *zap.Logger,
) *MongoDBAtlasClient

NewMongoDBAtlasClient creates a new MongoDB Atlas client wrapper

func (*MongoDBAtlasClient) GetAccessLogs added in v0.78.0

func (s *MongoDBAtlasClient) GetAccessLogs(ctx context.Context, groupID string, clusterName string, opts *GetAccessLogsOptions) (ret []*mongodbatlas.AccessLogs, err error)

GetAccessLogs returns the access logs specified for the cluster requested

func (*MongoDBAtlasClient) GetAlerts added in v0.62.0

func (s *MongoDBAtlasClient) GetAlerts(ctx context.Context, groupID string, opts *AlertPollOptions) (ret []mongodbatlas.Alert, nextPage bool, err error)

GetAlerts returns the alerts specified for the set projects

func (*MongoDBAtlasClient) GetClusters added in v0.59.0

func (s *MongoDBAtlasClient) GetClusters(ctx context.Context, groupID string) ([]mongodbatlas.Cluster, error)

GetClusters retrieves the clusters from the mongo API using API call: https://www.mongodb.com/docs/atlas/reference/api/clusters-get-all/#request

func (*MongoDBAtlasClient) GetLogs added in v0.59.0

func (s *MongoDBAtlasClient) GetLogs(ctx context.Context, groupID, hostname, logName string, start, end time.Time) (*bytes.Buffer, error)

GetLogs retrieves the logs from the mongo API using API call: https://www.mongodb.com/docs/atlas/reference/api/logs/#syntax

func (*MongoDBAtlasClient) GetOrganization added in v0.59.0

func (s *MongoDBAtlasClient) GetOrganization(ctx context.Context, orgID string) (*mongodbatlas.Organization, error)

GetOrganization retrieves a single organization specified by orgID

func (*MongoDBAtlasClient) GetOrganizationEvents added in v0.75.0

func (s *MongoDBAtlasClient) GetOrganizationEvents(ctx context.Context, orgID string, opts *GetEventsOptions) (ret []*mongodbatlas.Event, nextPage bool, err error)

GetOrgEvents returns the events specified for the set organizations

func (*MongoDBAtlasClient) GetProject added in v0.59.0

func (s *MongoDBAtlasClient) GetProject(ctx context.Context, projectName string) (*mongodbatlas.Project, error)

GetProject returns a single project specified by projectName

func (*MongoDBAtlasClient) GetProjectEvents added in v0.75.0

func (s *MongoDBAtlasClient) GetProjectEvents(ctx context.Context, groupID string, opts *GetEventsOptions) (ret []*mongodbatlas.Event, nextPage bool, err error)

GetProjectEvents returns the events specified for the set projects

func (*MongoDBAtlasClient) Organizations

func (s *MongoDBAtlasClient) Organizations(ctx context.Context) ([]*mongodbatlas.Organization, error)

Organizations returns a list of all organizations available with the supplied credentials

func (*MongoDBAtlasClient) ProcessDatabaseMetrics added in v0.38.0

func (s *MongoDBAtlasClient) ProcessDatabaseMetrics(
	ctx context.Context,
	mb *metadata.MetricsBuilder,
	projectID string,
	host string,
	port int,
	dbname string,
	start string,
	end string,
	resolution string,
) error

ProcessDatabaseMetrics returns metrics about a particular database running within a MongoDB Atlas process

func (*MongoDBAtlasClient) ProcessDatabases added in v0.38.0

func (s *MongoDBAtlasClient) ProcessDatabases(
	ctx context.Context,
	projectID string,
	host string,
	port int,
) ([]*mongodbatlas.ProcessDatabase, error)

ProcessDatabases lists databases that are running in a given MongoDB Atlas process

func (*MongoDBAtlasClient) ProcessDiskMetrics added in v0.38.0

func (s *MongoDBAtlasClient) ProcessDiskMetrics(
	ctx context.Context,
	mb *metadata.MetricsBuilder,
	projectID string,
	host string,
	port int,
	partitionName string,
	start string,
	end string,
	resolution string,
) error

ProcessDiskMetrics returns metrics supplied for a particular disk partition used by a MongoDB Atlas process

func (*MongoDBAtlasClient) ProcessDisks added in v0.38.0

func (s *MongoDBAtlasClient) ProcessDisks(
	ctx context.Context,
	projectID string,
	host string,
	port int,
) []*mongodbatlas.ProcessDisk

ProcessDisks enumerates the disks accessible to a specified MongoDB Atlas process

func (*MongoDBAtlasClient) ProcessMetrics added in v0.38.0

func (s *MongoDBAtlasClient) ProcessMetrics(
	ctx context.Context,
	mb *metadata.MetricsBuilder,
	projectID string,
	host string,
	port int,
	start string,
	end string,
	resolution string,
) error

ProcessMetrics returns a set of metrics associated with the specified running process.

func (*MongoDBAtlasClient) Processes added in v0.38.0

func (s *MongoDBAtlasClient) Processes(
	ctx context.Context,
	projectID string,
) ([]*mongodbatlas.Process, error)

Processes returns the list of processes running for a given project.

func (*MongoDBAtlasClient) Projects added in v0.38.0

func (s *MongoDBAtlasClient) Projects(
	ctx context.Context,
	orgID string,
) ([]*mongodbatlas.Project, error)

Projects returns a list of projects accessible within the provided organization

func (*MongoDBAtlasClient) Shutdown added in v0.43.0

func (s *MongoDBAtlasClient) Shutdown() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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