Migrations
Migrating to 2.X¶
Version 2.X consists of a major rewrite that greatly simplifies spectator-cpp and the process in which it sends metrics to SpectatorD.
New¶
Writers¶
spectator.Registry now supports 3 different writers. The WriterType is specified through a WriterConfig object.
See Usage > Output Location for more details.
Common Tags¶
A few local environment common tags are now automatically added to all Meters. Their values are read from the environment variables.
| Tag | Environment Variable |
|---|---|
| nf.container | TITUS_CONTAINER_NAME |
| nf.process | NETFLIX_PROCESS_NAME |
Tags from environment variables take precedence over tags passed on code when creating the Config.
Note that common tags sourced by spectatord can't be overwritten.
Registry, Config, and Writer Config¶
Configis now created through a constructor which throws an error, if the passed in parameters are not valid.WriterConfignow specifies which writer type the thin client uses.WriterConfigallows line buffering for all writer types.Registryis instantiated by passing only aConfigobject to it.
Migration Steps¶
- Remove old references to the old spectator library implementation.
- Utilize the
Config&WriterConfigto initialize theRegistry. - Currently there is no support for collecting runtime metrics, using the spectator-cpp library.
- If you need to configure a
Registrythat doesn't emit metrics, for testing purposes, you can use theWriterConfigto configure aMemoryWriter. This will emit metrics to a vector, so make sure to clear the vector every so often.