stats

package
v0.38.6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMetrics

func AddMetrics(mux *http.ServeMux)

func AddPprof

func AddPprof(mux *http.ServeMux)

func AddSnapshots

func AddSnapshots(mux *http.ServeMux, history SnapshotHistory)

func MustStartServerBackground

func MustStartServerBackground(
	snapshotHistory SnapshotHistory,
	port uint32,
	addHandlers ...func(mux *http.ServeMux, profiles map[string]string),
)

func StartServer

func StartServer(
	snapshotHistory SnapshotHistory,
	port uint32,
	addHandlers ...func(mux *http.ServeMux, profiles map[string]string),
) error

Types

type Filters added in v0.22.20

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

func NewFilters added in v0.22.20

func NewFilters(includedClusters []string, includedNamespaces []string, includedResourceTypes []string) Filters

type Index

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

func NewIndex added in v0.22.20

func NewIndex(history SnapshotHistory) Index

func (Index) Generate added in v0.22.20

func (index Index) Generate(w http.ResponseWriter, r *http.Request)

type SnapshotHistory

type SnapshotHistory interface {
	// SetInput Sets the input snapshot for the given component
	SetInput(id string, latestInput json.Marshaler)
	// GetInputCopy gets an in-memory copy of the output snapshot for all components.
	GetInputCopy() (map[string]interface{}, error)
	// GetInput gets the input snapshot for all components.
	GetInput() ([]byte, error)
	// GetFilteredInput gets the input snapshot for all components and applies filters
	GetFilteredInput(format string, filters Filters) ([]byte, error)
	// SetOutput Sets the output snapshot for the given component
	SetOutput(id string, latestOutput json.Marshaler)
	// GetOutputCopy gets an in-memory copy of the output snapshot for all components.
	GetOutputCopy() (map[string]interface{}, error)
	// GetOutput gets the output snapshot for all component.
	GetOutput() ([]byte, error)
	// GetFilteredOutput gets the output snapshot for all components and applies filters
	GetFilteredOutput(format string, filters Filters) ([]byte, error)
}

Could be good to enhance this interface to use more defined types/structs. Right now they are mostly generics which relies on a lot of type assertion. If we did maintain the format here it would need to be checked when set

INPUT FORMAT

{
    "cert-issuer": {
        "<resourceType>": [...],
        "<resourceType>": [...]
    },
    "translator": {
        "<resourceType>": [resources .....],
	}
}

OUTPUT FORMAT

{
    "roottrust": {...},
    "translator": {
        "<cluster>/<namespace>": {
            "<name>~<namespace>~<cluster>~<resourceType>": {
                "Err": null,
                "Outputs": {
                    "<resourceType>": [resources .....]
                },
                "Warnings": null
            },
		}
	}
}

func NewSnapshotHistory

func NewSnapshotHistory() SnapshotHistory

Jump to

Keyboard shortcuts

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