@intentius/chant-lexicon-otel 0.124.46 → 0.124.48

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 (211) hide show
  1. package/README.md +2 -2
  2. package/dist/build/capability-plugin.d.ts +10 -0
  3. package/dist/build/capability-plugin.d.ts.map +1 -0
  4. package/dist/build/capability-plugin.js +19 -0
  5. package/dist/build/ocb-build.d.ts +38 -0
  6. package/dist/build/ocb-build.d.ts.map +1 -0
  7. package/dist/build/ocb-build.js +49 -0
  8. package/dist/clickhouse-tables.d.ts +73 -0
  9. package/dist/clickhouse-tables.d.ts.map +1 -0
  10. package/dist/clickhouse-tables.js +199 -0
  11. package/dist/codegen/docs.d.ts.map +1 -1
  12. package/dist/codegen/docs.js +4 -2
  13. package/dist/codegen/generate.d.ts +29 -10
  14. package/dist/codegen/generate.d.ts.map +1 -1
  15. package/dist/codegen/generate.js +82 -17
  16. package/dist/components/common.d.ts +3 -1
  17. package/dist/components/common.d.ts.map +1 -1
  18. package/dist/components/common.js +2 -0
  19. package/dist/components/connectors.d.ts +25 -90
  20. package/dist/components/connectors.d.ts.map +1 -1
  21. package/dist/components/connectors.js +3 -0
  22. package/dist/components/exporters.d.ts +78 -34
  23. package/dist/components/exporters.d.ts.map +1 -1
  24. package/dist/components/exporters.js +26 -1
  25. package/dist/components/extensions.d.ts +16 -33
  26. package/dist/components/extensions.d.ts.map +1 -1
  27. package/dist/components/filtering.d.ts +13 -60
  28. package/dist/components/filtering.d.ts.map +1 -1
  29. package/dist/components/k8s-receivers.d.ts +5 -53
  30. package/dist/components/k8s-receivers.d.ts.map +1 -1
  31. package/dist/components/overlay.d.ts +25 -0
  32. package/dist/components/overlay.d.ts.map +1 -0
  33. package/dist/components/overlay.js +19 -0
  34. package/dist/components/processors.d.ts +18 -79
  35. package/dist/components/processors.d.ts.map +1 -1
  36. package/dist/components/receivers.d.ts +17 -71
  37. package/dist/components/receivers.d.ts.map +1 -1
  38. package/dist/components/receivers.js +3 -1
  39. package/dist/components/sampling.d.ts +19 -35
  40. package/dist/components/sampling.d.ts.map +1 -1
  41. package/dist/config-hygiene.d.ts +10 -8
  42. package/dist/config-hygiene.d.ts.map +1 -1
  43. package/dist/config-hygiene.js +36 -13
  44. package/dist/coverage.d.ts +50 -0
  45. package/dist/coverage.d.ts.map +1 -0
  46. package/dist/coverage.js +92 -0
  47. package/dist/define.d.ts +8 -5
  48. package/dist/define.d.ts.map +1 -1
  49. package/dist/define.js +10 -6
  50. package/dist/distribution.d.ts +125 -0
  51. package/dist/distribution.d.ts.map +1 -0
  52. package/dist/distribution.js +227 -0
  53. package/dist/generated/index.d.ts +4234 -0
  54. package/dist/generated/index.d.ts.map +1 -0
  55. package/dist/generated/index.js +23 -0
  56. package/dist/index.d.ts +7 -1
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +9 -1
  59. package/dist/init-templates.js +2 -2
  60. package/dist/integrity.json +11 -9
  61. package/dist/lint/audit-catalog.d.ts +3 -0
  62. package/dist/lint/audit-catalog.d.ts.map +1 -1
  63. package/dist/lint/audit-catalog.js +5 -0
  64. package/dist/lint/post-synth/index.d.ts.map +1 -1
  65. package/dist/lint/post-synth/index.js +4 -0
  66. package/dist/lint/post-synth/otel-helpers.d.ts +2 -1
  67. package/dist/lint/post-synth/otel-helpers.d.ts.map +1 -1
  68. package/dist/lint/post-synth/otel-helpers.js +1 -1
  69. package/dist/lint/post-synth/otel119.d.ts +1 -1
  70. package/dist/lint/post-synth/otel119.js +1 -1
  71. package/dist/lint/post-synth/otel125.d.ts +1 -1
  72. package/dist/lint/post-synth/otel125.js +1 -1
  73. package/dist/lint/post-synth/otel126.d.ts +1 -1
  74. package/dist/lint/post-synth/otel126.js +1 -1
  75. package/dist/lint/post-synth/otel127.d.ts +1 -1
  76. package/dist/lint/post-synth/otel127.js +1 -1
  77. package/dist/lint/post-synth/otel128.d.ts +8 -0
  78. package/dist/lint/post-synth/otel128.d.ts.map +1 -0
  79. package/dist/lint/post-synth/otel128.js +17 -0
  80. package/dist/lint/post-synth/otel129.d.ts +15 -0
  81. package/dist/lint/post-synth/otel129.d.ts.map +1 -0
  82. package/dist/lint/post-synth/otel129.js +92 -0
  83. package/dist/lsp/completions.d.ts +10 -1
  84. package/dist/lsp/completions.d.ts.map +1 -1
  85. package/dist/lsp/completions.js +29 -1
  86. package/dist/lsp/hover.d.ts +5 -1
  87. package/dist/lsp/hover.d.ts.map +1 -1
  88. package/dist/lsp/hover.js +16 -3
  89. package/dist/lsp/properties.d.ts +34 -0
  90. package/dist/lsp/properties.d.ts.map +1 -0
  91. package/dist/lsp/properties.js +135 -0
  92. package/dist/manifest.json +1 -1
  93. package/dist/meta.json +5 -0
  94. package/dist/metric-names.d.ts +36 -8
  95. package/dist/metric-names.d.ts.map +1 -1
  96. package/dist/metric-names.js +42 -9
  97. package/dist/model.d.ts +1 -1
  98. package/dist/model.js +1 -1
  99. package/dist/okf/index.md +3 -0
  100. package/dist/okf/rules/OTEL128.md +11 -0
  101. package/dist/okf/rules/OTEL129.md +11 -0
  102. package/dist/okf/types/ClickHouseExporter.md +9 -0
  103. package/dist/op/activities/collector-audit.d.ts +18 -6
  104. package/dist/op/activities/collector-audit.d.ts.map +1 -1
  105. package/dist/op/activities/collector-audit.js +37 -21
  106. package/dist/plugin.d.ts.map +1 -1
  107. package/dist/plugin.js +51 -8
  108. package/dist/rules/otel-helpers.ts +1 -1
  109. package/dist/rules/otel119.ts +1 -1
  110. package/dist/rules/otel125.ts +1 -1
  111. package/dist/rules/otel126.ts +1 -1
  112. package/dist/rules/otel127.ts +1 -1
  113. package/dist/rules/otel128.ts +22 -0
  114. package/dist/rules/otel129.ts +99 -0
  115. package/dist/serializer.d.ts +3 -0
  116. package/dist/serializer.d.ts.map +1 -1
  117. package/dist/serializer.js +12 -2
  118. package/dist/spec/builtins.d.ts +17 -0
  119. package/dist/spec/builtins.d.ts.map +1 -0
  120. package/dist/spec/builtins.js +45 -0
  121. package/dist/spec/fetch.d.ts +120 -0
  122. package/dist/spec/fetch.d.ts.map +1 -0
  123. package/dist/spec/fetch.js +282 -0
  124. package/dist/spec/parse.d.ts +77 -0
  125. package/dist/spec/parse.d.ts.map +1 -0
  126. package/dist/spec/parse.js +337 -0
  127. package/dist/spec/pin.d.ts +82 -0
  128. package/dist/spec/pin.d.ts.map +1 -0
  129. package/dist/spec/pin.js +126 -0
  130. package/dist/spec/snapshot-cli.d.ts +13 -0
  131. package/dist/spec/snapshot-cli.d.ts.map +1 -0
  132. package/dist/spec/snapshot-cli.js +31 -0
  133. package/dist/spec/snapshot.d.ts +9 -0
  134. package/dist/spec/snapshot.d.ts.map +1 -0
  135. package/dist/spec/snapshot.js +14 -0
  136. package/dist/types/index.d.ts +3 -2
  137. package/dist/validate-config.d.ts +1 -1
  138. package/dist/validate-config.d.ts.map +1 -1
  139. package/dist/validate.d.ts.map +1 -1
  140. package/dist/validate.js +1 -0
  141. package/dist/workspace-links.d.ts +25 -0
  142. package/dist/workspace-links.d.ts.map +1 -0
  143. package/dist/workspace-links.js +49 -0
  144. package/package.json +3 -2
  145. package/src/build/capability-plugin.ts +30 -0
  146. package/src/build/ocb-build.ts +73 -0
  147. package/src/clickhouse-exporter.e2e.test.ts +208 -0
  148. package/src/clickhouse-tables.test.ts +216 -0
  149. package/src/clickhouse-tables.ts +223 -0
  150. package/src/codegen/docs.ts +4 -2
  151. package/src/codegen/generate.ts +95 -19
  152. package/src/components/common.ts +4 -2
  153. package/src/components/connectors.ts +30 -77
  154. package/src/components/exporters.ts +128 -61
  155. package/src/components/extensions.ts +22 -36
  156. package/src/components/filtering.ts +17 -58
  157. package/src/components/k8s-receivers.test.ts +1 -1
  158. package/src/components/k8s-receivers.ts +3 -45
  159. package/src/components/overlay.ts +24 -0
  160. package/src/components/processors.ts +18 -63
  161. package/src/components/receivers.ts +20 -60
  162. package/src/components/sampling.ts +24 -37
  163. package/src/config-hygiene.ts +36 -13
  164. package/src/coverage.test.ts +37 -0
  165. package/src/coverage.ts +121 -0
  166. package/src/define.test.ts +2 -0
  167. package/src/define.ts +10 -6
  168. package/src/distribution.test.ts +250 -0
  169. package/src/distribution.ts +305 -0
  170. package/src/generated/index.ts +4576 -0
  171. package/src/generated/lexicon-otel.json +5 -0
  172. package/src/generated/properties.json +1 -0
  173. package/src/import/roundtrip.test.ts +16 -0
  174. package/src/import/testdata/clickhouse.yaml +37 -0
  175. package/src/import/testdata/fixtures.ts +17 -2
  176. package/src/import/testdata/upstream/clickhouse-exporter.yaml +60 -0
  177. package/src/index.ts +69 -0
  178. package/src/init-templates.ts +2 -2
  179. package/src/lint/audit-catalog.ts +15 -0
  180. package/src/lint/post-synth/index.ts +4 -0
  181. package/src/lint/post-synth/otel-helpers.ts +1 -1
  182. package/src/lint/post-synth/otel119.ts +1 -1
  183. package/src/lint/post-synth/otel125.ts +1 -1
  184. package/src/lint/post-synth/otel126.ts +1 -1
  185. package/src/lint/post-synth/otel127.ts +1 -1
  186. package/src/lint/post-synth/otel128.ts +22 -0
  187. package/src/lint/post-synth/otel129.ts +99 -0
  188. package/src/lsp/completions.ts +30 -1
  189. package/src/lsp/hover.ts +14 -3
  190. package/src/lsp/properties.test.ts +72 -0
  191. package/src/lsp/properties.ts +141 -0
  192. package/src/metric-names.test.ts +11 -0
  193. package/src/metric-names.ts +64 -16
  194. package/src/model.ts +1 -1
  195. package/src/op/activities/collector-audit.test.ts +29 -22
  196. package/src/op/activities/collector-audit.ts +38 -18
  197. package/src/plugin.test.ts +2 -0
  198. package/src/plugin.ts +57 -6
  199. package/src/serializer.ts +11 -2
  200. package/src/spec/builtins.ts +56 -0
  201. package/src/spec/fetch.ts +332 -0
  202. package/src/spec/otel-schemas.snapshot.json +13932 -0
  203. package/src/spec/parse.ts +364 -0
  204. package/src/spec/pin.ts +155 -0
  205. package/src/spec/snapshot-cli.ts +32 -0
  206. package/src/spec/snapshot.ts +19 -0
  207. package/src/spec/spec.test.ts +144 -0
  208. package/src/validate-config.ts +4 -3
  209. package/src/validate.ts +1 -0
  210. package/src/workspace-links.e2e.test.ts +91 -0
  211. package/src/workspace-links.ts +50 -0
