mongodbmetrics

package
v0.0.0-...-7370a3d Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package mongodbmetrics implements metric collection for the MongoDB workload agent service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRunCommand

func DefaultRunCommand(ctx context.Context, client *mongo.Client, dbName string, cmd bson.D, receiver any) (any, error)

DefaultRunCommand is the default implementation of the RunCommand function. It uses the Decode method of the SingleResult to decode the result into the receiver.

Types

type MongoDBMetrics

type MongoDBMetrics struct {
	Config *configpb.Configuration

	WLMClient      workloadmanager.WLMWriter
	DBcenterClient databasecenter.Client
	RunCommand     func(ctx context.Context, client *mongo.Client, dbName string, cmd bson.D, resultStruct any) (any, error)
	// contains filtered or unexported fields
}

MongoDBMetrics contains variables and methods to collect metrics for MongoDB databases running on the current host.

func New

func New(ctx context.Context, config *configpb.Configuration, wlmClient workloadmanager.WLMWriter, dbcenterClient databasecenter.Client, runCommand func(ctx context.Context, client *mongo.Client, dbName string, cmd bson.D, resultStruct any) (any, error)) *MongoDBMetrics

New creates a new MongoDBMetrics object initialized with default values.

func (*MongoDBMetrics) CollectMetricsOnce

func (m *MongoDBMetrics) CollectMetricsOnce(ctx context.Context, dwActivated bool) (*workloadmanager.WorkloadMetrics, error)

CollectMetricsOnce collects metrics for MongoDB databases running on the host.

func (*MongoDBMetrics) InitDB

func (m *MongoDBMetrics) InitDB(ctx context.Context, gceService gceInterface, serverSelectionTimeout time.Duration) error

InitDB initializes the MongoDB database connection.

Jump to

Keyboard shortcuts

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