common

package
v0.0.0-...-9a3149e Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// global common parameters required by gosdk cli
	CONN_PROFILE       = "connectionProfile"
	NAME               = "name" // test name
	ITERATION_COUNT    = "iterationCount"
	ITERATION_INTERVAL = "iterationInterval"
	DELAY_TIME         = "delayTime"
	RETRY_COUNT        = "retryCount"
	LOG_LEVEL          = "logLevel"

	ADMIN = "Admin"
	USER  = "User1"

	// BCCSP Default Configurations
	CONFIG_BCCSP = "config/config_crypto_bccsp.yaml"

	IGNORE_ERRORS     = "ignoreErrors"
	CONCURRENCY_LIMIT = "concurrencyLimit" // in most cases users only need to config this param for cc invoke
)
View Source
const (
	MaxIdleConnections int = 20
	RequestTimeout     int = 5
	SCRAPE_INTERVAL        = 10 * time.Second
)
View Source
const DEFAULT_ROUTINE_LIMIT = 500
View Source
const FIXED = 0
View Source
const PUSH_INTERVAL = 10 * time.Second // push metrics to graphite interval: seconds
View Source
const RANDOM = 1
View Source
const ROUTINE_UPPER_LIMIT = 2000

Variables

View Source
var IGNORED_ERRORS = []string{"MVCC_READ_CONFLICT"}
View Source
var Logger *zap.Logger

Functions

func Delay

func Delay(delayTime string)

func GetConfigBackends

func GetConfigBackends(stringPath ...string) (core.ConfigProvider, error)

GetConfigBackends gets the config backends from multiple configuration file

func GetTempChannelConfigFile

func GetTempChannelConfigFile(channelID string, peers []string) (string, error)

GetTempChannelConfigFile will generate the temporary channel yaml file and return the file path

func GetViperInstance

func GetViperInstance(file string, configType string) (*viper.Viper, error)

func InitLog

func InitLog(loggingLevel string)

func InitializeMetrics

func InitializeMetrics(name string)

func IterateFunc

func IterateFunc(base *Base, iterFunc func(iterationIndex int) error, sequential bool) (successCount uint64, failCount uint64, retErr error)

return the number of successful execution and error(if any) sequential: false when iterFunc can be executed concurrently; true when iterFunc should be sequentially executed chaincode instantiate should be executed sequentially

func PromPush

func PromPush(r metrics.Registry, d time.Duration, instance_id string, test_id string, addr *net.TCPAddr, metricsStopChan chan (struct{}))

PromPush is a blocking exporter function which reports metrics in r to a prometheus push gateway server located at addr, flushing them every d duration.

func SetRoutineLimit

func SetRoutineLimit(num int)

func StopPush

func StopPush()

func TrackCount

func TrackCount(name string, increment int64)

func TrackGauge

func TrackGauge(name string, value int64)

func TrackTime

func TrackTime(start time.Time, name string)

func WithConfig

func WithConfig(c Config)

WithConfig is a blocking exporter function just like Graphite, but it takes a GraphiteConfig instead.

Types

type Base

type Base struct {
	InstanceID        int
	IterationCount    string
	RetryCount        int
	CertRootDir       string
	ConnectionProfile string

	Hostname string
	// contains filtered or unexported fields
}

func NewBase

func NewBase() *Base

func (*Base) AddToGauge

func (p *Base) AddToGauge(g float64)

func (*Base) CurrentIter

func (p *Base) CurrentIter() int

func (*Base) CurrentRetry

func (p *Base) CurrentRetry() int

func (*Base) DoMetrics

func (p *Base) DoMetrics(metricName string)

func (*Base) IncCount

func (p *Base) IncCount()

func (*Base) Next

func (p *Base) Next() int

func (*Base) NextRetry

func (p *Base) NextRetry() int

func (*Base) PrintMetrics

func (p *Base) PrintMetrics(name string)

Print metrics summary into console and do clean up

func (*Base) ResetCurrentIter

func (p *Base) ResetCurrentIter() int

func (*Base) ResetCurrentRetry

func (p *Base) ResetCurrentRetry() int

func (*Base) SetCurrentIter

func (p *Base) SetCurrentIter(currentIter int)

func (*Base) SetGauge

func (p *Base) SetGauge(g float64)

func (*Base) SetIterationInterval

func (p *Base) SetIterationInterval(pattern string)

func (*Base) Wait

func (p *Base) Wait()

type Channel

type Channel struct {
	Peers map[string]PeerChannel `mapstructure:"peers"`
}

type Channels

type Channels struct {
	Channels map[string]Channel `mapstructure:"channels"`
}

type Client

type Client struct {
	Organization string       `string:"organization"`
	Cryptoconfig Cryptoconfig `string:"cryptoconfig"`
}

Client shows

type Config

type Config struct {
	Addr          *net.TCPAddr     // Network address to connect to
	Registry      metrics.Registry // Registry to be exported
	FlushInterval time.Duration    // Flush interval
	DurationUnit  time.Duration    // Time conversion unit for durations
	InstanceId    string           // Instance identifier which normally maps to hostname
	TestId        string           // Test identifier
	Percentiles   []float64        // Percentiles to export from timers and histograms
	// contains filtered or unexported fields
}

Config provides a container with configuration parameters for the Graphite exporter

type ConnectionProfile

type ConnectionProfile struct {
	Client        Client                  `mapstructure:"client"`
	Orderers      map[string]Orderer      `mapstructure:"orderers"`
	Organizations map[string]Organization `mapstructure:"organizations"`
	Peers         map[string]Peer         `mapstructure:"peers"`
	Channels      map[string]Channel      `mapstructure:"channels"`
}

ConnectionProfile shows

type Cryptoconfig

type Cryptoconfig struct {
	Path string `string:"Path"`
}

type Interval

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

func NewInterval

func NewInterval(p string) *Interval

type Orderer

type Orderer struct {
	URL string `string:"url"`
}

Orderer shows

type Organization

type Organization struct {
	Mspid                  string   `mapstructure:"mspid"`
	CryptoPath             string   `yaml:"cryptoPath,omitempty"`
	Peers                  []string `yaml:"peers,omitempty"`
	CertificateAuthorities []string `yaml:"certificateAuthorities,omitempty"`
}

Organization shows

type Organizations

type Organizations struct {
	Organizations map[string]Organization `mapstructure:"organizations"`
}

Organization shows

type Peer

type Peer struct {
	URL string `string:"url"`
}

type PeerChannel

type PeerChannel struct {
	EndorsingPeer  bool `mapstructure:"endorsingPeer"`
	ChaincodeQuery bool `mapstructure:"chaincodeQuery"`
	LedgerQuery    bool `mapstructure:"ledgerQuery"`
	EventSource    bool `mapstructure:"eventSource"`
}

Jump to

Keyboard shortcuts

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