Company
Date Published
Author
Dieter Plaetinck
Word count
463
Language
English
Hacker News points
None

Summary

Metrictank, a software used in production at Grafana Labs, has introduced the metrics2docs tool to address challenges in documenting metrics for both internal teams and external customers. This tool generates up-to-date documentation directly from Golang code annotations, ensuring that metric descriptions remain current and consistent across both code and public documentation. It supports inline and block comments, allowing developers to document metrics alongside their declarations, which facilitates easy updates. A script is used to automate the generation of configuration and metrics documentation, ensuring all documents remain current. While the team is considering ways to integrate this documentation into Grafana for user accessibility, they also recommend consulting the operations guide for further insights on metrictank's optimal usage. The development of metrics2docs is aided by Go's packages like go/parser and go/ast, which simplify the process of parsing and utilizing Go code.