args

package
v2.13.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package args contains a structs for a passed in argument list. Also, the KafkaArguments struct which is a specially parsed version of the args to be used within the integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgumentList

type ArgumentList struct {
	sdkArgs.DefaultArgumentList
	ClusterName  string `default:"" help:"A user-defined name to uniquely identify the cluster"`
	KafkaVersion string `` /* 134-byte string literal not displayed */

	AutodiscoverStrategy string `default:"zookeeper" help:"How to discover broker nodes to collect metrics from. One of 'zookeeper' (default) or 'bootstrap'"`

	// Zookeeper autodiscovery. Only required if using zookeeper to autodiscover brokers
	ZookeeperHosts      string `default:"[]" help:"JSON array of ZooKeeper hosts with the following fields: host, port. Port defaults to 2181"`
	ZookeeperAuthScheme string `default:"" help:"ACL scheme for authenticating ZooKeeper connection."`
	ZookeeperAuthSecret string `default:"" help:"Authentication string for ZooKeeper."`
	ZookeeperPath       string `default:"" help:"The Zookeeper path which contains the Kafka configuration. A leading slash is required."`
	PreferredListener   string `default:"" help:"Override which broker listener to attempt to connect to. Defaults to the first that works"`

	// Bootstrap broker autodiscovery. Only required if using `bootstrap` as your AutodiscoverStrategy
	BootstrapBrokerHost          string `default:"localhost" help:"The bootstrap broker host"`
	BootstrapBrokerKafkaPort     int    `default:"9092" help:"The bootstrap broker Kafka port"`
	BootstrapBrokerKafkaProtocol string `` /* 139-byte string literal not displayed */
	BootstrapBrokerJMXPort       int    `default:"0" help:"The JMX port for the bootstrap broker"`
	BootstrapBrokerJMXUser       string `default:"" help:"The JMX username for the bootstrap broker"`
	BootstrapBrokerJMXPassword   string `default:"" help:"The JMX password for the bootstrap broker"`

	// Broker TLS options
	TLSCaFile             string `default:"" help:"CA file for broker connection"`
	TLSCertFile           string `default:"" help:"Cert file for broker connection"`
	TLSKeyFile            string `default:"" help:"Key file for broker connection"`
	TLSInsecureSkipVerify bool   `default:"false" help:"Enabled TLS insecure skip verify"`

	// Producer and consumer connection info. No autodiscovery is supported for producers and consumers
	Producers string `` /* 220-byte string literal not displayed */
	Consumers string `` /* 220-byte string literal not displayed */

	// JMX defaults
	DefaultJMXPort     int    `default:"9999" help:"Default port for JMX collection."`
	DefaultJMXHost     string `default:"localhost" help:"Default host for JMX collection."`
	DefaultJMXUser     string `default:"admin" help:"Default JMX username. Useful if all JMX hosts use the same JMX username and password."`
	DefaultJMXPassword string `default:"admin" help:"Default JMX password. Useful if all JMX hosts use the same JMX username and password."`

	// JMX SSL options
	KeyStore           string `default:"" help:"The location for the keystore containing JMX Client's SSL certificate"`
	KeyStorePassword   string `default:"" help:"Password for the SSL Key Store"`
	TrustStore         string `default:"" help:"The location for the keystore containing JMX Server's SSL certificate"`
	TrustStorePassword string `default:"" help:"Password for the SSL Trust Store"`

	NrJmx string `default:"/usr/bin/nrjmx" help:"Path to the nrjmx executable"`

	SaslMechanism string `` /* 127-byte string literal not displayed */
	SaslUsername  string `default:"" help:"SASL username for use with the PLAIN and SCRAM mechanisms"`
	SaslPassword  string `default:"" help:"SASL password for use with the PLAIN and SCRAM mechanisms"`

	// Kerberos auth args
	SaslGssapiRealm              string `default:"" help:"Kerberos realm"`
	SaslGssapiServiceName        string `default:"" help:"Kerberos service name"`
	SaslGssapiUsername           string `default:"" help:"Kerberos username"`
	SaslGssapiKeyTabPath         string `default:"" help:"Kerberos key tab path"`
	SaslGssapiKerberosConfigPath string `default:"/etc/krb5.conf" help:"Kerberos config path"`

	// Collection configuration
	LocalOnlyCollection    bool   `` /* 132-byte string literal not displayed */
	CollectBrokerTopicData bool   `` /* 213-byte string literal not displayed */
	TopicMode              string `` /* 147-byte string literal not displayed */
	TopicList              string `default:"[]" help:"JSON array of strings with the names of topics to monitor. Only used if collect_topics is set to 'List'"`
	TopicRegex             string `default:"" help:"A regex pattern that matches the list of topics to collect. Only used if collect_topics is set to 'Regex'"`
	TopicBucket            string `` /* 279-byte string literal not displayed */
	CollectTopicSize       bool   `` /* 160-byte string literal not displayed */
	CollectTopicOffset     bool   `` /* 148-byte string literal not displayed */

	// Consumer offset arguments
	ConsumerOffset     bool   `default:"false" help:"Populate consumer offset data"`
	ConsumerGroups     string `` /* 164-byte string literal not displayed */
	ConsumerGroupRegex string `default:"" help:"A regex pattern matching the consumer groups to collect"`

	Timeout int `default:"10000" help:"Timeout in milliseconds per single JMX query."`
}

