report

package
v3.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IsEnabled returns true if the report is enabled.
	IsEnabled = false
	// ReportS3Conf is the S3 report configuration.
	ReportS3Conf *ReportS3Config
	// CallbackConf is the callback report configuration.
	CallbackConf *CallbackConfig
	// BasePath is the base path of the report.
	BasePath = "/tmp/hidra"
)

Functions

func Save

func Save(reports []*Report)

Save saves an slice of reports to a file.

func SetBasePath

func SetBasePath(basePath string)

SetBasePath set base path of report

func SetCallbackConfiguration

func SetCallbackConfiguration(callbackConf *CallbackConfig)

SetCallbackConfiguration configures the callback report.

func SetS3Configuration

func SetS3Configuration(reportS3Conf *ReportS3Config)

SetS3Configuration configures the S3 report.

Types

type CallbackConfig

type CallbackConfig struct {
	// URL is the URL of the callback.
	URL string `yaml:"url"`
}

CallbackConfig is the callback report configuration.

type Report

type Report struct {
	// Name is the name of the test.
	Name string `json:"name,omitempty"`
	// Path is the path of the test.
	Path string `json:"path,omitempty"`
	// Duration is the duration of the test.
	Duration string `json:"duration,omitempty"`
	// Metrics is the metrics of the test.
	Metrics map[string]float64 `json:"metrics,omitempty"`
	// LastError is the last error of the test.
	LastError string `json:"last_error,omitempty"`
	// Attachments is the attachments of the report.
	Attachments map[string][]byte `json:"-"`
	// AttachmentList is the list of attachments.
	AttachmentList []string `json:"attachments,omitempty"`
	// Tags is the tags of the report.
	Tags map[string]string `json:"tags,omitempty"`
	// ConnectionInfo is the connection info of the report.
	ConnectionInfo ReportConnectionInfo `json:"connection_info,omitempty"`
	// HttpInfo is the HTTP info of the report.
	HttpInfo ReportHttpRespone `json:"http_info,omitempty"`
	// Variables is the variables of the report.
	Variables map[string]string `json:"variables,omitempty"`
}

Report is a report of a single test run.

func NewReport

func NewReport(sample *config.SampleConfig, allMetrics []*metrics.Metric, variables map[string]string, duration time.Duration, stepsgen map[string]any, err error) *Report

NewReport creates a new report.

func (*Report) Dump

func (r *Report) Dump() string

Dump returns the string representation of the report.

func (*Report) GenerateAttachments

func (r *Report) GenerateAttachments(stepsgen map[string]any)

GenerateAttachments generates all attachnments of the report.

func (*Report) GenerateConnectionInfo

func (r *Report) GenerateConnectionInfo(stepsgen map[string]any)

GenerateConnectionInfo returns the connection info of the report.

func (*Report) GenerateMoreIndexHTML

func (r *Report) GenerateMoreIndexHTML() string

GenerateMoreIndexHTML generates the index.html for the report.

func (*Report) GenerateReportHttpRespone

func (r *Report) GenerateReportHttpRespone(stepsgen map[string]any)

GenerateReportHttpRespone returns the HTTP response of the report.

func (*Report) Save

func (r *Report) Save() error

Save saves the report to a file.

func (*Report) SaveFile

func (r *Report) SaveFile() error

SaveFile saves the report to a file.

func (*Report) SaveS3

func (r *Report) SaveS3() error

SaveS3 saves the report to S3.

func (*Report) SendCallback

func (r *Report) SendCallback() error

SendCallback sends a callback to the client.

type ReportConnectionInfo

type ReportConnectionInfo struct {
	IP         string   `json:"ip,omitempty"`
	Traceroute []string `json:"traceroute,omitempty"`
}

ReportConnectionInfo is the connection info of the report.

type ReportHttpRespone

type ReportHttpRespone struct {
	// Headers is the headers of the report.
	Headers map[string]string `json:"headers,omitempty"`
	// ResponseCode
	ResponseCode int `json:"response_code,omitempty"`
}

ReportHttpRespone is the HTTP response of the report.

type ReportS3Config

type ReportS3Config struct {
	// Bucket is the bucket name.
	Bucket string `yaml:"bucket"`
	// Region is the region.
	Region string `yaml:"region"`
	// AccessKeyID is the access key ID.
	AccessKeyID string `yaml:"access_key_id"`
	// SecretAccessKey is the secret access key.
	SecretAccessKey string `yaml:"secret_access_key"`
	// Endpoint is the endpoint.
	Endpoint string `yaml:"endpoint"`
	// ForcePathStyle is the flag to force path style.
	ForcePathStyle bool `yaml:"force_path_style"`
	// UseSSL is the flag to use SSL.
	UseSSL bool `yaml:"use_ssl"`
}

ReportS3Config is the S3 report configuration.

Jump to

Keyboard shortcuts

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