Serialization
The prometheus lexicon serializes two files:
- The rule file, from every
RuleGroupin the build:groups:, each with itsname, optionalinterval,query_offset,limitandlabels, and itsrules. This is the filerule_files:points at andpromtool check rulesreads. alertmanager.yml, from theAlertmanagerSettings,Route,InhibitRule,ReceiverandTimeIntervalentities, in that section order:global,templates,route,inhibit_rules,receivers,time_intervals,tracing.
The rule file is the primary output when the build declares any rule
groups, and alertmanager.yml is written beside it (-o dist/rules.yml
also writes dist/alertmanager.yml). A build with only Alertmanager
entities emits alertmanager.yml as its primary output.
- Rules inside a group and child routes keep the order they are written in,
which is the order Prometheus evaluates and Alertmanager matches them.
Groups, receivers and time intervals, whose order carries no meaning, are
sorted by name, so the files are the same however they were built. Keys
inside a rule come out in the order Prometheus documents them (
recordoralert,expr,for,keep_firing_for,labels,annotations). - A route references its receiver and time intervals by name in the output, whether the declaration used the entity or a string.
- The root route is the one
Routeno other route lists as a child. - Neither file has a metadata channel, so no ownership marker is stamped.