package/dist/model.d.ts CHANGED
@@ -84,7 +84,7 @@ export interface ComponentTypeAlias {
84
84
  }
85
85
  /**
86
86
  * The renamed built-ins. chant emits `builtin`, which the pinned collector
87
- * (`COLLECTOR_PIN`, v0.130.0) knows and newer ones still accept. A config
87
+ * (`COLLECTOR_PIN`) still accepts as each component's deprecated type. A config
88
88
  * written for a newer collector may use `type`, so code that reads a config
89
89
  * (the importer, the checks, the k8s composites) accepts both.
90
90
  */
package/dist/model.js CHANGED
@@ -60,7 +60,7 @@ export function looksLikeCollectorConfig(value) {
60
60
  }
61
61
  /**
62
62
  * The renamed built-ins. chant emits `builtin`, which the pinned collector
63
- * (`COLLECTOR_PIN`, v0.130.0) knows and newer ones still accept. A config
63
+ * (`COLLECTOR_PIN`) still accepts as each component's deprecated type. A config
64
64
  * written for a newer collector may use `type`, so code that reads a config
65
65
  * (the importer, the checks, the k8s composites) accepts both.
66
66
  */
package/dist/okf/index.md CHANGED
@@ -6,6 +6,7 @@ okf_version: '0.2'
6
6
 
