instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Prometheus ConfigPrometheus `json:"prometheus"`
	Klogs      ConfigKlogs      `json:"klogs"`
}

Config is the structure of the configuration for a single Harbor database instance.

type ConfigKlogs

type ConfigKlogs struct {
	Enabled bool           `json:"enabled"`
	Options map[string]any `json:"options"`
}

ConfigKlogs is the structure of the configuration, which is required to enabled the klogs integration for the Istio plugin.

type ConfigPrometheus

type ConfigPrometheus struct {
	Enabled bool           `json:"enabled"`
	Options map[string]any `json:"options"`
}

ConfigPrometheus is the structure of the configuration, which is required to enabled the Prometheus integration for the Istio plugin.

type Edge

type Edge struct {
	Data EdgeData `json:"data"`
}

type EdgeData

type EdgeData struct {
	ID     string `json:"id"`
	Source string `json:"source"`
	Target string `json:"target"`
}

type Instance

type Instance interface {
	GetName() string
	GetNamespaces(ctx context.Context, timeStart int64, timeEnd int64) ([]string, error)
	GetMetrics(ctx context.Context, namespaces []string, application, label, groupBy, reporter string, timeStart int64, timeEnd int64) (map[string]map[string]string, error)
	GetMetricsDetails(ctx context.Context, metric, reporter, destinationWorkload, destinationWorkloadNamespace, destinationVersion, destinationService, sourceWorkload, sourceWorkloadNamespace, pod string, timeStart int64, timeEnd int64) (*prometheusInstance.Metrics, error)
	GetMetricsPod(ctx context.Context, metric, namespace, pod string, timeStart int64, timeEnd int64) (*prometheusInstance.Metrics, error)
	GetTopology(ctx context.Context, namespace, application string, timeStart int64, timeEnd int64) ([]Edge, []Node, error)
	Tap(ctx context.Context, namespace, application, filterUpstreamCluster, filterMethod, filterPath string, timeStart int64, timeEnd int64) ([]map[string]any, error)
	Top(ctx context.Context, namespace, application, filterUpstreamCluster, filterMethod, filterPath, sortBy, sortDirection string, timeStart int64, timeEnd int64) ([][]any, error)
	TopDetails(ctx context.Context, namespace, application, upstreamCluster, method, path string, timeStart int64, timeEnd int64) ([][]any, error)
}

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new Elasticsearch instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t testing.TB) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) GetMetrics

func (_m *MockInstance) GetMetrics(ctx context.Context, namespaces []string, application string, label string, groupBy string, reporter string, timeStart int64, timeEnd int64) (map[string]map[string]string, error)

GetMetrics provides a mock function with given fields: ctx, namespaces, application, label, groupBy, reporter, timeStart, timeEnd

func (*MockInstance) GetMetricsDetails

func (_m *MockInstance) GetMetricsDetails(ctx context.Context, metric string, reporter string, destinationWorkload string, destinationWorkloadNamespace string, destinationVersion string, destinationService string, sourceWorkload string, sourceWorkloadNamespace string, pod string, timeStart int64, timeEnd int64) (*pkginstance.Metrics, error)

GetMetricsDetails provides a mock function with given fields: ctx, metric, reporter, destinationWorkload, destinationWorkloadNamespace, destinationVersion, destinationService, sourceWorkload, sourceWorkloadNamespace, pod, timeStart, timeEnd

func (*MockInstance) GetMetricsPod

func (_m *MockInstance) GetMetricsPod(ctx context.Context, metric string, namespace string, pod string, timeStart int64, timeEnd int64) (*pkginstance.Metrics, error)

GetMetricsPod provides a mock function with given fields: ctx, metric, namespace, pod, timeStart, timeEnd

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) GetNamespaces

func (_m *MockInstance) GetNamespaces(ctx context.Context, timeStart int64, timeEnd int64) ([]string, error)

GetNamespaces provides a mock function with given fields: ctx, timeStart, timeEnd

func (*MockInstance) GetTopology

func (_m *MockInstance) GetTopology(ctx context.Context, namespace string, application string, timeStart int64, timeEnd int64) ([]Edge, []Node, error)

GetTopology provides a mock function with given fields: ctx, namespace, application, timeStart, timeEnd

func (*MockInstance) Tap

func (_m *MockInstance) Tap(ctx context.Context, namespace string, application string, filterUpstreamCluster string, filterMethod string, filterPath string, timeStart int64, timeEnd int64) ([]map[string]interface{}, error)

Tap provides a mock function with given fields: ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, timeStart, timeEnd

func (*MockInstance) Top

func (_m *MockInstance) Top(ctx context.Context, namespace string, application string, filterUpstreamCluster string, filterMethod string, filterPath string, sortBy string, sortDirection string, timeStart int64, timeEnd int64) ([][]interface{}, error)

Top provides a mock function with given fields: ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, sortBy, sortDirection, timeStart, timeEnd

func (*MockInstance) TopDetails

func (_m *MockInstance) TopDetails(ctx context.Context, namespace string, application string, upstreamCluster string, method string, path string, timeStart int64, timeEnd int64) ([][]interface{}, error)

TopDetails provides a mock function with given fields: ctx, namespace, application, upstreamCluster, method, path, timeStart, timeEnd

type Node

type Node struct {
	Data NodeData `json:"data"`
}

type NodeData

type NodeData struct {
	ID      string            `json:"id"`
	Metrics map[string]string `json:"metrics"`
}

Jump to

Keyboard shortcuts

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