forked from mirror/client_golang
ecac33bed0
The idea here is to always go via the protobufs if dealing with the text format. That won't always be the most efficient way, but it avoids the multiplicity of conversion routines required for direct conversion (e.g. text format -> internal representation in the Prometheus server). The loss of efficiency is acceptable because the text format should not be used in high performance (high throughput, low latency) situations anyway. In that way, the text format stays perfectly isolated from other parts of the code. To receive text format, just plug the conversion in before the code path that normally reads protobufs. Correspondingly, for sending text format, simply replace the WriteDelimited call by a text.Create call. Nevertheless, the conversion code itself is optimized for efficiency and minimized memory churn (which was one of the reason for handcoding the parser and not using a lexer/parser code generation tool). Change-Id: Iee45ffe8aa421a844225d13a1f859becd8a3b066 |
||
---|---|---|
.. | ||
create.go | ||
create_test.go | ||
parse.go | ||
parse_test.go |