
Protobuf parsing in Python | Datadog
6/8/2017
This post introduces the concept of Protocol Buffers for data serialization and explores its practical application within Datadog for extracting metrics from Kubernetes via kube-state-metrics. It details the process of defining `.proto` files, using `protoc` to generate Python code, and implementing custom logic for streaming multiple protobuf messages by prepending their sizes using internal `google.protobuf.internal` encoder/decoder functions. The post includes benchmarks comparing payload sizes of protobuf and plain text formats, and discusses the performance implications of the pure Python implementation versus C++ extensions.