Refactor metrics catalog to allow services to augment default values transparently
On runbooks, the services' default definitions are used to avoid repetition and they can be overridden per service on demand, for example.
As of now, each service definition needs to be aware of how to override its defaults properly to avoid removing sensible defaults, by using the jsonnet built-in functionality of merging objects with the +
operator.
Parts of the service definition abstraction relies on the mergePatch function to merge attributes, which works as expected, but for some scenarios, where more complex objects (with attributes being functions, for example), the mergePatch
is not an option.
Relying on the +
operator to merge default values is error-prone, as someone could easily forget it, and a reviewer may not spot the lack of it since jsonnet will still generate a valid output in the end.
A nestedMerge
function, working similarly to mergePatch
, could be a potential solution to be used by the service definition abstraction and mitigate a problem like this. As this problem has been spotted before.