ArgumentList is the raw arguments passed into the integration via yaml or CLI args

type BrokerHost

type BrokerHost struct {
	Host          string
	KafkaPort     int    `json:"kafka_port"`
	KafkaProtocol string `json:"kafka_protocol"`
	JMXPort       int    `json:"jmx_port"`
	JMXUser       string `json:"jmx_user"`
	JMXPassword   string `json:"jmx_password"`
	SaslUsername  string `json:"sasl_username"`
	SaslPassword  string `json:"sasl_password"`
	SaslMechanism string `json:"sasl_mechanism"`
}

BrokerHost is a storage struct for manual Broker connection information

type ConsumerGroups

type ConsumerGroups map[string]map[string][]int32

ConsumerGroups is the structure to represent the whitelist for consumer_groups argument

type JMXHost

type JMXHost struct {
	Name     string
	Host     string
	Port     int
	User     string
	Password string
}

JMXHost is a storage struct for producer and consumer connection information

type ParsedArguments

type ParsedArguments struct {
	sdkArgs.DefaultArgumentList

	ClusterName  string
	KafkaVersion sarama.KafkaVersion

	AutodiscoverStrategy string

	// Zookeeper autodiscovery. Only required if using zookeeper to autodiscover brokers
	ZookeeperHosts      []*ZookeeperHost
	ZookeeperAuthScheme string
	ZookeeperAuthSecret string
	ZookeeperPath       string
	PreferredListener   string

	// Bootstrap discovery. Only required if AutodiscoverStrategy is `bootstrap`
	BootstrapBroker *BrokerHost

	// Broker TLS options
	TLSCaFile             string
	TLSCertFile           string
	TLSKeyFile            string
	TLSInsecureSkipVerify bool

	// Producer and consumer connection info. No autodiscovery is supported for producers and consumers
	Producers []*JMXHost
	Consumers []*JMXHost

	// JMX defaults
	DefaultJMXPort     int
	DefaultJMXHost     string
	DefaultJMXUser     string
	DefaultJMXPassword string

	// JMX SSL options
	KeyStore           string
	KeyStorePassword   string
	TrustStore         string
	TrustStorePassword string

	NrJmx string

	SaslMechanism string
	SaslUsername  string
	SaslPassword  string

	// Kerberos auth args
	SaslGssapiRealm              string
	SaslGssapiServiceName        string
	SaslGssapiUsername           string
	SaslGssapiKeyTabPath         string
	SaslGssapiKerberosConfigPath string

	// Collection configuration
	LocalOnlyCollection   bool
	CollectClusterMetrics bool
	TopicMode             string
	TopicList             []string
	TopicRegex            string
	TopicBucket           TopicBucket
	CollectTopicSize      bool
	CollectTopicOffset    bool

	// Consumer offset arguments
	ConsumerOffset     bool
	ConsumerGroups     ConsumerGroups
	ConsumerGroupRegex *regexp.Regexp

	Timeout int `default:"10000" help:"Timeout in milliseconds per single JMX query."`
}

ParsedArguments is an special version of the config arguments that has advanced parsing to allow arguments to be consumed easier.

var GlobalArgs *ParsedArguments

GlobalArgs represents the global arguments that were passed in

func ParseArgs

func ParseArgs(a ArgumentList) (*ParsedArguments, error)

ParseArgs validates the arguments in argumentList and parses them into more easily used structs

func (*ParsedArguments) CollectBrokers

func (args *ParsedArguments) CollectBrokers() bool

CollectBrokers returns whether we should collect broker metrics

type TopicBucket

type TopicBucket struct {
	BucketNumber int
	NumBuckets   int
}

TopicBucket is a struct that stores the information for bucketing topic collection

type ZookeeperHost

type ZookeeperHost struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

ZookeeperHost is a storage struct for ZooKeeper connection information

Jump to

Keyboard shortcuts

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