storj/cmd/statreceiver
Jeff Wendling e74cac52ab
Command line flags features and cleanup (#2068)
* change BindSetup to be an option to Bind
* add process.Bind to allow composite structures
* hack fix for noprefix flags
* used tagged version of structs

Before this PR, some flags were created by calling `cfgstruct.Bind` and having their fields create a flag. Once the flags were parsed, `viper` was used to acquire all the values from them and config files, and the fields in the struct were set through the flag interface.

This doesn't work for slices of things on config structs very well, since it can only set strings, and for a string slice, it turns out that the implementation in `pflag` appends an entry rather than setting it.

This changes three things:

1. Only have a `Bind` call instead of `Bind` and `BindSetup`, and make `BindSetup` an option instead.
2. Add a `process.Bind` call that takes in a `*cobra.Cmd`, binds the struct to the command's flags, and keeps track of that struct in a global map keyed by the command.
3. Use `viper` to get the values and load them into the bound configuration structs instead of using the flags to propagate the changes.

In this way, we can support whatever rich configuration we want in the config yaml files, while still getting command like flags when important.
2019-05-29 17:56:22 +00:00
..
luacfg cmd/statreceiver: enable lua libraries in lua config (#1919) 2019-05-09 08:46:01 +03:00
common.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00
copy.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00
db.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00
example.lua cmd/statreceiver: allow for packet filtering to packet destinations (#2019) 2019-05-22 16:19:32 -06:00
file.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00
filter.go cmd/statreceiver: allow for packet filtering to packet destinations (#2019) 2019-05-22 16:19:32 -06:00
graphite.go reorder graphite metric string for easier parsing (#1362) 2019-02-26 15:47:31 +02:00
main.go Command line flags features and cleanup (#2068) 2019-05-29 17:56:22 +00:00
parser.go cmd/statreceiver: allow for packet filtering to packet destinations (#2019) 2019-05-22 16:19:32 -06:00
print.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00
README.md Update README.md 2018-12-20 10:01:28 -07:00
sanitizer.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00
schema.sql cmd/statreceiver: lua-scriptable stat receiver (#636) 2018-12-11 11:24:31 -07:00
udp.go updates copyright 2018 to 2019 (#1133) 2019-01-24 15:15:10 -05:00

statreceiver

This package implements a Lua-scriptable pipeline processor for zeebo/admission telemetry packets (like monkit or something).

There are a number of types of objects involved in making this work:

  • Sources - A source is a source of packets. Each packet is a byte slice that, when parsed, consists of application and instance identification information (such as the application name and perhaps the MAC address or some other id of the computer running the application), and a list of named floating point values. There are currently two types of sources, a UDP source and a file source. A UDP source appends the current time as the timestamp to all packets, whereas a file source should have a prior timestamp to attach to each packet.
  • Packet Destinations - A packet destination is something that can handle a packet with a timestamp. This is either a packet parser, a UDP packet destination for forwarding to another process, or a file destination that will serialize all packets and timestamps for later replay.
  • Metric Destinations - Once a packet has been parsed, the contained metrics can get sent to a metric destination, such as a time series database, a relational database, stdout, a metric filterer, etc.

Please see example.lua for a good example of using this pipeline.

Setup

If you use a relational database metric destination, make sure to instantiate the schema provided in schema.sql first.