This commit introduces an incomplete processor that decodes varint
record length-delimited streams of io.prometheus.client.MetricFamily
Protocol Buffer messages. The Go client presently does not support
generation of said messages, but this will unblock a number of Java
changes.
This commit introduces all relevant server-side artifacts such that the
Result streams can be used by external parties for one-off tools and
such. This will ultimately better enable us to support additional
wireformats with much more ease.
Bernerd had suggested extracting the value decoders and bundling them
into the client library. After some reflection, I tend to agree with
this, since we can start breaking the onion of Prometheus itself and
localize the protocol management into its own scope.
A couple of major changes since moving:
- Protocol 0.0.2 has moved to a struct{} so that our tests can perform
value matching, which cannot be done against function literals.
- Processing now acquires options to dictate behavioral changes of
metrics bodies.
- Processing no longer closes the stream, thusly returning this to the
hands of the caller.
- Process() has been renamed to ProcessSingle to better convey that it
works on complete message bodies. This paves the way for better
streaming payload support that the next API version will offer.
* Drop `AsMarshallable()` from the Metric interface. Use
`json.Marshaler` and `MarshalJSON()`, and leverage JSON struct tags
where possible.
* Add `MarshalJSON()` to Registry and remove `dumpToWriter`, which
makes the registry handler much simpler.
In addition to simplifying some of the marshalling behavior, this also
has the nice side effect of cutting down the number of
`map[string]interface{}` instances.
Examining the existing documentation over the standard Go documentation
server revealed some serious formatting flaws. Everything should be
readable now.
- Comments are migrated from ``/* */`` to ``//`` per convention.
- ``NewDefaultHistogram`` helper.
- ``Registry.Handler`` and ``Registry.YieldExporter`` deprecation.
- Cleanup of legacy import paths.
- Updating examples to use acknowledged patterns.
- Parameterizing the random parameter namespaces for ``examples/random/main.go``, which is useful for demoing population behaviors.
1. The output format is now versioned per the Semantic Versioning scheme. Mainline Prometheus will be adapted to use differing consumption methodologies as the generators' formats evolve to support legacy clients.
2. The telemetry outputter now supports GZIP output encoding. In sample runs, this cuts the output size in half.
3. Basic sanity tests are added for registration with varying levels of pedanticness.
4. We have support for base labels in the registration and emission phases.
5. We have label support for individual metric mutation operations.
6. A number of simplications have been made.