7
7
  * [AttributesProcessor](/types/AttributesProcessor.md) - OTel::Processor::attributes
8
8
  * [BatchProcessor](/types/BatchProcessor.md) - OTel::Processor::batch
9
+ * [ClickHouseExporter](/types/ClickHouseExporter.md) - OTel::Exporter::clickhouse
9
10
  * [CountConnector](/types/CountConnector.md) - OTel::Connector::count
10
11
  * [DebugExporter](/types/DebugExporter.md) - OTel::Exporter::debug
11
12
  * [DeltaToCumulativeProcessor](/types/DeltaToCumulativeProcessor.md) - OTel::Processor::deltatocumulative
@@ -71,3 +72,5 @@ okf_version: '0.2'
71
72
  * [OTEL125](/rules/OTEL125.md) - A pipeline sends to a remote otlp or otlphttp exporter without batching
72
73
  * [OTEL126](/rules/OTEL126.md) - k8sattributes extracts a metadata field it does not support
73
74
  * [OTEL127](/rules/OTEL127.md) - resourcedetection lists a detector that does not exist
75
+ * [OTEL128](/rules/OTEL128.md) - The collector config uses a component the declared Distribution does not build
76
+ * [OTEL129](/rules/OTEL129.md) - A clickhouse exporter writes a table the sql build in the same root does not declare
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: OTEL128
4
+ description: The collector config uses a component the declared Distribution does not build
5
+ id: OTEL128
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: otel
9
+ docs: https://intentius.io/chant/lexicons/otel/rules/
10
+ ---
11
+ The collector config uses a component the declared Distribution does not build
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: OTEL129
4
+ description: A clickhouse exporter writes a table the sql build in the same root does not declare
5
+ id: OTEL129
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: otel
9
+ docs: https://intentius.io/chant/lexicons/otel/rules/
10
+ ---
11
+ A clickhouse exporter writes a table the sql build in the same root does not declare
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: ClickHouseExporter
4
+ description: otel resource type OTel::Exporter::clickhouse
5
+ name: ClickHouseExporter
6
+ lexicon: otel
7
+ resource_type: OTel::Exporter::clickhouse
8
+ ---
9
+ `OTel::Exporter::clickhouse`, a resource type of the otel lexicon.
@@ -16,10 +16,12 @@
16
16
  *
17
17
  * `mode` says what to do with the findings: `report` returns them;
18
18
  * `issue` keeps one open issue current; `pull-request` also bumps the pins
19
- * in the lexicon's `src/define.ts` on a proposal branch and opens (or
19
+ * (`OTELCOL_CONTRIB_VERSION` in `src/spec/pin.ts` for `COLLECTOR_PIN`, and
20
+ * `GENAI_SEMCONV_PIN` in `src/define.ts`) on a proposal branch and opens (or
20
21
  * edits) a pull request with the findings as its body. Only the pin values
