@intentius/chant-lexicon-prometheus 0.106.4 → 0.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +6 -1
  2. package/dist/api/alertmanager.d.ts +56 -0
  3. package/dist/api/alertmanager.d.ts.map +1 -0
  4. package/dist/api/apply.d.ts +126 -0
  5. package/dist/api/apply.d.ts.map +1 -0
  6. package/dist/api/bind.d.ts +49 -0
  7. package/dist/api/bind.d.ts.map +1 -0
  8. package/dist/api/client.d.ts +76 -0
  9. package/dist/api/client.d.ts.map +1 -0
  10. package/dist/api/evaluated.d.ts +36 -0
  11. package/dist/api/evaluated.d.ts.map +1 -0
  12. package/dist/api/fake-servers.d.ts +74 -0
  13. package/dist/api/fake-servers.d.ts.map +1 -0
  14. package/dist/api/index.d.ts +18 -0
  15. package/dist/api/index.d.ts.map +1 -0
  16. package/dist/api/ruler.d.ts +87 -0
  17. package/dist/api/ruler.d.ts.map +1 -0
  18. package/dist/composites/alert-routing.d.ts +104 -0
  19. package/dist/composites/alert-routing.d.ts.map +1 -0
  20. package/dist/composites/catalog.d.ts.map +1 -1
  21. package/dist/composites/index.d.ts +6 -0
  22. package/dist/composites/index.d.ts.map +1 -1
  23. package/dist/composites/red-alerts.d.ts +96 -0
  24. package/dist/composites/red-alerts.d.ts.map +1 -0
  25. package/dist/composites/watchdog.d.ts +69 -0
  26. package/dist/composites/watchdog.d.ts.map +1 -0
  27. package/dist/config.d.ts +273 -0
  28. package/dist/config.d.ts.map +1 -0
  29. package/dist/describe-resources.d.ts +48 -0
  30. package/dist/describe-resources.d.ts.map +1 -0
  31. package/dist/export-resources.d.ts +41 -0
  32. package/dist/export-resources.d.ts.map +1 -0
  33. package/dist/import/alertmanager-live.d.ts +35 -0
  34. package/dist/import/alertmanager-live.d.ts.map +1 -0
  35. package/dist/import/parser.d.ts +12 -0
  36. package/dist/import/parser.d.ts.map +1 -1
  37. package/dist/index.d.ts +6 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/integrity.json +3 -3
  40. package/dist/lint/post-synth/prom-helpers.d.ts +11 -3
  41. package/dist/lint/post-synth/prom-helpers.d.ts.map +1 -1
  42. package/dist/manifest.json +1 -1
  43. package/dist/op/activities/index.d.ts +25 -0
  44. package/dist/op/activities/index.d.ts.map +1 -0
  45. package/dist/op/activities/promtool.d.ts +78 -0
  46. package/dist/op/activities/promtool.d.ts.map +1 -0
  47. package/dist/op/activities/rule-audit.d.ts +65 -0
  48. package/dist/op/activities/rule-audit.d.ts.map +1 -0
  49. package/dist/op/activities/rules-loaded.d.ts +60 -0
  50. package/dist/op/activities/rules-loaded.d.ts.map +1 -0
  51. package/dist/op/activities/silence.d.ts +80 -0
  52. package/dist/op/activities/silence.d.ts.map +1 -0
  53. package/dist/op/activity-contracts.d.ts +113 -0
  54. package/dist/op/activity-contracts.d.ts.map +1 -0
  55. package/dist/op/audit-op.d.ts +38 -0
  56. package/dist/op/audit-op.d.ts.map +1 -0
  57. package/dist/op/builders.d.ts +57 -0
  58. package/dist/op/builders.d.ts.map +1 -0
  59. package/dist/op/slo-rule-tests.d.ts +44 -0
  60. package/dist/op/slo-rule-tests.d.ts.map +1 -0
  61. package/dist/plugin.d.ts.map +1 -1
  62. package/dist/rules/prom-helpers.ts +38 -3
  63. package/package.json +19 -3
  64. package/src/api/alertmanager.ts +122 -0
  65. package/src/api/apply.test.ts +218 -0
  66. package/src/api/apply.ts +375 -0
  67. package/src/api/bind.ts +87 -0
  68. package/src/api/client.ts +138 -0
  69. package/src/api/evaluated.test.ts +78 -0
  70. package/src/api/evaluated.ts +106 -0
  71. package/src/api/fake-servers.ts +209 -0
  72. package/src/api/index.ts +29 -0
  73. package/src/api/ruler.ts +168 -0
  74. package/src/api/testdata/am-status-original.yml +85 -0
  75. package/src/composites/alert-routing.test.ts +163 -0
  76. package/src/composites/alert-routing.ts +277 -0
  77. package/src/composites/catalog.test.ts +10 -2
  78. package/src/composites/catalog.ts +214 -0
  79. package/src/composites/index.ts +14 -0
  80. package/src/composites/red-alerts.test.ts +182 -0
  81. package/src/composites/red-alerts.ts +214 -0
  82. package/src/composites/watchdog.test.ts +85 -0
  83. package/src/composites/watchdog.ts +142 -0
  84. package/src/config.test.ts +93 -0
  85. package/src/config.ts +288 -0
  86. package/src/describe-resources.test.ts +325 -0
  87. package/src/describe-resources.ts +328 -0
  88. package/src/export-resources.test.ts +253 -0
  89. package/src/export-resources.ts +193 -0
  90. package/src/import/alertmanager-live.test.ts +66 -0
  91. package/src/import/alertmanager-live.ts +291 -0
  92. package/src/import/parser.ts +18 -1
  93. package/src/import/roundtrip.test.ts +1 -0
  94. package/src/index.ts +37 -0
  95. package/src/lint/post-synth/prom-helpers.ts +38 -3
  96. package/src/op/activities/index.ts +31 -0
  97. package/src/op/activities/promtool.test.ts +107 -0
  98. package/src/op/activities/promtool.ts +149 -0
  99. package/src/op/activities/rule-audit.test.ts +89 -0
  100. package/src/op/activities/rule-audit.ts +168 -0
  101. package/src/op/activities/rules-loaded.test.ts +61 -0
  102. package/src/op/activities/rules-loaded.ts +98 -0
  103. package/src/op/activities/silence.test.ts +107 -0
  104. package/src/op/activities/silence.ts +175 -0
  105. package/src/op/activity-contracts.test.ts +141 -0
  106. package/src/op/activity-contracts.ts +96 -0
  107. package/src/op/audit-op.ts +54 -0
  108. package/src/op/builders.ts +82 -0
  109. package/src/op/slo-rule-tests.test.ts +84 -0
  110. package/src/op/slo-rule-tests.ts +173 -0
  111. package/src/plugin.ts +16 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Live export for prometheus (#3371): `chant import --from <env>` writes the
3
+ * environment's rule groups and Alertmanager config as chant TypeScript.
4
+ *
5
+ * All I/O is here. What is read goes through the file importer's own parse
6
+ * (./import/parser.ts) into the same IR, so a group read from a ruler and
7
+ * the same group in a rule file generate the same source through the same
8
+ * `PrometheusGenerator`, `Slo` recognition (./import/slo.ts) included.
9
+ *
10
+ * - Rule groups, from the environment's ruler (./api/ruler.ts). On Mimir,
11
+ * Cortex and Loki only the namespaces the profile declares are read
12
+ * (`namespace` and `groupNamespaces`, see ./config.ts); that is the
13
+ * ownership boundary, as a stack bounds a CloudFormation export. An ad-hoc
14
+ * read with no namespace declared reads every namespace of the tenant and
15
+ * says so, and with `owned` reads none. On a plain Prometheus the groups
16
+ * come from `/api/v1/rules` and are mapped back to the rule-file shape
17
+ * (./api/evaluated.ts), which is lossy, and the export says how.
18
+ * - The Alertmanager config, from `/api/v2/status` or, on Mimir and
19
+ * Cortex, `/api/v1/alerts` (./api/alertmanager.ts). Alertmanager's status
20
+ * config is its loaded config marshalled again; unless `verbatim`, what
21
+ * that adds is taken out (./import/alertmanager-live.ts). Secrets read
22
+ * `<secret>` and are named in a warning.
23
+ * - `selector.type` is `Prometheus::Rules::RuleGroup` (with `selector.name`
24
+ * a group name) or any `Prometheus::Alertmanager::*` type, which selects
25
+ * the whole config.
26
+ *
27
+ * Neither endpoint being bound is an error; one of them being unbound is a
28
+ * warning, so a project with only rule groups imports them.
29
+ */
30
+ import type { ExportedTemplate, ResourceSelector } from "@intentius/chant/lexicon";
31
+ import { type BindOptions } from "./api/bind.js";
32
+ export interface PrometheusExportOptions extends Omit<BindOptions, "environment"> {
33
+ environment: string;
34
+ stack?: string;
35
+ region?: string;
36
+ selector?: ResourceSelector;
37
+ owned?: boolean;
38
+ verbatim?: boolean;
39
+ }
40
+ export declare function exportResources(options: PrometheusExportOptions): Promise<ExportedTemplate>;
41
+ //# sourceMappingURL=export-resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-resources.d.ts","sourceRoot":"","sources":["../src/export-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAkB7D,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAyGD,wBAAsB,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8BjG"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Alertmanager's `/api/v2/status` config, back to the shape a person writes
3
+ * (#3371).
4
+ *
5
+ * `config.original` is the loaded config marshalled again, not the file
6
+ * (`Config.String()` in Alertmanager's `config/config.go`). Against
7
+ * Alertmanager v0.34.1 (`PROMETHEUS_PIN.alertmanager`) that adds three
8
+ * kinds of thing a file did not say:
9
+ *
10
+ * - `global:` with every default of `DefaultGlobalConfig()` written out:
11
+ * `resolve_timeout: 5m`, the default `http_config`, `smtp_hello`,
12
+ * `smtp_require_tls`, `smtp_tls_config` and the integration API URLs.
13
+ * - every receiver integration with the settings it inherited from `global:`
14
+ * (`http_config`, an email config's `smarthost`, `from` and SMTP auth, a
15
+ * Slack config's `api_url`, a PagerDuty config's `url`, and so on), as
16
+ * `Config.UnmarshalYAML` copies them in.
17
+ * - every integration's own defaults (`DefaultEmailConfig`,
18
+ * `DefaultSlackConfig`, `DefaultPagerdutyConfig`, ...) and the zero values
19
+ * of fields marshalled without `omitempty` (`url_file: ""`,
20
+ * `max_alerts: 0`, `continue: false`).
21
+ *
22
+ * {@link stripAlertmanagerDefaults} takes those out, so an import writes
23
+ * what a person would have declared. It drops a value only where it equals
24
+ * the default or the global it was copied from; a value someone set to the
25
+ * default is indistinguishable from one they left out, and goes too, which
26
+ * builds to the same config. `verbatim` skips it. Secrets read `<secret>`
27
+ * either way (see {@link maskedSecretPaths}).
28
+ */
29
+ type Json = Record<string, unknown>;
30
+ /** The re-marshalled config with what Alertmanager added taken out (see the module comment). Pure; `doc` is not changed. */
31
+ export declare function stripAlertmanagerDefaults(doc: Json): Json;
32
+ /** The paths that read `<secret>`, the mask Alertmanager writes over every secret it marshals. */
33
+ export declare function maskedSecretPaths(doc: unknown, at?: string): string[];
34
+ export {};
35
+ //# sourceMappingURL=alertmanager-live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alertmanager-live.d.ts","sourceRoot":"","sources":["../../src/import/alertmanager-live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAiOpC,4HAA4H;AAC5H,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CA2BzD;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,SAAK,GAAG,MAAM,EAAE,CAKjE"}
@@ -53,6 +53,18 @@ export type ParsedPrometheusFile = {
53
53
  };
54
54
  /** A matcher string Alertmanager parses back to `name op value`. */
55
55
  export declare function matcherString(name: string, op: "=" | "=~", value: string): string;
56
+ /** Load YAML the way the parser does: YAML 1.2 core types plus `<<` merge keys. */
57
+ export declare function loadPrometheusYaml(content: string): unknown;
58
+ /** A rule file already loaded (live import builds one from a ruler's groups, ../export-resources.ts). */
59
+ export declare function parseRuleFileDocument(doc: Record<string, unknown>): {
60
+ file: RuleFileConfig;
61
+ warnings: string[];
62
+ };
63
+ /** An `alertmanager.yml` already loaded (live import reads one from Alertmanager's API, ../export-resources.ts). */
64
+ export declare function parseAlertmanagerDocument(doc: Record<string, unknown>): {
65
+ config: AlertmanagerConfig;
66
+ warnings: string[];
67
+ };
56
68
  /** Parse a rule file or `alertmanager.yml`, telling them apart by shape. */
57
69
  export declare function parsePrometheusYaml(content: string): ParsedPrometheusFile;
58
70
  /** The rule file and `alertmanager.yml` parser `chant import` runs. */
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAOL,KAAK,kBAAkB,EAKvB,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EAG1B,MAAM,UAAU,CAAC;AAIlB,kDAAkD;AAClD,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B,qCAAqC,CAAC;AAE7E,yDAAyD;AACzD,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,yDAAyD;AACzD,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,2DAA2D;AAC3D,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,uEAAuE;AACvE,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,4BAA4B;AAC5B,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAgH7E,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,IAAI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MAAM,EAAE,oBAAoB,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAgH7E,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjF;AA0MD,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,yGAAyG;AACzG,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAGhH;AAED,oHAAoH;AACpH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAG1H;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,CAgBzE;AAED,uEAAuE;AACvE,qBAAa,gBAAiB,YAAW,cAAc;IACrD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAqBjC;CACF"}
package/dist/index.d.ts CHANGED
@@ -11,5 +11,10 @@ export { checkPromql, PROMQL_GRAMMAR, type PromqlCheck } from "./promql.js";
11
11
  export { validateRuleFile, validateRunbookUrls, validateAlertmanagerConfig, validateSeverityRouting, alertSeverities, type PrometheusIssue, type PrometheusIssueCode, } from "./validate-config.js";
12
12
  export { PROMETHEUS_PIN } from "./pin.js";
13
13
  export { promtoolCheckRules, promtoolCheckConfig, promtoolTestRules, amtoolCheckConfig, hasTool, type ToolResult } from "./tools.js";
14
- export { Slo, sloMetrics, sloPropsProblem, sliExprProblem, eventCount, DEFAULT_BURN_RATES, SLO_WINDOW_PLACEHOLDER, type SloProps, type SloSli, type SloAlerting, type SloAlertTier, type BurnRateWindow, type SloMembers, type SloInstance, type SloMetrics, type SloBurnRate, GenAiRules, genAiRuleMetrics, type GenAiRulesProps, type GenAiRulesMembers, type GenAiRulesInstance, type GenAiRuleMetrics, type GenAiPrice, type GenAiAlerting, type GenAiAlertOptions, type GenAiRatioAlert, type GenAiLatencyAlert, type GenAiBudget, type GenAiAlertInfo, type GenAiQuantileSeries, } from "./composites/index.js";
14
+ export { Slo, sloMetrics, sloPropsProblem, sliExprProblem, eventCount, DEFAULT_BURN_RATES, SLO_WINDOW_PLACEHOLDER, type SloProps, type SloSli, type SloAlerting, type SloAlertTier, type BurnRateWindow, type SloMembers, type SloInstance, type SloMetrics, type SloBurnRate, GenAiRules, genAiRuleMetrics, type GenAiRulesProps, type GenAiRulesMembers, type GenAiRulesInstance, type GenAiRuleMetrics, type GenAiPrice, type GenAiAlerting, type GenAiAlertOptions, type GenAiRatioAlert, type GenAiLatencyAlert, type GenAiBudget, type GenAiAlertInfo, type GenAiQuantileSeries, RedAlerts, redAlertRules, RED_ALERT_NAMES, type RedAlertsProps, type RedAlertsMembers, type RedAlertsInstance, type RedAlertOptions, type RedErrorRatioAlert, type RedLatencyAlert, Watchdog, WATCHDOG_URL_FILE, type WatchdogProps, type WatchdogMembers, type WatchdogInstance, AlertRouting, ALERT_ROUTING_LEVELS, type AlertRoutingProps, type AlertRoutingMembers, type AlertRoutingInstance, type AlertRoutingLevel, type AlertRoutingTeam, type AlertRoutingTiming, type AlertRoutingReceiver, } from "./composites/index.js";
15
+ export { prometheusConfigSchema, resolveRulerTarget, resolveAlertmanagerTarget, declaredNamespaces, namespaceOfGroup } from "./config.js";
16
+ export type { PrometheusLexiconConfig, PrometheusProfile, RulerProfile, AlertmanagerProfile, RulerKind, AlertmanagerKind } from "./config.js";
17
+ export { amtoolRoutesTest, alertmanagerSilence, alertmanagerUnsilence, rulesLoadedObserve, ruleAudit } from "./op/builders.js";
18
+ export { RuleAuditOp, type RuleAuditOpConfig, type RuleAuditOpResources } from "./op/audit-op.js";
19
+ export { sloRuleTests, type SloTestInput } from "./op/slo-rule-tests.js";
15
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxF,OAAO,EACL,SAAS,EACT,eAAe,EACf,WAAW,EACX,eAAe,EACf,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,UAAU,EACV,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,GAChC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAG7B,cAAc,SAAS,CAAC;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AiB,EACtB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxF,OAAO,EACL,SAAS,EACT,eAAe,EACf,WAAW,EACX,eAAe,EACf,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,UAAU,EACV,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,GAChC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAG7B,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EAC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B,SAAS,EACT,aAAa,EACb,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,QAAQ,EACR,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,YAAY,EACZ,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvI,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAM3I,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "2c6be256cd5955acb726931e4eaf531b1f165026a06bf77c1673e476bdb84dfb",
4
+ "manifest.json": "792b4452301bdc29a6969c248b3510fd9016f60ed5d040cc18a1f102c7161a16",
5
5
  "meta.json": "a06b8059e2de2ca6c8131bfbbfe7e143e818f2d2d497d3f45a9bc5c63af6aeeb",
6
6
  "types/index.d.ts": "150d72287453a24a40cdeffb8cf3e9dc6e77ab58b342b48d01902dc58fb5f85d",
7
7
  "rules/literal-credential.ts": "1ea8b768e9dc4a6d7b133a52923ce2e8cb815584d3eeb1854f77af34d50f8257",
8
8
  "rules/prom-ast.ts": "6de6f83cfa81505efeb2c55aa1e9872ead9b09695a400c92bec8fa11059a551f",
9
9
  "rules/promql-literal.ts": "c734b6d9f0949ac7529edd6e687f7a5a1e62f37e614492f0e92e7062260e85db",
10
10
  "rules/slo-literal.ts": "13f86da17d11939ebbcf64be38b092b602f6c9e95876e1615c00a032638d75b1",
11
- "rules/prom-helpers.ts": "1c7aa83f7635096fe3364c959f5c0376e74187529a0ccc8bf0602d47d0ada8dd",
11
+ "rules/prom-helpers.ts": "eacd3456e331129e356cde2187bbc3c7b5ac54e8836a5dae2dd149d8fa0541f7",
12
12
  "rules/prom101.ts": "f153c2b0b5f43b51e15053d732f27321aeb33c76683416b47982a95986704935",
13
13
  "rules/prom102.ts": "d40d7d4690ada12efcf50c471739b2254376cbd382c1d8c547bbadca3205a1fa",
14
14
  "rules/prom103.ts": "7801469c838023083ef3c196fffc6ab71b05270dba439fc19cb1dc383a6a8f64",
@@ -46,5 +46,5 @@
46
46
  "skills/chant-prometheus-alertmanager.md": "4c4a22bea6147653d09d7d3f55f81c4927963d4e2f50b2e430fbb9023e99570b",
47
47
  "skills/chant-prometheus-kubernetes.md": "cca016857891f4cabf1feb6f9db83c220a2e6ece200cd89e635851079f8070a8"
48
48
  },
49
- "composite": "968b2054ad9877915712a06c995193113cd7582e008f76dbc327eac5cc58122a"
49
+ "composite": "e0c13b36937c568b7e56ff13a6a3e881f07ddc0ecf1c39ff01014c3129adac19"
50
50
  }
