exec

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectContext

func DetectContext(cfg ExecCfg) cicontext.CIContext

Detect tries to detect the CIContext automatically If it cannot, it falls back to the values available in ExecCfg Note that it may return an invalid CIContext

func Exec

func Exec(args []string, cfg ExecCfg) (cmdError error, err error)

Exec executes a program and exports its captured profiles It works by creating an in-memory pyroscope server Then overwriting the default serverAddress using the PYROSCOPE_ADHOC_SERVER_ADDRESS env var Which then is uploaded to a) a pyroscope server that supports the /ci API b) to a local directory c) both

Notice that it returns 2 different errors: cmdError refers to the error of the command exec'd and err to any other error

Types

type ExecCfg

type ExecCfg struct {
	OutputDir     string
	ServerAddress string
	APIKey        string
	CommitSHA     string
	Branch        string
	NoUpload      bool
	Export        bool
	LogLevel      string
}

type Exporter

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

func NewExporter

func NewExporter(logger *logrus.Logger, outputDir string) *Exporter

func (*Exporter) Export

func (w *Exporter) Export(items map[string]flamebearer.FlamebearerProfile) error

Export exports each FlamebearerProfile into a JSON file

func (*Exporter) Write

func (*Exporter) Write(path string, flame flamebearer.FlamebearerProfile) error

Write writes a flamebearer in json format to its dataDir

type FlamebearerMap

type FlamebearerMap map[string]*storage.PutInput

type Ingester

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

func NewIngester

func NewIngester() *Ingester

func (*Ingester) GetIngestedItems

func (i *Ingester) GetIngestedItems() map[string]flamebearer.FlamebearerProfile

func (*Ingester) Ingest

func (i *Ingester) Ingest(ctx context.Context, in *ingestion.IngestInput) error

type Putter

type Putter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPutter

func NewPutter() *Putter

NewPutter creates a Putter that stores Put data into memory Which can then be retrieved via GetPutItems

func (*Putter) GetPutItems

func (p *Putter) GetPutItems() map[string]flamebearer.FlamebearerProfile

func (*Putter) Put

func (p *Putter) Put(_ context.Context, pi *storage.PutInput) error

type Runner

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

func NewRunner

func NewRunner(logger *logrus.Logger) *Runner

func (*Runner) Run

Run executes a command while running a server that ingests data at the /ingest endpoint And returns all data that was ingested

type UploadConfig

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

type Uploader

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

func NewUploader

func NewUploader(logger *logrus.Logger, cfg UploadConfig) *Uploader

func (*Uploader) Upload

Upload uploads files to the target server's /api/ci-events endpoint It assumes all cfg values are non-zero

Jump to

Keyboard shortcuts

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