Documentation ¶
Index ¶
- Constants
- Variables
- func AddOutputFlags(command *cobra.Command, outputConfig *OutputConfig)
- func AddRegistryAuthVariablesAndFlags(cmd *cobra.Command, authOptions *oci.AuthOptions)
- func AddRuntimesSocketPathFlags(command *cobra.Command, config *RuntimesSocketPathConfig)
- func CheckServerVersionSkew(serverVersion string) error
- func ClearScreen()
- func GetContainerRuntimeColumns() []string
- func GetKubernetesColumns() []string
- func HandleSpecialEvent(e *eventtypes.Event, verbose bool)
- func MarkExperimental(cmd *cobra.Command) *cobra.Command
- func ParseEarlyFlags(cmd *cobra.Command, rawArgs []string) error
- func WrapInErrArgsNotSupported(args string) error
- func WrapInErrGadgetTracerCreateAndRun(err error) error
- func WrapInErrGenGadgetOutput(err error) error
- func WrapInErrGetGadgetOutput(err error) error
- func WrapInErrInvalidArg(arg string, err error) error
- func WrapInErrListGadgetTraces(err error) error
- func WrapInErrListNodes(err error) error
- func WrapInErrListPods(err error) error
- func WrapInErrManagerCreateMountNsMap(err error) error
- func WrapInErrManagerInit(err error) error
- func WrapInErrMarshalOutput(err error) error
- func WrapInErrMissingArgs(args string) error
- func WrapInErrOutputModeNotSupported(mode string) error
- func WrapInErrParserCreate(err error) error
- func WrapInErrRunGadget(err error) error
- func WrapInErrRunGadgetOnAllNode(err error) error
- func WrapInErrRunGadgetOnNode(node string, err error) error
- func WrapInErrSetupK8sClient(err error) error
- func WrapInErrStopGadget(err error) error
- func WrapInErrUnmarshalOutput(err error, output string) error
- type BaseElement
- type BaseParser
- type GadgetParser
- func NewGadgetParser[T any](outputConfig *OutputConfig, cols *columns.Columns[T], options ...Option) (*GadgetParser[T], error)
- func NewGadgetParserWithK8sAndRuntimeInfo[T any](outputConfig *OutputConfig, columns *columns.Columns[T]) (*GadgetParser[T], error)
- func NewGadgetParserWithK8sInfo[T any](outputConfig *OutputConfig, columns *columns.Columns[T]) (*GadgetParser[T], error)
- func NewGadgetParserWithRuntimeInfo[T any](outputConfig *OutputConfig, columns *columns.Columns[T]) (*GadgetParser[T], error)
- type GadgetParserOptions
- type Option
- type OutputConfig
- type RuntimesSocketPathConfig
Constants ¶
const ( OutputModeColumns = "columns" OutputModeJSON = "json" OutputModeJSONPretty = "jsonpretty" OutputModeYAML = "yaml" )
const ( KubernetesTag string = "kubernetes" ContainerRuntimeTag string = "runtime" )
Variables ¶
var ( ErrGadgetPodNotFound = errors.New("gadget pod not found") ErrMultipleGadgetPodFound = errors.New("multiple gadget pods found") )
Gadget pod
var SupportedOutputModes = []string{OutputModeJSON, OutputModeColumns}
Functions ¶
func AddOutputFlags ¶
func AddOutputFlags(command *cobra.Command, outputConfig *OutputConfig)
func AddRegistryAuthVariablesAndFlags ¶ added in v0.22.0
func AddRegistryAuthVariablesAndFlags(cmd *cobra.Command, authOptions *oci.AuthOptions)
func AddRuntimesSocketPathFlags ¶
func AddRuntimesSocketPathFlags(command *cobra.Command, config *RuntimesSocketPathConfig)
func CheckServerVersionSkew ¶ added in v0.28.0
func ClearScreen ¶ added in v0.12.0
func ClearScreen()
func GetContainerRuntimeColumns ¶
func GetContainerRuntimeColumns() []string
func GetKubernetesColumns ¶
func GetKubernetesColumns() []string
func HandleSpecialEvent ¶ added in v0.11.0
func HandleSpecialEvent(e *eventtypes.Event, verbose bool)
HandleSpecialEvent prints the special events. Notice it does not receive the OutputMode so it will always print the special events messages without any specific format to standard error.
func ParseEarlyFlags ¶ added in v0.22.0
func WrapInErrInvalidArg ¶
func WrapInErrListNodes ¶
func WrapInErrListPods ¶
func WrapInErrManagerInit ¶
func WrapInErrMarshalOutput ¶
func WrapInErrMissingArgs ¶
func WrapInErrParserCreate ¶
func WrapInErrRunGadget ¶
func WrapInErrSetupK8sClient ¶
func WrapInErrStopGadget ¶
Types ¶
type BaseElement ¶
type BaseElement interface { any }
BaseElement represent any element that needs to be transform into a requested format. For instance, it could be an event (for trace category) or a report (for the profile/cpu gadget).
type BaseParser ¶
type BaseParser[E BaseElement] struct { // ColumnsWidth are the columns that can be configured to be printed with // the width to be used. ColumnsWidth map[string]int // SeparateWithTabs defines whether the columns has to be separated with the // width defined in ColumnsWidth (if false), or with tabs ignoring the width // defined in ColumnsWidth (if true). SeparateWithTabs bool // OutputConfig provides to the parser the flags that describes how to print // the gadget's output. OutputConfig *OutputConfig }
BaseParser is a base for a parser that implements the most common methods.
func NewBaseTabParser ¶
func NewBaseTabParser[E BaseElement](availableColumns []string, outputConfig *OutputConfig) BaseParser[E]
NewBaseTabParser returns a BaseParser configured to print columns separated by tabs.
func NewBaseWidthParser ¶
func NewBaseWidthParser[E BaseElement](columnsWidth map[string]int, outputConfig *OutputConfig) BaseParser[E]
NewBaseWidthParser returns a BaseParser configured to print columns separated by their predefined with.
func (*BaseParser[E]) BuildColumnsHeader ¶
func (p *BaseParser[E]) BuildColumnsHeader() string
func (*BaseParser[E]) GetOutputConfig ¶
func (p *BaseParser[E]) GetOutputConfig() *OutputConfig
func (*BaseParser[E]) Transform ¶
func (p *BaseParser[E]) Transform(element *E, toColumns func(*E) string) string
type GadgetParser ¶
type GadgetParser[T any] struct { // contains filtered or unexported fields }
GadgetParser is a parser that helps printing the gadget output in columns using the columns and formatter/textcolumns packages.
func NewGadgetParser ¶
func NewGadgetParser[T any](outputConfig *OutputConfig, cols *columns.Columns[T], options ...Option) (*GadgetParser[T], error)
func NewGadgetParserWithK8sAndRuntimeInfo ¶ added in v0.21.0
func NewGadgetParserWithK8sAndRuntimeInfo[T any](outputConfig *OutputConfig, columns *columns.Columns[T]) (*GadgetParser[T], error)
func NewGadgetParserWithK8sInfo ¶
func NewGadgetParserWithK8sInfo[T any](outputConfig *OutputConfig, columns *columns.Columns[T]) (*GadgetParser[T], error)
func NewGadgetParserWithRuntimeInfo ¶
func NewGadgetParserWithRuntimeInfo[T any](outputConfig *OutputConfig, columns *columns.Columns[T]) (*GadgetParser[T], error)
func (*GadgetParser[T]) BuildColumnsHeader ¶
func (p *GadgetParser[T]) BuildColumnsHeader() string
func (*GadgetParser[T]) Sort ¶
func (p *GadgetParser[T]) Sort(entries []*T, sortBy []string)
func (*GadgetParser[T]) TransformIntoColumns ¶
func (p *GadgetParser[T]) TransformIntoColumns(entry *T) string
func (*GadgetParser[T]) TransformIntoTable ¶
func (p *GadgetParser[T]) TransformIntoTable(entries []*T) string
type GadgetParserOptions ¶
type GadgetParserOptions struct {
// contains filtered or unexported fields
}
type OutputConfig ¶
type OutputConfig struct { // OutputMode specifies the format output should be printed OutputMode string // List of columns to print (only meaningful when OutputMode is "columns=...") CustomColumns []string // Verbose prints additional information Verbose bool }
OutputConfig contains the flags that describes how to print the gadget's output
func (*OutputConfig) ParseOutputConfig ¶
func (config *OutputConfig) ParseOutputConfig() error