Documentation ¶
Index ¶
- Constants
- Variables
- func GetPluginNameAndType(filename string) (name string, pluginType string, err error)
- func LoadPlugins(plugins ...string) error
- type CollectNodeConfigItem
- type Handle
- func (s *Handle) Address() string
- func (s *Handle) EraseOutput() error
- func (s *Handle) ExitCode() (int, error)
- func (s *Handle) Status() executor.TaskState
- func (s *Handle) StderrFile() (*os.File, error)
- func (s *Handle) StdoutFile() (*os.File, error)
- func (s *Handle) Stop() error
- func (s *Handle) String() string
- func (s *Handle) Wait(timeout time.Duration) (bool, error)
- type PluginLoader
- type PluginLoaderConfig
- type Plugins
- type Session
- type SessionConfig
- type Tags
Constants ¶
const ( // CaffeInferenceCollector is a name of the snap plugin binary CaffeInferenceCollector = "snap-plugin-collector-caffe-inference" // DockerCollector is name of snap plugin binary. DockerCollector = "snap-plugin-collector-docker" // MutilateCollector is name of snap plugin binary. MutilateCollector string = "snap-plugin-collector-mutilate" // RDTCollector is Snap RDT Metric collector RDTCollector = "snap-plugin-collector-rdt" // SPECjbbCollector is name of snap plugin binary used to collect metrics from SPECjbb output file. SPECjbbCollector string = "snap-plugin-collector-specjbb" // USECollector is name of snap plugin binary for the Utilization Saturation and Errors (USE) Method. USECollector string = "snap-plugin-collector-use" // CassandraPublisher is name of snap plugin binary. CassandraPublisher = "snap-plugin-publisher-cassandra" // InfluxDBPublisher is name of snap plugin binary. InfluxDBPublisher = "snap-plugin-publisher-influxdb" // FilePublisher is Snap testing file publisher FilePublisher = "snap-plugin-publisher-file" // SessionPublisher is name of snap plugin binary. SessionPublisher = "snap-plugin-publisher-session-test" )
const (
// PluginAnyVersion identifies any version of plugin that can be passed to Snap API.
PluginAnyVersion = -1
)
Variables ¶
var ( // SnapteldAddress represents snap daemon address flag. SnapteldAddress = conf.NewStringFlag("snapteld_address", "Snapteld address in `http://%s:%s` format", "http://127.0.0.1:8181") )
var UseSnapSessionForWorkloads = conf.NewBoolFlag( "use_snap_with_workloads", "Collect Application Performance Metrics for workloads.", true)
UseSnapSessionForWorkloads is flag enabling APM collection in workloads.
Functions ¶
func GetPluginNameAndType ¶
GetPluginNameAndType takes plugin binary name like "snap-plugin-collector-mutilate" and returns it's name and type inferred from binary name. Name must conform convention "*snap-plugin-(type)-(name)"
func LoadPlugins ¶
LoadPlugins loads plugins given as input parameter.
Types ¶
type CollectNodeConfigItem ¶
CollectNodeConfigItem represents ConfigItem in CollectWorkflowMapNode.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is handle for Snap task.
func (*Handle) EraseOutput ¶
EraseOutput does nothing for snap tasks.
func (*Handle) ExitCode ¶
ExitCode returns -1 when snap task is disabled because of errors or not terminated. Returns '0' when task is ended.
func (*Handle) StderrFile ¶
StderrFile returns error for snap handles.
func (*Handle) StdoutFile ¶
StdoutFile returns error for snap handles.
type PluginLoader ¶
type PluginLoader struct {
// contains filtered or unexported fields
}
PluginLoader is used to simplify Snap plugin loading.
func NewDefaultPluginLoader ¶
func NewDefaultPluginLoader() (*PluginLoader, error)
NewDefaultPluginLoader returns PluginLoader with DefaultPluginLoaderConfig. Returns error when could not connect to Snap.
func NewPluginLoader ¶
func NewPluginLoader(config PluginLoaderConfig) (*PluginLoader, error)
NewPluginLoader constructs PluginLoader with given config. Returns error when could not connect to Snap.
func (PluginLoader) Load ¶
func (l PluginLoader) Load(plugins ...string) error
Load loads supplied plugin names from plugin path and returns slice of encountered errors.
type PluginLoaderConfig ¶
type PluginLoaderConfig struct {
SnapteldAddress string
}
PluginLoaderConfig contains configuration for PluginLoader.
func DefaultPluginLoaderConfig ¶
func DefaultPluginLoaderConfig() PluginLoaderConfig
DefaultPluginLoaderConfig returns default config for PluginLoader.
type Plugins ¶
type Plugins struct {
// contains filtered or unexported fields
}
Plugins provides a 'manager' like abstraction for plugin operations.
func NewPlugins ¶
NewPlugins returns an instantiated Plugins object, using pClient for all plugin operations.
func (*Plugins) IsLoaded ¶
IsLoaded connects to snap and looks for plugin with given name. Be aware that the name is not the plugin binary path or name but defined by the plugin itself.
func (*Plugins) LoadPlugin ¶
LoadPlugin loads plugin binary from path.
type Session ¶
type Session struct { // TaskName is name of task in Snap. TaskName string // Metrics to tag in session. Metrics []string // Tags to be applied to metrics. Tags map[string]interface{} // CollectNodeConfigItems represent ConfigItems for CollectNode. CollectNodeConfigItems []CollectNodeConfigItem // Publisher for tagged metrics. Publisher *wmap.PublishWorkflowMapNode // contains filtered or unexported fields }
Session provides construct for tagging metrics for a specified time span defined by Start() and Stop().
func NewSession ¶
func NewSession( taskName string, metrics []string, interval time.Duration, pClient *client.Client, publisher *wmap.PublishWorkflowMapNode, tags map[string]interface{}) *Session
NewSession generates a session with a name and a list of metrics to tag. The interval cannot be less than second granularity.
func NewSessionLauncher ¶
func NewSessionLauncher(config SessionConfig) (*Session, error)
NewSessionLauncher construct snap.Session based on provied config It also try load plugins mentioned in config.Plugins and can fails if plugins are unavailable.