observability

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionInfo

type CollectionInfo struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

func ListCollections

func ListCollections(ctx context.Context, db *mongo.Database) ([]CollectionInfo, error)

type CollectionStats

type CollectionStats struct {
	Collection     string  `json:"collection"`
	Count          int64   `json:"count"`
	SizeBytes      int64   `json:"size_bytes"`
	StorageBytes   int64   `json:"storage_bytes"`
	IndexBytes     int64   `json:"index_bytes"`
	AvgObjectBytes float64 `json:"avg_object_bytes"`
}

func CollectionStatistics

func CollectionStatistics(ctx context.Context, db *mongo.Database, collection string) ([]CollectionStats, error)

type CurrentOpInfo

type CurrentOpInfo struct {
	OpID        string `json:"op_id"`
	Operation   string `json:"operation"`
	Namespace   string `json:"namespace"`
	Client      string `json:"client"`
	RunningSecs int64  `json:"running_seconds"`
	Description string `json:"description"`
}

func CurrentOperations

func CurrentOperations(ctx context.Context, client *mongo.Client, limit int) ([]CurrentOpInfo, error)

type HealthReport

type HealthReport struct {
	Database    string            `json:"database"`
	Role        string            `json:"role"`
	OplogWindow string            `json:"oplog_window"`
	OplogSize   string            `json:"oplog_size"`
	Connections string            `json:"connections"`
	Lag         map[string]string `json:"lag,omitempty"`
	Warnings    []string          `json:"warnings,omitempty"`
}

func BuildHealthReport

func BuildHealthReport(ctx context.Context, client *mongo.Client, dbName string) (HealthReport, error)

type IndexInfo

type IndexInfo struct {
	Collection string `json:"collection"`
	Name       string `json:"name"`
	Keys       string `json:"keys"`
	Unique     bool   `json:"unique"`
}

func ListIndexes

func ListIndexes(ctx context.Context, db *mongo.Database, collection string) ([]IndexInfo, error)

type ResourceSummary

type ResourceSummary struct {
	ConnectionsCurrent   int64              `json:"connections_current"`
	ConnectionsAvailable int64              `json:"connections_available"`
	ResidentMemoryMB     float64            `json:"resident_memory_mb"`
	VirtualMemoryMB      float64            `json:"virtual_memory_mb"`
	Opcounters           map[string]float64 `json:"opcounters"`
}

func BuildResourceSummary

func BuildResourceSummary(ctx context.Context, client *mongo.Client) (ResourceSummary, error)

type UserInfo

type UserInfo struct {
	User  string   `json:"user"`
	DB    string   `json:"db"`
	Roles []string `json:"roles"`
}

func Users

func Users(ctx context.Context, client *mongo.Client) ([]UserInfo, error)

Jump to

Keyboard shortcuts

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