@@ -5,9 +5,9 @@
5
5
  *
6
6
  * Documents are recognized by shape, not by which lexicon emitted them, so a
7
7
  * rule file that reaches the output some other way (a hand-written YAML
8
- * sidecar) is checked too. `PrometheusRule` manifests are not read here;
9
- * their groups are the same `RuleGroup`s and are checked where they are
10
- * declared.
8
+ * sidecar) is checked too. `PrometheusRule` manifests are not read here:
9
+ * `chant build` hands each lexicon's checks only that lexicon's output, so the
10
+ * k8s lexicon's WK8606 runs `prometheusRuleDiagnostics` (below) over them.
11
11
  */
12
12
  import type { PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
13
13
  import { type PrometheusConfigFile } from "../../config-model.js";
@@ -44,4 +44,12 @@ export declare function runbookDiagnostics(ctx: PostSynthContext): PostSynthDiag
44
44
  export declare function collectorMetricDiagnostics(ctx: PostSynthContext): PostSynthDiagnostic[];
45
45
  /** PROM202: joins every rule file in the output against every Alertmanager config in it. Silent when either is absent. */
46
46
  export declare function routingDiagnostics(ctx: PostSynthContext): PostSynthDiagnostic[];
47
+ /**
48
+ * The rule-file checks (PROM101-PROM107, PROM211, PROM213-PROM219) over the
49
+ * groups of every `PrometheusRule` in the build, whichever lexicon emitted
50
+ * it. `spec.groups` is a rule file's `groups`, so `validateRuleFile` reads it
51
+ * as is. Findings keep their PROM ids and name the PrometheusRule's namespace
52
+ * and name. PROM212 (runbook URLs) stays opt-in and is not run here.
53
+ */
54
+ export declare function prometheusRuleDiagnostics(ctx: PostSynthContext): PostSynthDiagnostic[];
47
55
  //# sourceMappingURL=prom-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prom-helpers.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAI9F,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1F,OAAO,EAAkD,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAA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mB,EAAE,CA0BtF"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prometheus",
3
- "version": "0.106.4",
3
+ "version": "0.108.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Prometheus",
6
6
  "intrinsics": [],
@@ -0,0 +1,25 @@
1
+ /**
2
+ * prometheus Op activities (#3369), resolved by the core activity registry
3
+ * when a project's `chant.config.ts` lists the `prometheus` lexicon. Every
4
+ * function this module exports is an activity, bound by its export name, so
5
+ * the helpers behind them stay in their own files.
6
+ *
7
+ * - `promtoolCheckRules`, `promtoolTestRules`, `amtoolCheckConfig`: the
8
+ * upstream tools over built files, failing the step when the tool is
9
+ * missing or rejects the file.
10
+ * - `amtoolRoutesTest`: labels route to the expected receivers.
11
+ * - `alertmanagerSilence`, `alertmanagerUnsilence`: a silence around a
12
+ * change, recorded so the final and `onFailure` phases can expire it.
13
+ * - `rulesLoadedObserve`: declared rule groups as the resources of a
14
+ * `ConvergeOp({ observe })`.
15
+ * - `ruleAudit`: the step of `RuleAuditOp`.
16
+ */
17
+ export { promtoolCheckRules, promtoolTestRules, amtoolCheckConfig, amtoolRoutesTest } from "./promtool.js";
18
+ export type { ToolStepResult, PromtoolCheckRulesArgs, PromtoolTestRulesArgs, AmtoolCheckConfigArgs, AmtoolRoutesTestArgs, AmtoolRoutesTestResult, } from "./promtool.js";
19
+ export { alertmanagerSilence, alertmanagerUnsilence } from "./silence.js";
20
+ export type { AlertmanagerSilenceArgs, AlertmanagerSilenceResult, AlertmanagerUnsilenceArgs, AlertmanagerUnsilenceResult } from "./silence.js";
21
+ export { rulesLoadedObserve } from "./rules-loaded.js";
22
+ export type { RulesLoadedObserveArgs, RulesLoadedObserveResult } from "./rules-loaded.js";
23
+ export { ruleAudit } from "./rule-audit.js";
24
+ export type { RuleAuditArgs, RuleAuditResult, RuleAuditFinding, RuleAuditFindingKind, RuleAuditMode } from "./rule-audit.js";
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxG,YAAY,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvE,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAC5I,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * `promtool` and `amtool` as Op steps (#3369), over the functions in
3
+ * `../../tools.ts`.
4
+ *
5
+ * Those functions report `ran: false` when the binary is missing, so tests
6
+ * and CI can skip them. A step does not: a check that did not run must not
7
+ * read as a check that passed, so a missing binary fails the step, and so
8
+ * does a file the tool rejects, with the tool's output as the message.
9
+ *
10
+ * Paths are relative to the working directory. `promtoolTestRules` writes
11
+ * the rule file as `rules.yml` beside each test file, so a test file's
12
+ * `rule_files:` names `rules.yml`; the tests `sloRuleTests()` generates
13
+ * from `Slo` declarations do.
14
+ */
15
+ import { type ExecRunner } from "@intentius/chant-lexicon-otel/op/activities/exec";
16
+ export interface ToolStepResult {
17
+ /** The files checked. */
18
+ files: string[];
19
+ ok: boolean;
20
+ output: string;
21
+ }
22
+ export interface PromtoolCheckRulesArgs {
23
+ /** One rule file or several, e.g. `dist/prometheus/rules.yml`. */
24
+ rules: string | string[];
25
+ /** The promtool binary. Default `$PROMTOOL`, else `promtool`. */
26
+ bin?: string;
27
+ }
28
+ export interface PromtoolTestRulesArgs {
29
+ /** The rule file under test, e.g. `dist/prometheus/rules.yml`. */
30
+ rules: string;
31
+ /** Unit-test files, each naming `rules.yml` in `rule_files:`. */
32
+ tests?: string | string[];
33
+ /** Unit-test documents given inline, such as the ones `sloRuleTests()` generates. */
34
+ testYaml?: string | string[];
35
+ /** The promtool binary. Default `$PROMTOOL`, else `promtool`. */
36
+ bin?: string;
37
+ }
38
+ export interface AmtoolCheckConfigArgs {
39
+ /** The Alertmanager config, e.g. `dist/prometheus/alertmanager.yml`. */
40
+ config: string;
41
+ /** The amtool binary. Default `$AMTOOL`, else `amtool`. */
42
+ bin?: string;
43
+ }
44
+ export interface AmtoolRoutesTestArgs {
45
+ /** The Alertmanager config. */
46
+ config: string;
47
+ /** The alert's labels. */
48
+ labels: Record<string, string>;
49
+ /** The receiver, or receivers in order, the labels must route to. */
50
+ expect: string | string[];
51
+ /** The amtool binary. Default `$AMTOOL`, else `amtool`. */
52
+ bin?: string;
53
+ /** Replaces the child process. For tests. */
54
+ _exec?: ExecRunner;
55
+ }
56
+ export interface AmtoolRoutesTestResult {
57
+ config: string;
58
+ labels: Record<string, string>;
59
+ /** The receivers amtool resolved, in order. */
60
+ receivers: string[];
61
+ ok: boolean;
62
+ }
63
+ /** `promtool check rules` over each rule file. */
64
+ export declare function promtoolCheckRules(args: PromtoolCheckRulesArgs): Promise<ToolStepResult>;
65
+ /** `promtool test rules` over the rule file, once per test file or inline test document. */
66
+ export declare function promtoolTestRules(args: PromtoolTestRulesArgs): Promise<ToolStepResult & {
67
+ tests: number;
68
+ }>;
69
+ /** `amtool check-config` over the Alertmanager config. */
70
+ export declare function amtoolCheckConfig(args: AmtoolCheckConfigArgs): Promise<ToolStepResult>;
71
+ /**
72
+ * The receivers amtool printed: its last non-empty line, comma-separated
73
+ * (`oncall` or `oncall,tickets`).
74
+ */
75
+ export declare function parseRoutesOutput(output: string): string[];
76
+ /** `amtool config routes test`: the labels route to the expected receivers, in order. */
77
+ export declare function amtoolRoutesTest(args: AmtoolRoutesTestArgs): Promise<AmtoolRoutesTestResult>;
78
+ //# sourceMappingURL=promtool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promtool.d.ts","sourceRoot":"","sources":["../../../src/op/activities/promtool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAQhG,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,qEAAqE;IACrE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,+CAA+C;IAC/C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,EAAE,EAAE,OAAO,CAAC;CACb;AAcD,kDAAkD;AAClD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAO9F;AAED,4FAA4F;AAC5F,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAWhH;AAED,0DAA0D;AAC1D,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,CAG5F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D;AAED,yFAAyF;AACzF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAgBlG"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * `ruleAudit`: what a live Prometheus says about its rules (#3369), the
3
+ * activity behind `RuleAuditOp`.
4
+ *
5
+ * - groups with health errors: every rule `/api/v1/rules` reports with
6
+ * `health: "err"`, with its `lastError`.
7
+ * - alerts pending or firing past a threshold, from `/api/v1/alerts`: a
8
+ * pending alert older than `pendingFor` is one whose `for` never
9
+ * completes (a flapping condition), and a firing one older than
10
+ * `firingFor` is one nobody is acting on.
11
+ * - selectors no live target emits: each distinct vector selector in the
12
+ * loaded rules' expressions, queried as
13
+ * `count(last_over_time(<selector>[<lookback>]))`. An empty answer means
14
+ * the rule reads a series nothing writes (a renamed metric, a dropped
15
+ * label, a target that is gone). Selectors over series the rules record
16
+ * themselves, and over `ALERTS`, are left out. One query per selector, at
17
+ * most `selectorBudget` of them; the rest are counted as unchecked.
18
+ *
19
+ * `mode` is `report` (return the findings) or `issue` (keep one open issue
20
+ * current with them).
21
+ */
22
+ import { type CommandRunner } from "@intentius/chant-lexicon-otel/op/activities/github";
23
+ import { type ApiRuleGroup } from "./rules-loaded.js";
24
+ export type RuleAuditMode = "report" | "issue";
25
+ export interface RuleAuditArgs {
26
+ /** Prometheus's base URL. Default `$PROMETHEUS_URL`, else `http://localhost:9090`. */
27
+ url?: string;
28
+ /** A pending alert older than this is a finding. Default `1h`. */
29
+ pendingFor?: string;
30
+ /** A firing alert older than this is a finding. Default `24h`. */
31
+ firingFor?: string;
32
+ /** At most this many selector queries. Default 50. */
33
+ selectorBudget?: number;
34
+ /** How far back a selector's series may last have been written. Default `1h`. */
35
+ lookback?: string;
36
+ mode?: RuleAuditMode;
37
+ /** The issue's title in `issue` mode. Default `prometheus: rule audit findings`. */
38
+ issueTitle?: string;
39
+ _fetch?: typeof fetch;
40
+ _run?: CommandRunner;
41
+ _now?: () => Date;
42
+ }
43
+ export type RuleAuditFindingKind = "rule-error" | "pending-too-long" | "firing-too-long" | "selector-no-series";
44
+ export interface RuleAuditFinding {
45
+ kind: RuleAuditFindingKind;
46
+ /** The group, the alert, or the selector. */
47
+ subject: string;
48
+ detail: string;
49
+ }
50
+ export interface RuleAuditResult {
51
+ mode: RuleAuditMode;
52
+ findings: RuleAuditFinding[];
53
+ /** Selector queries made. */
54
+ queried: number;
55
+ /** Selectors left unchecked by the budget. */
56
+ unchecked: number;
57
+ summary: string;
58
+ issueUrl?: string;
59
+ }
60
+ /** The distinct selectors the rules read, without the ones over recorded series and ALERTS. */
61
+ export declare function auditedSelectors(groups: ApiRuleGroup[]): string[];
62
+ export declare function renderRuleAuditSummary(findings: RuleAuditFinding[], queried: number, unchecked: number): string;
63
+ /** Audit a live Prometheus's rules, alerts and selectors. */
64
+ export declare function ruleAudit(args?: RuleAuditArgs): Promise<RuleAuditResult>;
65
+ //# sourceMappingURL=rule-audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-audit.d.ts","sourceRoot":"","sources":["../../../src/op/activities/rule-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAGpH,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,KAAK,CAAC;IACtB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAEhH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgBD,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAcjE;AAWD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS/G;AAED,6DAA6D;AAC7D,wBAAsB,SAAS,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+ClF"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Declared rule groups as resources a `ConvergeOp` observes (#3369).
3
+ *
4
+ * `rulesLoadedObserve` reads `GET /api/v1/rules` and returns one resource
5
+ * per declared group:
6
+ *
7
+ * - `drifted` when Prometheus has not loaded the group (the rule file is not
8
+ * mounted, did not parse, or the reload has not happened), or when a rule
9
+ * in it has `health: "err"`, with the rule's `lastError` as the detail;
10
+ * - `in-sync` otherwise;
11
+ * - `unknown`, for every group, when the API cannot be read.
12
+ *
13
+ * The declared groups are `groups`, plus the groups of each rule file in
14
+ * `rules` (read on each tick, so a rebuilt file is what is observed).
15
+ * Prometheus is `url`, else `$PROMETHEUS_URL`, else `http://localhost:9090`.
16
+ */
17
+ export interface RulesLoadedObserveArgs {
18
+ /** Prometheus's base URL. */
19
+ url?: string;
20
+ /** Group names that must be loaded. */
21
+ groups?: string[];
22
+ /** Rule files whose groups must be loaded, relative to the working directory. */
23
+ rules?: string | string[];
24
+ /** Request timeout, ms. Default 10000. */
25
+ timeoutMs?: number;
26
+ /** Replaces fetch. For tests. */
27
+ _fetch?: typeof fetch;
28
+ }
29
+ export interface RulesLoadedObserveResult {
30
+ resources: {
31
+ name: string;
32
+ status: "in-sync" | "drifted" | "unknown";
33
+ detail: string;
34
+ }[];
35
+ }
36
+ /** One group as `/api/v1/rules` returns it. */
37
+ export interface ApiRuleGroup {
38
+ name: string;
39
+ file?: string;
40
+ rules: Array<{
41
+ name: string;
42
+ type?: string;
43
+ query?: string;
44
+ health?: string;
45
+ lastError?: string;
46
+ state?: string;
47
+ }>;
48
+ }
49
+ export declare function prometheusUrl(url?: string): string;
50
+ /** The group names in a rule file's text. */
51
+ export declare function ruleFileGroups(text: string): string[];
52
+ /** The declared groups, in order, without repeats. */
53
+ export declare function declaredGroups(args: Pick<RulesLoadedObserveArgs, "groups" | "rules">, cwd?: string): string[];
54
+ /** `GET /api/v1/rules`'s groups. Throws on anything but a successful answer. */
55
+ export declare function fetchRuleGroups(f: typeof fetch, url: string, timeoutMs?: number): Promise<ApiRuleGroup[]>;
56
+ /** The verdict for one declared group against the loaded groups. */
57
+ export declare function groupVerdict(name: string, loaded: ApiRuleGroup[]): RulesLoadedObserveResult["resources"][number];
58
+ /** Observe the declared rule groups: one resource per group. */
59
+ export declare function rulesLoadedObserve(args: RulesLoadedObserveArgs): Promise<RulesLoadedObserveResult>;
60
+ //# sourceMappingURL=rules-loaded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules-loaded.d.ts","sourceRoot":"","sources":["../../../src/op/activities/rules-loaded.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,WAAW,sBAAsB;IACrC,6BAA6B;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,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wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAYxG"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Alertmanager silences as Op steps (#3369): silence the alerts a change is
3
+ * expected to set off, and expire the silence when the change is done or
4
+ * has failed.
5
+ *
6
+ * `alertmanagerSilence` creates a silence through `POST /api/v2/silences`
7
+ * and records its id in a file under the working directory
8
+ * (`.chant/alertmanager-silences/<record>.json`). Step-output references are
9
+ * not available in an Op's `onFailure` phases, so the record is how a final
10
+ * phase and an `onFailure` phase alike find the silence:
11
+ * `alertmanagerUnsilence({ record })` expires every silence the record
12
+ * holds through `DELETE /api/v2/silence/{id}`, and drops them from it. An
13
+ * already-expired or unknown silence counts as expired, so the step can
14
+ * run in both places.
15
+ *
16
+ * The Alertmanager is `url`, else `$ALERTMANAGER_URL`, else
17
+ * `http://localhost:9093`.
18
+ */
19
+ export interface AlertmanagerSilenceArgs {
20
+ /** The Alertmanager's base URL. */
21
+ url?: string;
22
+ /**
23
+ * The alerts to silence: matcher strings (`alertname="X"`,
24
+ * `severity=~"page|ticket"`, or `{a="1", b="2"}`), or a label set matched
25
+ * by equality.
26
+ */
27
+ matchers: string[] | Record<string, string>;
28
+ /** How long the silence lasts, e.g. `30m`. Expiring it earlier is `alertmanagerUnsilence`'s job. */
29
+ duration: string;
30
+ comment?: string;
31
+ /** Default `chant`, with the Op's name when run in one. */
32
+ createdBy?: string;
33
+ /** The record the id is kept in. Default `silence`. */
34
+ record?: string;
35
+ /** Where records live, relative to the working directory. Default `.chant/alertmanager-silences`. */
36
+ recordDir?: string;
37
+ /** Replaces fetch. For tests. */
38
+ _fetch?: typeof fetch;
39
+ /** Replaces the clock. For tests. */
40
+ _now?: () => Date;
41
+ }
42
+ export interface AlertmanagerSilenceResult {
43
+ silenceId: string;
44
+ url: string;
45
+ startsAt: string;
46
+ endsAt: string;
47
+ /** The record file the id was written to. */
48
+ record: string;
49
+ }
50
+ export interface AlertmanagerUnsilenceArgs {
51
+ url?: string;
52
+ /** Expire this silence only, in place of the record's. */
53
+ silenceId?: string;
54
+ /** The record to expire. Default `silence`. */
55
+ record?: string;
56
+ recordDir?: string;
57
+ _fetch?: typeof fetch;
58
+ }
59
+ export interface AlertmanagerUnsilenceResult {
60
+ expired: string[];
61
+ /** Silences that could not be expired, kept in the record for the next try. */
62
+ failed: {
63
+ silenceId: string;
64
+ detail: string;
65
+ }[];
66
+ }
67
+ export declare function alertmanagerUrl(url?: string): string;
68
+ /** The API matchers for `matchers`. */
69
+ export declare function apiMatchers(matchers: string[] | Record<string, string>): Array<{
70
+ name: string;
71
+ value: string;
72
+ isRegex: boolean;
73
+ isEqual: boolean;
74
+ }>;
75
+ export declare function recordPath(record?: string, recordDir?: string, cwd?: string): string;
76
+ /** Create a silence and record its id. */
77
+ export declare function alertmanagerSilence(args: AlertmanagerSilenceArgs): Promise<AlertmanagerSilenceResult>;
78
+ /** Expire the recorded silences (or `silenceId`), and drop the expired ones from the record. */
79
+ export declare function alertmanagerUnsilence(args?: AlertmanagerUnsilenceArgs): Promise<AlertmanagerUnsilenceResult>;
80
+ //# sourceMappingURL=silence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"silence.d.ts","sourceRoot":"","sources":["../../../src/op/activities/silence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,MAAM,WAAW,uBAAuB;IACtC,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,oGAAoG;IACpG,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG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