master
md 20 lines 855 Bytes
Rendered Raw
1 # metricgen
2
3 `metricgen` is a lightweight helper that emits typed Go boilerplate for IBM.D modules. It reads the same `contexts/contexts.yaml` file used by docgen and produces strongly typed setters or utility structs that make it easier to export metrics without hand-writing repetitive code.
4
5 Usage example (from a module directory):
6
7 ```go
8 //go:generate go run ../../metricgen \
9 // -module=db2 \
10 // -contexts=contexts/contexts.yaml \
11 // -out=contexts/zz_generated_contexts.go
12 ```
13
14 The generated file is committed to source control and used by the collector:
15
16 - Adds typed `Set` helpers for every context/dimension
17 - Exposes label structs for dynamic charts
18 - Keeps naming synchronized with `contexts.yaml`
19
20 You can extend the tool if a module needs additional scaffolding, but in most cases the default output is sufficient.