cmd

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2016 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Overview

Package cmd is where all command-line options for vulcan are defined. These commands should parse user-provided variables and call other vulcan functions. Very limited logic should exist in cmd outside of what is necessary to instantiate other vulcan components.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoScrapeConfig is when the provided config omits or has a zero list of scrape configs
	ErrNoScrapeConfig = errors.New("no scrape config found")
	// ErrMultipleScrapeConfig is when the provided config has more than one scrape configs
	ErrMultipleScrapeConfig = errors.New("multiple scrape configs found")
	// ErrNoArgs is when the command line expected an arg but none was provided
	ErrNoArgs = errors.New("no args")
	// ErrMultipleArgs is when the command line expected one arge but multiple were provided
	ErrMultipleArgs = errors.New("multiple arguments in single argument command")
)
View Source
var Ingester = &cobra.Command{
	Use:   "ingester",
	Short: "runs the ingester service to consume metrics from kafka into cassandra",
	RunE: func(cmd *cobra.Command, args []string) error {
		log.SetLevel(log.DebugLevel)

		cmd.Flags().VisitAll(func(f *pflag.Flag) {
			viper.BindPFlag(f.Name, f)
		})

		err := cassandra.SetupTables(strings.Split(viper.GetString("cassandra-addrs"), ","), viper.GetString("cassandra-keyspace"))
		if err != nil {
			return err
		}

		sw, err := cassandra.NewSampleWriter(&cassandra.SampleWriterConfig{
			CassandraAddrs: strings.Split(viper.GetString("cassandra-addrs"), ","),
			Keyspace:       viper.GetString("cassandra-keyspace"),
			Timeout:        30 * time.Second,
		})
		if err != nil {
			return err
		}

		source, err := kafka.NewAckSource(&kafka.AckSourceConfig{
			Addrs:     strings.Split(viper.GetString("kafka-addrs"), ","),
			ClientID:  viper.GetString("kafka-client-id"),
			Converter: kafka.DefaultConverter{},
			Topic:     viper.GetString("kafka-topic"),
		})
		if err != nil {
			return err
		}
		prometheus.MustRegister(source)

		i := ingester.NewIngester(&ingester.Config{
			SampleWriter: sw,
			AckSource:    source,
		})
		prometheus.MustRegister(i)
		go func() {
			http.Handle("/metrics", prometheus.Handler())
			http.ListenAndServe(":8080", nil)
		}()
		return i.Run()
	},
}

Ingester handles parsing the command line options, initializes, and starts the ingester service accordingling. It is the entry point for the Ingester service.

Functions

func Indexer

func Indexer() *cobra.Command

Indexer handles parsing the command line options, initializes, and starts the indexer service accordingling. It is the entry point for the Indexer service.

func Job

func Job() *cobra.Command

Job returns an instantiated job subcommand

func Querier

func Querier() *cobra.Command

Querier handles parsing the command line options, initializes and starts the querier service accordingling. It is the entry point for the Querier service.

func Scraper

func Scraper() *cobra.Command

Scraper handles parsing the command line options, initializes, and starts the scraper service accordingling. It is the entry point for the scraper service.

func Version

func Version(hash, version string) *cobra.Command

Version handles the command line option for the Vulcan version.

Types

This section is empty.

Jump to

Keyboard shortcuts

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