cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func WaitSignals

func WaitSignals(done <-chan struct{}, sgs ...os.Signal)

Types

type DynamicProbeServer added in v1.0.0

type DynamicProbeServer[T probe.Probe] struct {
	// contains filtered or unexported fields
}

func NewDynamicProbeServer added in v1.0.0

func NewDynamicProbeServer[T probe.Probe](probeManager ProbeManager[T]) *DynamicProbeServer[T]

func (*DynamicProbeServer[T]) Reload added in v1.0.0

func (s *DynamicProbeServer[T]) Reload(ctx context.Context, config []ProbeConfig) error

func (*DynamicProbeServer[T]) Start added in v1.0.0

func (s *DynamicProbeServer[T]) Start(ctx context.Context, config []ProbeConfig) error

func (*DynamicProbeServer[T]) Stop added in v1.0.0

func (s *DynamicProbeServer[T]) Stop(ctx context.Context) error

type EventConfig

type EventConfig struct {
	EventSinks []EventSinkConfig `yaml:"sinks" mapstructure:"sinks" json:"sinks"`
	Probes     []ProbeConfig     `yaml:"probes" mapstructure:"probes" json:"probes"`
}

type EventProbeManager added in v1.0.0

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

func (*EventProbeManager) CreateProbe added in v1.0.0

func (m *EventProbeManager) CreateProbe(config ProbeConfig) (probe.EventProbe, error)

func (*EventProbeManager) StartProbe added in v1.0.0

func (m *EventProbeManager) StartProbe(ctx context.Context, p probe.EventProbe) error

func (*EventProbeManager) StopProbe added in v1.0.0

func (m *EventProbeManager) StopProbe(ctx context.Context, p probe.EventProbe) error

type EventServer added in v1.0.0

type EventServer struct {
	*DynamicProbeServer[probe.EventProbe]
}

func (*EventServer) Start added in v1.0.0

func (s *EventServer) Start(ctx context.Context, probeConfig []ProbeConfig) error

func (*EventServer) Stop added in v1.0.0

func (s *EventServer) Stop(ctx context.Context) error

type EventSinkConfig added in v1.0.0

type EventSinkConfig struct {
	Name string      `yaml:"name" mapstructure:"name" json:"name"`
	Args interface{} `yaml:"args" mapstructure:"args" json:"args"`
}

type InspServerConfig added in v1.0.0

type InspServerConfig struct {
	DebugMode bool `yaml:"debugMode" mapstructure:"debugMode" json:"debugMode"`
	// A better way to set listen port is a `address` field  that can be used for bind interface ip, or even unix domain socket
	// Deprecated: use address instead
	Port uint16 `yaml:"port" mapstructure:"port" json:"port"`

	Address          string        `yaml:"address" mapstructure:"address" json:"address"`
	EnableController bool          `yaml:"enableController" mapstructure:"enableController" json:"enableController"`
	ControllerAddr   string        `yaml:"controllerAddr" mapstructure:"controllerAddr" json:"controllerAddr"`
	MetricsConfig    MetricsConfig `yaml:"metrics" mapstructure:"metrics" json:"metrics"`
	EventConfig      EventConfig   `yaml:"event" mapstructure:"event" json:"event"`
}

type MetricsConfig added in v1.0.0

type MetricsConfig struct {
	Probes           []ProbeConfig `yaml:"probes" mapstructure:"probes" json:"probes"`
	AdditionalLabels []string      `yaml:"additionalLabels" mapstructure:"additionalLabels" json:"additionalLabels"`
}

type MetricsProbeManager added in v1.0.0

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

func (*MetricsProbeManager) CreateProbe added in v1.0.0

func (m *MetricsProbeManager) CreateProbe(config ProbeConfig) (probe.MetricsProbe, error)

func (*MetricsProbeManager) StartProbe added in v1.0.0

func (*MetricsProbeManager) StopProbe added in v1.0.0

type MetricsServer added in v1.0.0

type MetricsServer struct {
	*DynamicProbeServer[probe.MetricsProbe]
	// contains filtered or unexported fields
}

func (*MetricsServer) ServeHTTP added in v1.0.0

func (s *MetricsServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProbeConfig added in v1.0.0

type ProbeConfig struct {
	Name string                 `yaml:"name" mapstructure:"name" json:"name"`
	Args map[string]interface{} `yaml:"args" mapstructure:"args" json:"args"`
}

type ProbeManager added in v1.0.0

type ProbeManager[T probe.Probe] interface {
	CreateProbe(config ProbeConfig) (T, error)
	StartProbe(ctx context.Context, probe T) error
	StopProbe(ctx context.Context, probe T) error
}

Jump to

Keyboard shortcuts

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