csv

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStringInSlice

func IsStringInSlice(slice []string, str string) bool

IsStringInSlice returns whether the string is contained within a string slice

func MakeHeader

func MakeHeader(tags []string) []string

MakeHeader creates list of column names for csv file

func SampleToRow

func SampleToRow(sample *stats.Sample, resTags []string, ignoredTags []string, row []string) []string

SampleToRow converts sample into array of strings

Types

type Collector

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

Collector saving output to csv implements the lib.Collector interface

func New

func New(fs afero.Fs, tags stats.TagSet, config Config) (*Collector, error)

New Creates new instance of CSV collector

func (*Collector) Collect

func (c *Collector) Collect(scs []stats.SampleContainer)

Collect Saves samples to buffer

func (*Collector) GetRequiredSystemTags

func (c *Collector) GetRequiredSystemTags() stats.SystemTagSet

GetRequiredSystemTags returns which sample tags are needed by this collector

func (*Collector) Init

func (c *Collector) Init() error

Init writes column names to csv file

func (c *Collector) Link() string

Link returns a dummy string, it's only included to satisfy the lib.Collector interface

func (*Collector) Run

func (c *Collector) Run(ctx context.Context)

Run just blocks until the context is done

func (*Collector) SetRunStatus

func (c *Collector) SetRunStatus(status lib.RunStatus)

SetRunStatus does nothing

func (*Collector) WriteToFile

func (c *Collector) WriteToFile()

WriteToFile Writes samples to the csv file

type Config

type Config struct {
	// Samples.
	FileName     null.String        `json:"file_name" envconfig:"K6_CSV_FILENAME"`
	SaveInterval types.NullDuration `json:"save_interval" envconfig:"K6_CSV_SAVE_INTERVAL"`
}

Config is the config for the csv collector

func NewConfig

func NewConfig() Config

NewConfig creates a new Config instance with default values for some fields.

func ParseArg

func ParseArg(arg string) (Config, error)

ParseArg takes an arg string and converts it to a config

func (Config) Apply

func (c Config) Apply(cfg Config) Config

Apply merges two configs by overwriting properties in the old config

Jump to

Keyboard shortcuts

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