21
- * change: the config types written against the old pin are the reviewer's
22
- * to move, which the body says.
22
+ * change: refreshing the schema snapshot the config types are generated from
23
+ * (`just snapshot`, #3361) is the reviewer's, which the body says, and
24
+ * generation refuses until it is done.
23
25
  */
24
26
  import type { ComponentKind } from "../../model.js";
25
27
  import { type CommandRunner } from "./github.js";
@@ -84,11 +86,21 @@ export type Stability = Record<string, string>;
84
86
  export declare function parseStability(text: string): Stability | undefined;
85
87
  /** Findings for one component, from its stability at the pin and at the newest release. */
86
88
  export declare function stabilityFindings(c: BuiltinComponent, atPin: Stability | undefined, atLatest: Stability, pin: string, latest: string): CollectorAuditFinding[];
87
- /** `src/define.ts` with `COLLECTOR_PIN` and `GENAI_SEMCONV_PIN` moved to the given versions. */
88
- export declare function bumpPins(text: string, to: {
89
+ /**
90
+ * The pin files with `COLLECTOR_PIN` and `GENAI_SEMCONV_PIN` moved to the
91
+ * given versions: `COLLECTOR_PIN` follows `OTELCOL_CONTRIB_VERSION` in
92
+ * `src/spec/pin.ts`, and `GENAI_SEMCONV_PIN` is in `src/define.ts`.
93
+ */
94
+ export declare function bumpPins(texts: {
95
+ define: string;
96
+ pin: string;
97
+ }, to: {
89
98
  collector?: string;
90
99
  genai?: string;
91
- }): string;
100
+ }): {
101
+ define: string;
102
+ pin: string;
103
+ };
92
104
  export declare function renderCollectorAuditSummary(r: Omit<CollectorAuditResult, "summary" | "mode">): string;
93
105
  /** Audit the otel lexicon's pins and its built-in components against upstream releases. */
94
106
  export declare function collectorAudit(args?: CollectorAuditArgs): Promise<CollectorAuditResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"collector-audit.d.ts","sourceRoot":"","sources":["../../../src/op/activities/collector-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAgF,KAAK,aAAa,EAAgB,MAAM,UAAU,CAAC;AAE1I,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,CAAC;AAErE,eAAO,MAAM,YAAY,mDAAmD,CAAC;AAC7E,eAAO,MAAM,SAAS,2CAA2C,CAAC;AAClE,eAAO,MAAM,YAAY,wCAAwC,CAAC;AAElE,MAAM,WAAW,kBAAkB;I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AI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,iBAAiB,IAAI,gBAAgB,EAAE,CAatD;AAED,4GAA4G;AAC5G,wBAAgB,YAAY,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAExD;AAED,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAelE;AAsBD,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAc9J;AAMD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACtC,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAajC;AAED,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG,MAAM,CAarG;AAED,2FAA2F;AAC3F,wBAAsB,cAAc,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA6EjG"}
@@ -16,10 +16,12 @@
16
16
  *
17
17
  * `mode` says what to do with the findings: `report` returns them;
18
18
  * `issue` keeps one open issue current; `pull-request` also bumps the pins
19
- * in the lexicon's `src/define.ts` on a proposal branch and opens (or
19
+ * (`OTELCOL_CONTRIB_VERSION` in `src/spec/pin.ts` for `COLLECTOR_PIN`, and
20
+ * `GENAI_SEMCONV_PIN` in `src/define.ts`) on a proposal branch and opens (or
20
21
  * edits) a pull request with the findings as its body. Only the pin values
21
- * change: the config types written against the old pin are the reviewer's
22
- * to move, which the body says.
22
+ * change: refreshing the schema snapshot the config types are generated from
23
+ * (`just snapshot`, #3361) is the reviewer's, which the body says, and
24
+ * generation refuses until it is done.
23
25
  */
24
26
  import { mkdtempSync, readFileSync } from "node:fs";
25
27
  import { tmpdir } from "node:os";
@@ -113,20 +115,26 @@ export function stabilityFindings(c, atPin, atLatest, pin, latest) {
113
115
  function behindCount(releases, pin) {
114
116
  return releases.filter((r) => compareSemver(r.tag, pin) > 0).length;
115
117
  }
116
- /** `src/define.ts` with `COLLECTOR_PIN` and `GENAI_SEMCONV_PIN` moved to the given versions. */
117
- export function bumpPins(text, to) {
118
- let out = text;
119
- const bump = (name, version) => {
120
- const re = new RegExp(`(export const ${name}: SchemaPin = Object\\.freeze\\(\\{[^}]*?version:\\s*")([^"]+)(")`);
121
- if (!re.test(out))
122
- throw new Error(`define.ts has no ${name} with a version to bump`);
123
- out = out.replace(re, `$1${version}$3`);
124
- };
125
- if (to.collector)
126
- bump("COLLECTOR_PIN", to.collector);
127
- if (to.genai)
128
- bump("GENAI_SEMCONV_PIN", to.genai);
129
- return out;
118
+ /**
119
+ * The pin files with `COLLECTOR_PIN` and `GENAI_SEMCONV_PIN` moved to the
120
+ * given versions: `COLLECTOR_PIN` follows `OTELCOL_CONTRIB_VERSION` in
121
+ * `src/spec/pin.ts`, and `GENAI_SEMCONV_PIN` is in `src/define.ts`.
122
+ */
123
+ export function bumpPins(texts, to) {
124
+ let { define, pin } = texts;
125
+ if (to.collector) {
126
+ const re = /(export const OTELCOL_CONTRIB_VERSION = ")([^"]+)(")/;
127
+ if (!re.test(pin))
128
+ throw new Error("spec/pin.ts has no OTELCOL_CONTRIB_VERSION (COLLECTOR_PIN) to bump");
129
+ pin = pin.replace(re, `$1${to.collector}$3`);
130
+ }
131
+ if (to.genai) {
132
+ const re = /(export const GENAI_SEMCONV_PIN: SchemaPin = Object\.freeze\(\{[^}]*?version:\s*")([^"]+)(")/;
133
+ if (!re.test(define))
134
+ throw new Error("define.ts has no GENAI_SEMCONV_PIN with a version to bump");
135
+ define = define.replace(re, `$1${to.genai}$3`);
136
+ }
137
+ return { define, pin };
130
138
  }
131
139
  export function renderCollectorAuditSummary(r) {
132
140
  let out = "## Collector audit\n\n";
@@ -197,15 +205,23 @@ export async function collectorAudit(args = {}) {
197
205
  const lexiconDir = resolve(args.lexiconDir ?? join(cwd, "lexicons", "otel"));
198
206
  const root = (await run("git", ["rev-parse", "--show-toplevel"], lexiconDir)).trim();
199
207
  const definePath = join(lexiconDir, "src", "define.ts");
200
- const content = bumpPins(readFileSync(definePath, "utf8"), to);
208
+ const pinPath = join(lexiconDir, "src", "spec", "pin.ts");
209
+ const bumped = bumpPins({ define: readFileSync(definePath, "utf8"), pin: readFileSync(pinPath, "utf8") }, to);
210
+ const files = [
211
+ ...(to.collector ? [{ path: relative(root, pinPath), content: bumped.pin }] : []),
212
+ ...(to.genai ? [{ path: relative(root, definePath), content: bumped.define }] : []),
213
+ ];
201
214
  const moved = [to.collector ? `COLLECTOR_PIN to ${to.collector}` : "", to.genai ? `GENAI_SEMCONV_PIN to ${to.genai}` : ""].filter(Boolean).join(" and ");
202
215
  result.prUrl = await proposePullRequest(run, {
203
216
  root,
204
217
  branch: args.branch ?? "chant/otel-pins",
205
218
  title: `chore(otel): move ${moved}`,
206
- body: `${summary}\n\nThis moves the pin values only. The config types, defaults and checks written against ${collector.pin} ` +
207
- "still need reading against the release notes before this merges.\n",
208
- files: [{ path: relative(root, definePath), content }],
219
+ body: `${summary}\n\nThis moves the pin values only. ` +
220
+ (to.collector
221
+ ? "Run `just snapshot` in lexicons/otel, paste the printed OTEL_SPEC_PIN and regenerate: the config types are generated from the snapshot, and generation refuses a snapshot taken at another version. "
222
+ : "") +
223
+ `The defaults and checks written against ${collector.pin} still need reading against the release notes before this merges.\n`,
224
+ files,
209
225
  commitMessage: `chore(otel): move ${moved}`,
210
226
  worktreeDir: join(mkdtempSync(join(tmpdir(), "chant-otel-pins-")), "wt"),
211
227
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AA+B9D;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,aA4GxB,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AA4C9D;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,aAkJxB,CAAC"}
package/dist/plugin.js CHANGED
@@ -15,6 +15,16 @@ import { compositeCatalog } from "./composites/catalog.js";
15
15
  import { DEFAULT_TEMPLATE, GENAI_TEMPLATE, K8S_AGENT_TEMPLATE } from "./init-templates.js";
16
16
  import { COLLECTOR_PIN } from "./define.js";
17
17
  import { collectorTopologyOf } from "./topology.js";
18
+ import { otelWorkspaceLinks } from "./workspace-links.js";
19
+ /** opentelemetry-collector-releases also tags its tools (`cmd/builder/v0.163.2`); only the plain release tags are distributions. */
20
+ function releaseTag(tag) {
21
+ return /^v\d+\.\d+\.\d+$/.test(tag) ? tag : null;
22
+ }
23
+ const SNAPSHOT_MOVES = "The schema snapshot and its digest move with the version: set the version in src/spec/pin.ts, run `just snapshot` " +
24
+ "(lexicons/otel) on a networked machine, paste the printed OTEL_SPEC_PIN into src/spec/pin.ts, run `npm run generate`, " +
25
+ "and read the diffs of src/spec/otel-schemas.snapshot.json and the generated types. Moving otelcol-contrib also moves " +
26
+ "COLLECTOR_PIN and COLLECTOR_IMAGE, the default image of the k8s, docker and fly collector composites, so it is a " +
27
+ "level-0 change that needs an entry on the exceptions list (#2525).";
18
28
  const catalogResource = {
19
29
  uri: "otel:resource-catalog",
20
30
  name: "OpenTelemetry Collector component catalog",
@@ -45,16 +55,44 @@ export const otelPlugin = {
45
55
  const { printValidationResult } = await import("@intentius/chant/codegen/validate");
46
56
  printValidationResult(await validate());
47
57
  },
48
- async coverage(_options) {
49
- const components = BUILTIN_CATALOG.filter((c) => c.type !== undefined);
50
- const byKind = new Map();
51
- for (const c of components)
52
- byKind.set(c.kind, [...(byKind.get(c.kind) ?? []), c.type]);
53
- console.error(`otel: ${components.length} built-in components, typed against ${COLLECTOR_PIN.source} ${COLLECTOR_PIN.version}`);
54
- for (const [kind, types] of byKind)
55
- console.error(` ${kind}s: ${types.join(", ")}`);
58
+ async coverage(options) {
59
+ const { coverageReport, formatCoverage } = await import("./coverage.js");
60
+ const report = coverageReport();
61
+ console.error(formatCoverage(report));
62
+ if (options?.verbose) {
63
+ for (const d of report.distributions) {
64
+ console.error(` ${d.distribution}, reached through defineComponent: ${[...d.schemaNotBuiltin, ...d.noSchemaNotBuiltin].join(", ")}`);
65
+ }
66
+ }
56
67
  console.error(" anything else: defineComponent (see docs: custom components)");
57
68
  },
69
+ // #3361: coverage against the otelcol-contrib manifest, offline from the
70
+ // committed schema snapshot.
71
+ async coverageReport() {
72
+ const { coverageReport } = await import("./coverage.js");
73
+ return coverageReport();
74
+ },
75
+ // The distribution manifests the generated config types are scoped by
76
+ // (#3361): otelcol-contrib, which COLLECTOR_PIN and COLLECTOR_IMAGE follow,
77
+ // and otelcol-k8s for the coverage report.
78
+ upstreamPin: {
79
+ label: "otelcol-contrib",
80
+ file: "src/spec/pin.ts",
81
+ pattern: /export const OTELCOL_CONTRIB_VERSION = "([^"]+)"/,
82
+ replace: (v, line) => line.replace(/= "[^"]+"/, `= "${v}"`),
83
+ alsoMoves: SNAPSHOT_MOVES,
84
+ upstream: { owner: "open-telemetry", repo: "opentelemetry-collector-releases", kind: "releases", tagVersion: releaseTag },
85
+ },
86
+ upstreamPins: [
87
+ {
88
+ label: "otelcol-k8s",
89
+ file: "src/spec/pin.ts",
90
+ pattern: /export const OTELCOL_K8S_VERSION = "([^"]+)"/,
91
+ replace: (v, line) => line.replace(/= "[^"]+"/, `= "${v}"`),
92
+ alsoMoves: SNAPSHOT_MOVES,
93
+ upstream: { owner: "open-telemetry", repo: "opentelemetry-collector-releases", kind: "releases", tagVersion: releaseTag },
94
+ },
95
+ ],
58
96
  async package(options) {
59
97
  const { packageLexicon } = await import("./codegen/package.js");
60
98
  const { writeBundleSpec } = await import("@intentius/chant/codegen/package");
@@ -77,6 +115,11 @@ export const otelPlugin = {
77
115
  return undefined;
78
116
  return { collector: topology };
79
117
  },
118
+ // The tables and columns a clickhouse exporter writes, as links to the sql
119
+ // member that declares them (#4397), for `chant workspace check`.
120
+ workspaceLinks(entities) {
121
+ return otelWorkspaceLinks(entities);
122
+ },
80
123
  postSynthChecks() {
81
124
  return postSynthChecks;
82
125
  },
@@ -68,7 +68,7 @@ export function collectorConfigs(ctx: PostSynthContext): FoundCollectorConfig[]
68
68
  return out;
69
69
  }
70
70
 
71
- function toDiagnostic(issue: CollectorIssue, found?: Omit<FoundCollectorConfig, "config">): PostSynthDiagnostic {
71
+ export function toDiagnostic(issue: CollectorIssue, found?: Omit<FoundCollectorConfig, "config">): PostSynthDiagnostic {
72
72
  const where = found?.configMap
73
73
  ? describeConfigMapConfig(found.configMap)
74
74
  : found?.operator
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OTEL119: A collector config sets a field deprecated at or before the pinned release
3
3
  *
4
- * `invert_match: true` in a `tail_sampling` policy (inverted decisions are deprecated in collector-contrib v0.126.0 for a `drop` policy), `service.telemetry.metrics.address` (deprecated in collector v0.111.0 for `readers`), and `dimensions_cache_size` on `spanmetrics` (deprecated in collector-contrib v0.125.0 for `aggregation_cardinality_limit`). The collector still reads each at v0.130.0, and a later release drops it.
4
+ * `invert_match: true` in a `tail_sampling` policy (inverted decisions are deprecated in collector-contrib v0.126.0 for a `drop` policy, and v0.155.0 removed the gate that kept them), `service.telemetry.metrics.address` (deprecated in collector v0.111.0 for `readers`), and `dimensions_cache_size` on `spanmetrics` (deprecated in collector-contrib v0.125.0 for `aggregation_cardinality_limit`). The collector still parses each at v0.162.0, and a later release drops it.
5
5
  */
6
6
 
7
7
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OTEL125: A pipeline sends to a remote otlp or otlphttp exporter without batching
3
3
  *
4
- * No `batch` processor in the pipeline, and the `otlp` or `otlphttp` exporter (non-loopback endpoint) sets no `sending_queue.batch`. At v0.130.0 neither exporter batches by default, so each small request goes out on its own. Other exporters may batch themselves and are not checked.
4
+ * No `batch` processor in the pipeline, and the `otlp` or `otlphttp` exporter (non-loopback endpoint) sets no `sending_queue.batch`. At v0.162.0 neither exporter batches by default, so each small request goes out on its own. Other exporters may batch themselves and are not checked.
5
5
  */
6
6
 
7
7
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OTEL126: k8sattributes extracts a metadata field it does not support
3
3
  *
4
- * Each name in a `k8sattributes` processor's `extract.metadata` must be one `Config.Validate` accepts at collector-contrib v0.130.0 (`K8S_ATTRIBUTES_METADATA`); the collector refuses any other.
4
+ * Each name in a `k8sattributes` processor's `extract.metadata` must be one `Config.Validate` accepts at collector-contrib v0.162.0 (`K8S_ATTRIBUTES_METADATA`); the collector refuses any other.
5
5
  */
6
6
 
7
7
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * OTEL127: resourcedetection lists a detector that does not exist
3
3
  *
4
- * Each name in a started `resourcedetection` processor's `detectors` must be one the processor registers at collector-contrib v0.130.0 (`RESOURCE_DETECTORS`); any other fails the processor's build and the collector exits.
4
+ * Each name in a started `resourcedetection` processor's `detectors` must be one the processor registers at collector-contrib v0.162.0 (`RESOURCE_DETECTORS`); any other fails the processor's build and the collector exits.
5
5
  */
6
6
 
7
7
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * OTEL128: The collector config uses a component the declared Distribution does not build
3
+ *
4
+ * When a project declares a `Distribution` (an ocb builder manifest), every component a collector config declares must be one the distribution builds; a collector built from it fails at start with "unknown type" otherwise. A project without a `Distribution` is not checked.
5
+ */
6
+
7
+ import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
8
+ import { distributionIssues, isDistributionEntity } from "../../distribution";
9
+ import { collectorConfigs, toDiagnostic } from "./otel-helpers";
10
+
11
+ export const otel128: PostSynthCheck = {
12
+ id: "OTEL128",
13
+ description: "The collector config uses a component the declared Distribution does not build",
14
+
15
+ check(ctx: PostSynthContext): PostSynthDiagnostic[] {
16
+ const dist = [...(ctx.entities?.values() ?? [])].find(isDistributionEntity);
17
+ if (!dist) return [];
18
+ return collectorConfigs(ctx).flatMap(({ config, ...found }) =>
19
+ distributionIssues(config, dist).map((i) => toDiagnostic(i, found)),
20
+ );
21
+ },
22
+ };
@@ -0,0 +1,99 @@
1
+ /**
2
+ * OTEL129: A clickhouse exporter writes a table the sql build in the same root does not declare
3
+ *
4
+ * When the build root also declares ClickHouse tables with the sql lexicon, every table a `clickhouse` exporter writes (for the signals whose pipelines use it) must be one of them, in the database the exporter writes to, with every column the exporter's insert statement names. A renamed or dropped table fails here instead of at the exporter's first insert. When `create_schema` is true (the exporter's default) for tables the build declares, it warns: the exporter would run its own `CREATE TABLE IF NOT EXISTS` beside the sql lexicon's plan. A build root with no sql ClickHouse tables is not checked. Sees one build root at a time (#1939); across workspace members the otel lexicon's workspace links check the same tables (#3931).
5
+ */
6
+
7
+ import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
8
+ import type { Declarable } from "@intentius/chant/declarable";
9
+ import { clickhouseExportersOf } from "../../clickhouse-tables";
10
+ import { collectorConfigs } from "./otel-helpers";
11
+
12
+ /** The sql lexicon's ClickHouse table entity type, matched by name so otel needs no dependency on the sql lexicon. */
13
+ const CLICKHOUSE_TABLE = "ClickHouse::Table";
14
+
15
+ interface DeclaredTable {
16
+ columns: Set<string>;
17
+ }
18
+
19
+ /** Every ClickHouse table the build declares, by `database.name`. */
20
+ export function declaredClickHouseTables(entities: Iterable<Declarable>): Map<string, DeclaredTable> {
21
+ const out = new Map<string, DeclaredTable>();
22
+ for (const e of entities) {
23
+ if (e.entityType !== CLICKHOUSE_TABLE) continue;
24
+ const props = (e as unknown as { props?: { name?: unknown; database?: unknown; columns?: unknown } }).props;
25
+ if (typeof props?.name !== "string") continue;
26
+ const database = typeof props.database === "string" && props.database !== "" ? props.database : "default";
27
+ const columns = new Set<string>();
28
+ for (const c of Array.isArray(props.columns) ? props.columns : []) {
29
+ const name = (c as { name?: unknown })?.name;
30
+ if (typeof name === "string") columns.add(name);
31
+ }
32
+ out.set(`${database}.${props.name}`, { columns });
33
+ }
34
+ return out;
35
+ }
36
+
37
+ /** A column the insert names is declared as itself, or as the flattened fields of a Nested column (`Events.Timestamp`). */
38
+ function hasColumn(declared: Set<string>, column: string): boolean {
39
+ if (declared.has(column)) return true;
40
+ for (const c of declared) if (c.startsWith(`${column}.`)) return true;
41
+ return false;
42
+ }
43
+
44
+ export const otel129: PostSynthCheck = {
45
+ id: "OTEL129",
46
+ description: "A clickhouse exporter writes a table the sql build in the same root does not declare",
47
+
48
+ check(ctx: PostSynthContext): PostSynthDiagnostic[] {
49
+ const declared = declaredClickHouseTables(ctx.entities?.values() ?? []);
50
+ if (declared.size === 0) return [];
51
+ const known = [...declared.keys()].sort();
52
+ const diagnostics: PostSynthDiagnostic[] = [];
53
+ for (const { config } of collectorConfigs(ctx)) {
54
+ for (const exp of clickhouseExportersOf(config)) {
55
+ const createsDeclared: string[] = [];
56
+ for (const t of exp.tables) {
57
+ const qualified = `${exp.database}.${t.name}`;
58
+ const table = declared.get(qualified);
59
+ if (!table) {
60
+ diagnostics.push({
61
+ checkId: "OTEL129",
62
+ severity: "error",
63
+ message:
64
+ `exporter ${exp.id} writes ${t.signal} to ${qualified} (${t.key}), which the sql build does not declare. ` +
65
+ `Declare it (OtelTables from @intentius/chant-lexicon-sql/clickhouse declares the exporter's tables) or point ${t.key} at a declared table. ` +
66
+ `Declared ClickHouse tables: ${known.join(", ")}`,
67
+ entity: exp.id,
68
+ lexicon: "otel",
69
+ });
70
+ continue;
71
+ }
72
+ const missing = t.columns.filter((c) => !hasColumn(table.columns, c));
73
+ if (missing.length > 0) {
74
+ diagnostics.push({
75
+ checkId: "OTEL129",
76
+ severity: "error",
77
+ message: `exporter ${exp.id} inserts ${t.signal} into ${qualified} with column${missing.length === 1 ? "" : "s"} ${missing.join(", ")}, which the declared table does not have; the insert would fail`,
78
+ entity: exp.id,
79
+ lexicon: "otel",
80
+ });
81
+ }
82
+ createsDeclared.push(qualified);
83
+ }
84
+ if (exp.createSchema && createsDeclared.length > 0) {
85
+ diagnostics.push({
86
+ checkId: "OTEL129",
87
+ severity: "warning",
88
+ message:
89
+ `exporter ${exp.id} has create_schema true (the default), so at start it runs CREATE TABLE IF NOT EXISTS for ${createsDeclared.join(", ")}, which the sql build declares. ` +
90
+ `Set create_schema: false so the sql lexicon alone manages them`,
91
+ entity: exp.id,
92
+ lexicon: "otel",
93
+ });
94
+ }
95
+ }
96
+ }
97
+ return diagnostics;
98
+ },
99
+ };
@@ -7,6 +7,9 @@
7
7
  * the order they are declared in, and each component's config keeps the key
8
8
  * order it was written in, since collector docs and diffs read that way.
9
9
  *
10
+ * A project that declares a `Distribution` also gets the ocb builder manifest,
11
+ * as `builder-config.yaml` beside the config (see `distribution.ts`).
12
+ *
10
13
  * A collector config has no metadata channel, so there is no ownership marker
11
14
  * to stamp. A custom component's schema pin is written as a `# chant:` comment
12
15
  * line above the config (see `define.ts`).
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAKhF,eAAO,MAAM,cAAc,EAAE,UAU5B,CAAC"}
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAMhF,eAAO,MAAM,cAAc,EAAE,UAe5B,CAAC"}
@@ -7,20 +7,30 @@
7
7
  * the order they are declared in, and each component's config keeps the key
8
8
  * order it was written in, since collector docs and diffs read that way.
9
9
  *
10
+ * A project that declares a `Distribution` also gets the ocb builder manifest,
11
+ * as `builder-config.yaml` beside the config (see `distribution.ts`).
12
+ *
10
13
  * A collector config has no metadata channel, so there is no ownership marker
11
14
  * to stamp. A custom component's schema pin is written as a `# chant:` comment
12
15
  * line above the config (see `define.ts`).
13
16
  */
14
17
  import { buildCollectorConfig } from "./collector.js";
15
18
  import { emitCollectorYaml } from "./yaml.js";
19
+ import { DISTRIBUTION_MANIFEST_FILE, distributionYaml, isDistributionEntity } from "./distribution.js";
16
20
  export const otelSerializer = {
17
21
  name: "otel",
18
22
  rulePrefix: "OTEL",
19
23
  serialize(entities, _outputs) {
20
24
  const built = buildCollectorConfig(entities);
21
25
  const yaml = emitCollectorYaml(built.config, { header: built.header });
22
- if (built.warnings.length === 0)
26
+ const warnings = [...built.warnings];
27
+ // A declared Distribution (#3374) adds the ocb builder manifest beside the config.
28
+ const distributions = [...entities.values()].filter(isDistributionEntity);
29
+ if (distributions.length > 1)
30
+ warnings.push("otel: more than one Distribution is declared; the first one is written");
31
+ const files = distributions.length > 0 ? { [DISTRIBUTION_MANIFEST_FILE]: distributionYaml(distributions[0]) } : undefined;
32
+ if (warnings.length === 0 && !files)
23
33
  return yaml;
24
- return { primary: yaml, warnings: built.warnings };
34
+ return { primary: yaml, ...(files ? { files } : {}), ...(warnings.length > 0 ? { warnings } : {}) };
25
35
  },
26
36
  };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The built-in components, as the schema snapshot and the generator see them:
3
+ * class name, kind and collector type. Kept apart from `../components` so the
4
+ * snapshot refresh and generation load no component code (the components
5
+ * import the types generation writes). `builtins.test.ts` holds this list to
6
+ * the exported classes.
7
+ */
8
+ import type { ComponentKind } from "../model.js";
9
+ export interface BuiltinSpec {
10
+ /** The exported class, e.g. `OtlpReceiver`. The generated config type is `<className>SchemaConfig`. */
11
+ className: string;
12
+ kind: ComponentKind;
13
+ /** The type the class writes, which may be the older name of a renamed component. */
14
+ type: string;
15
+ }
16
+ export declare const BUILTIN_SPECS: readonly BuiltinSpec[];
17
+ //# sourceMappingURL=builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/spec/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,uGAAuG;IACvG,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAqC/C,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The built-in components, as the schema snapshot and the generator see them:
3
+ * class name, kind and collector type. Kept apart from `../components` so the
4
+ * snapshot refresh and generation load no component code (the components
5
+ * import the types generation writes). `builtins.test.ts` holds this list to
6
+ * the exported classes.
7
+ */
8
+ export const BUILTIN_SPECS = [
9
+ { className: "OtlpReceiver", kind: "receiver", type: "otlp" },
10
+ { className: "PrometheusReceiver", kind: "receiver", type: "prometheus" },
11
+ { className: "HostMetricsReceiver", kind: "receiver", type: "hostmetrics" },
12
+ { className: "FileLogReceiver", kind: "receiver", type: "filelog" },
13
+ { className: "K8sClusterReceiver", kind: "receiver", type: "k8s_cluster" },
14
+ { className: "KubeletStatsReceiver", kind: "receiver", type: "kubeletstats" },
15
+ { className: "BatchProcessor", kind: "processor", type: "batch" },
16
+ { className: "MemoryLimiterProcessor", kind: "processor", type: "memory_limiter" },
17
+ { className: "ResourceProcessor", kind: "processor", type: "resource" },
18
+ { className: "AttributesProcessor", kind: "processor", type: "attributes" },
19
+ { className: "K8sAttributesProcessor", kind: "processor", type: "k8sattributes" },
20
+ { className: "ResourceDetectionProcessor", kind: "processor", type: "resourcedetection" },
21
+ { className: "DeltaToCumulativeProcessor", kind: "processor", type: "deltatocumulative" },
22
+ { className: "FilterProcessor", kind: "processor", type: "filter" },
23
+ { className: "TransformProcessor", kind: "processor", type: "transform" },
24
+ { className: "RedactionProcessor", kind: "processor", type: "redaction" },
25
+ { className: "TailSamplingProcessor", kind: "processor", type: "tail_sampling" },
26
+ { className: "ProbabilisticSamplerProcessor", kind: "processor", type: "probabilistic_sampler" },
27
+ { className: "OtlpExporter", kind: "exporter", type: "otlp" },
28
+ { className: "OtlpHttpExporter", kind: "exporter", type: "otlphttp" },
29
+ { className: "DebugExporter", kind: "exporter", type: "debug" },
30
+ { className: "PrometheusExporter", kind: "exporter", type: "prometheus" },
31
+ { className: "GoogleCloudExporter", kind: "exporter", type: "googlecloud" },
32
+ { className: "ClickHouseExporter", kind: "exporter", type: "clickhouse" },
33
+ { className: "LoadBalancingExporter", kind: "exporter", type: "loadbalancing" },
34
+ { className: "SpanMetricsConnector", kind: "connector", type: "spanmetrics" },
35
+ { className: "ServiceGraphConnector", kind: "connector", type: "servicegraph" },
36
+ { className: "RoutingConnector", kind: "connector", type: "routing" },
37
+ { className: "ForwardConnector", kind: "connector", type: "forward" },
38
+ { className: "CountConnector", kind: "connector", type: "count" },
39
+ { className: "SumConnector", kind: "connector", type: "sum" },
40
+ { className: "SignalToMetricsConnector", kind: "connector", type: "signaltometrics" },
41
+ { className: "HealthCheckExtension", kind: "extension", type: "health_check" },
42
+ { className: "PprofExtension", kind: "extension", type: "pprof" },
43
+ { className: "ZPagesExtension", kind: "extension", type: "zpages" },
44
+ { className: "K8sLeaderElectorExtension", kind: "extension", type: "k8s_leader_elector" },
45
+ ];