@intentius/chant-lexicon-otel 0.81.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.
- package/README.md +49 -0
- package/dist/catalog.d.ts +18 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/codegen/docs-cli.d.ts +3 -0
- package/dist/codegen/docs-cli.d.ts.map +1 -0
- package/dist/codegen/docs.d.ts +8 -0
- package/dist/codegen/docs.d.ts.map +1 -0
- package/dist/codegen/generate-cli.d.ts +3 -0
- package/dist/codegen/generate-cli.d.ts.map +1 -0
- package/dist/codegen/generate.d.ts +19 -0
- package/dist/codegen/generate.d.ts.map +1 -0
- package/dist/codegen/package.d.ts +7 -0
- package/dist/codegen/package.d.ts.map +1 -0
- package/dist/collector.d.ts +29 -0
- package/dist/collector.d.ts.map +1 -0
- package/dist/components/common.d.ts +144 -0
- package/dist/components/common.d.ts.map +1 -0
- package/dist/components/exporters.d.ts +86 -0
- package/dist/components/exporters.d.ts.map +1 -0
- package/dist/components/extensions.d.ts +32 -0
- package/dist/components/extensions.d.ts.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/processors.d.ts +118 -0
- package/dist/components/processors.d.ts.map +1 -0
- package/dist/components/receivers.d.ts +118 -0
- package/dist/components/receivers.d.ts.map +1 -0
- package/dist/define.d.ts +136 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/detect.d.ts +2 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/integrity.json +25 -0
- package/dist/lint/audit-catalog.d.ts +13 -0
- package/dist/lint/audit-catalog.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts +3 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -0
- package/dist/lint/post-synth/otel-helpers.d.ts +22 -0
- package/dist/lint/post-synth/otel-helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/otel101.d.ts +8 -0
- package/dist/lint/post-synth/otel101.d.ts.map +1 -0
- package/dist/lint/post-synth/otel102.d.ts +8 -0
- package/dist/lint/post-synth/otel102.d.ts.map +1 -0
- package/dist/lint/post-synth/otel103.d.ts +8 -0
- package/dist/lint/post-synth/otel103.d.ts.map +1 -0
- package/dist/lint/post-synth/otel104.d.ts +8 -0
- package/dist/lint/post-synth/otel104.d.ts.map +1 -0
- package/dist/lint/post-synth/otel105.d.ts +8 -0
- package/dist/lint/post-synth/otel105.d.ts.map +1 -0
- package/dist/lint/post-synth/otel106.d.ts +8 -0
- package/dist/lint/post-synth/otel106.d.ts.map +1 -0
- package/dist/lint/post-synth/otel107.d.ts +8 -0
- package/dist/lint/post-synth/otel107.d.ts.map +1 -0
- package/dist/lint/post-synth/otel108.d.ts +8 -0
- package/dist/lint/post-synth/otel108.d.ts.map +1 -0
- package/dist/lint/post-synth/otel109.d.ts +8 -0
- package/dist/lint/post-synth/otel109.d.ts.map +1 -0
- package/dist/lint/rules/component-id-syntax.d.ts +14 -0
- package/dist/lint/rules/component-id-syntax.d.ts.map +1 -0
- package/dist/lint/rules/index.d.ts +6 -0
- package/dist/lint/rules/index.d.ts.map +1 -0
- package/dist/lint/rules/literal-credential.d.ts +13 -0
- package/dist/lint/rules/literal-credential.d.ts.map +1 -0
- package/dist/lint/rules/otel-ast.d.ts +14 -0
- package/dist/lint/rules/otel-ast.d.ts.map +1 -0
- package/dist/lsp/completions.d.ts +4 -0
- package/dist/lsp/completions.d.ts.map +1 -0
- package/dist/lsp/hover.d.ts +4 -0
- package/dist/lsp/hover.d.ts.map +1 -0
- package/dist/manifest.json +8 -0
- package/dist/meta.json +102 -0
- package/dist/model.d.ts +53 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/okf/index.md +40 -0
- package/dist/okf/rules/OTEL001.md +15 -0
- package/dist/okf/rules/OTEL002.md +11 -0
- package/dist/okf/rules/OTEL101.md +11 -0
- package/dist/okf/rules/OTEL102.md +11 -0
- package/dist/okf/rules/OTEL103.md +11 -0
- package/dist/okf/rules/OTEL104.md +11 -0
- package/dist/okf/rules/OTEL105.md +11 -0
- package/dist/okf/rules/OTEL106.md +11 -0
- package/dist/okf/rules/OTEL107.md +11 -0
- package/dist/okf/rules/OTEL108.md +11 -0
- package/dist/okf/rules/OTEL109.md +11 -0
- package/dist/okf/types/AttributesProcessor.md +9 -0
- package/dist/okf/types/BatchProcessor.md +9 -0
- package/dist/okf/types/DebugExporter.md +9 -0
- package/dist/okf/types/FileLogReceiver.md +9 -0
- package/dist/okf/types/GoogleCloudExporter.md +9 -0
- package/dist/okf/types/HealthCheckExtension.md +9 -0
- package/dist/okf/types/HostMetricsReceiver.md +9 -0
- package/dist/okf/types/K8sAttributesProcessor.md +9 -0
- package/dist/okf/types/MemoryLimiterProcessor.md +9 -0
- package/dist/okf/types/OtlpExporter.md +9 -0
- package/dist/okf/types/OtlpHttpExporter.md +9 -0
- package/dist/okf/types/OtlpReceiver.md +9 -0
- package/dist/okf/types/Pipeline.md +13 -0
- package/dist/okf/types/PprofExtension.md +9 -0
- package/dist/okf/types/PrometheusExporter.md +9 -0
- package/dist/okf/types/PrometheusReceiver.md +9 -0
- package/dist/okf/types/ResourceDetectionProcessor.md +9 -0
- package/dist/okf/types/ResourceProcessor.md +9 -0
- package/dist/okf/types/Service.md +9 -0
- package/dist/okf/types/ZPagesExtension.md +9 -0
- package/dist/package-cli.d.ts +3 -0
- package/dist/package-cli.d.ts.map +1 -0
- package/dist/pipeline.d.ts +66 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/platform.d.ts +57 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/rules/component-id-syntax.ts +68 -0
- package/dist/rules/literal-credential.ts +62 -0
- package/dist/rules/otel-ast.ts +30 -0
- package/dist/rules/otel-helpers.ts +70 -0
- package/dist/rules/otel101.ts +17 -0
- package/dist/rules/otel102.ts +17 -0
- package/dist/rules/otel103.ts +17 -0
- package/dist/rules/otel104.ts +17 -0
- package/dist/rules/otel105.ts +17 -0
- package/dist/rules/otel106.ts +17 -0
- package/dist/rules/otel107.ts +17 -0
- package/dist/rules/otel108.ts +17 -0
- package/dist/rules/otel109.ts +17 -0
- package/dist/serializer.d.ts +16 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/skill-defs.d.ts +3 -0
- package/dist/skill-defs.d.ts.map +1 -0
- package/dist/skills/chant-otel-custom-components.md +51 -0
- package/dist/skills/chant-otel-platforms.md +34 -0
- package/dist/skills/chant-otel.md +60 -0
- package/dist/topology.d.ts +56 -0
- package/dist/topology.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/validate-cli.d.ts +3 -0
- package/dist/validate-cli.d.ts.map +1 -0
- package/dist/validate-config.d.ts +30 -0
- package/dist/validate-config.d.ts.map +1 -0
- package/dist/validate.d.ts +11 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/yaml.d.ts +27 -0
- package/dist/yaml.d.ts.map +1 -0
- package/package.json +74 -0
- package/src/catalog.ts +56 -0
- package/src/codegen/docs-cli.ts +4 -0
- package/src/codegen/docs.ts +90 -0
- package/src/codegen/generate-cli.ts +8 -0
- package/src/codegen/generate.ts +50 -0
- package/src/codegen/package.ts +41 -0
- package/src/collector.ts +147 -0
- package/src/components/common.ts +151 -0
- package/src/components/exporters.ts +141 -0
- package/src/components/extensions.ts +51 -0
- package/src/components/index.ts +5 -0
- package/src/components/processors.ts +208 -0
- package/src/components/receivers.ts +177 -0
- package/src/define.test.ts +131 -0
- package/src/define.ts +249 -0
- package/src/detect.ts +11 -0
- package/src/generated/lexicon-otel.json +102 -0
- package/src/index.ts +73 -0
- package/src/lint/audit-catalog.ts +102 -0
- package/src/lint/post-synth/index.ts +23 -0
- package/src/lint/post-synth/otel-helpers.ts +70 -0
- package/src/lint/post-synth/otel101.ts +17 -0
- package/src/lint/post-synth/otel102.ts +17 -0
- package/src/lint/post-synth/otel103.ts +17 -0
- package/src/lint/post-synth/otel104.ts +17 -0
- package/src/lint/post-synth/otel105.ts +17 -0
- package/src/lint/post-synth/otel106.ts +17 -0
- package/src/lint/post-synth/otel107.ts +17 -0
- package/src/lint/post-synth/otel108.ts +17 -0
- package/src/lint/post-synth/otel109.ts +17 -0
- package/src/lint/post-synth/post-synth.test.ts +184 -0
- package/src/lint/rules/component-id-syntax.ts +68 -0
- package/src/lint/rules/index.ts +9 -0
- package/src/lint/rules/literal-credential.ts +62 -0
- package/src/lint/rules/otel-ast.ts +30 -0
- package/src/lint/rules/rules.test.ts +70 -0
- package/src/lsp/completions.test.ts +23 -0
- package/src/lsp/completions.ts +15 -0
- package/src/lsp/hover.test.ts +20 -0
- package/src/lsp/hover.ts +30 -0
- package/src/model.ts +88 -0
- package/src/package-cli.ts +17 -0
- package/src/pipeline.ts +89 -0
- package/src/platform.test.ts +79 -0
- package/src/platform.ts +143 -0
- package/src/plugin.test.ts +55 -0
- package/src/plugin.ts +111 -0
- package/src/serializer.test.ts +187 -0
- package/src/serializer.ts +31 -0
- package/src/skill-defs.ts +36 -0
- package/src/skills/chant-otel-custom-components.md +51 -0
- package/src/skills/chant-otel-platforms.md +34 -0
- package/src/skills/chant-otel.md +60 -0
- package/src/topology.test.ts +80 -0
- package/src/topology.ts +122 -0
- package/src/validate-cli.ts +7 -0
- package/src/validate-config.ts +232 -0
- package/src/validate.ts +82 -0
- package/src/yaml.test.ts +56 -0
- package/src/yaml.ts +145 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings shared by many collector components (the collector's `config*`
|
|
3
|
+
* packages: configtls, configgrpc, confighttp, configretry, exporterhelper).
|
|
4
|
+
* Keys use the collector's own snake_case spelling, since they are emitted
|
|
5
|
+
* unchanged.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** A duration string the collector parses, e.g. `5s`, `250ms`, `1m30s`. */
|
|
9
|
+
export type Duration = string;
|
|
10
|
+
|
|
11
|
+
export interface TLSClientSettings {
|
|
12
|
+
insecure?: boolean;
|
|
13
|
+
insecure_skip_verify?: boolean;
|
|
14
|
+
ca_file?: string;
|
|
15
|
+
ca_pem?: string;
|
|
16
|
+
cert_file?: string;
|
|
17
|
+
cert_pem?: string;
|
|
18
|
+
key_file?: string;
|
|
19
|
+
key_pem?: string;
|
|
20
|
+
server_name_override?: string;
|
|
21
|
+
min_version?: string;
|
|
22
|
+
max_version?: string;
|
|
23
|
+
reload_interval?: Duration;
|
|
24
|
+
include_system_ca_certs_pool?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TLSServerSettings {
|
|
28
|
+
ca_file?: string;
|
|
29
|
+
cert_file?: string;
|
|
30
|
+
key_file?: string;
|
|
31
|
+
client_ca_file?: string;
|
|
32
|
+
client_ca_file_reload?: boolean;
|
|
33
|
+
min_version?: string;
|
|
34
|
+
max_version?: string;
|
|
35
|
+
reload_interval?: Duration;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** An `auth` block naming an authenticator extension by id. */
|
|
39
|
+
export interface AuthSettings {
|
|
40
|
+
authenticator: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface KeepaliveServerSettings {
|
|
44
|
+
server_parameters?: {
|
|
45
|
+
max_connection_idle?: Duration;
|
|
46
|
+
max_connection_age?: Duration;
|
|
47
|
+
max_connection_age_grace?: Duration;
|
|
48
|
+
time?: Duration;
|
|
49
|
+
timeout?: Duration;
|
|
50
|
+
};
|
|
51
|
+
enforcement_policy?: { min_time?: Duration; permit_without_stream?: boolean };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface GRPCServerSettings {
|
|
55
|
+
endpoint?: string;
|
|
56
|
+
transport?: "tcp" | "tcp4" | "tcp6" | "udp" | "unix";
|
|
57
|
+
tls?: TLSServerSettings;
|
|
58
|
+
max_recv_msg_size_mib?: number;
|
|
59
|
+
max_concurrent_streams?: number;
|
|
60
|
+
read_buffer_size?: number;
|
|
61
|
+
write_buffer_size?: number;
|
|
62
|
+
keepalive?: KeepaliveServerSettings;
|
|
63
|
+
auth?: AuthSettings;
|
|
64
|
+
include_metadata?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CORSSettings {
|
|
68
|
+
allowed_origins?: string[];
|
|
69
|
+
allowed_headers?: string[];
|
|
70
|
+
max_age?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface HTTPServerSettings {
|
|
74
|
+
endpoint?: string;
|
|
75
|
+
tls?: TLSServerSettings;
|
|
76
|
+
cors?: CORSSettings;
|
|
77
|
+
auth?: AuthSettings;
|
|
78
|
+
max_request_body_size?: number;
|
|
79
|
+
include_metadata?: boolean;
|
|
80
|
+
response_headers?: Record<string, string>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type Compression = "gzip" | "zstd" | "snappy" | "zlib" | "deflate" | "lz4" | "none" | "";
|
|
84
|
+
|
|
85
|
+
export interface GRPCClientSettings {
|
|
86
|
+
endpoint: string;
|
|
87
|
+
compression?: Compression;
|
|
88
|
+
tls?: TLSClientSettings;
|
|
89
|
+
headers?: Record<string, string>;
|
|
90
|
+
keepalive?: { time?: Duration; timeout?: Duration; permit_without_stream?: boolean };
|
|
91
|
+
read_buffer_size?: number;
|
|
92
|
+
write_buffer_size?: number;
|
|
93
|
+
wait_for_ready?: boolean;
|
|
94
|
+
balancer_name?: "pick_first" | "round_robin";
|
|
95
|
+
authority?: string;
|
|
96
|
+
auth?: AuthSettings;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface HTTPClientSettings {
|
|
100
|
+
endpoint?: string;
|
|
101
|
+
proxy_url?: string;
|
|
102
|
+
tls?: TLSClientSettings;
|
|
103
|
+
headers?: Record<string, string>;
|
|
104
|
+
timeout?: Duration;
|
|
105
|
+
compression?: Compression;
|
|
106
|
+
read_buffer_size?: number;
|
|
107
|
+
write_buffer_size?: number;
|
|
108
|
+
max_idle_conns?: number;
|
|
109
|
+
max_idle_conns_per_host?: number;
|
|
110
|
+
max_conns_per_host?: number;
|
|
111
|
+
idle_conn_timeout?: Duration;
|
|
112
|
+
disable_keep_alives?: boolean;
|
|
113
|
+
auth?: AuthSettings;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface RetrySettings {
|
|
117
|
+
enabled?: boolean;
|
|
118
|
+
initial_interval?: Duration;
|
|
119
|
+
randomization_factor?: number;
|
|
120
|
+
multiplier?: number;
|
|
121
|
+
max_interval?: Duration;
|
|
122
|
+
max_elapsed_time?: Duration;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface QueueSettings {
|
|
126
|
+
enabled?: boolean;
|
|
127
|
+
num_consumers?: number;
|
|
128
|
+
queue_size?: number;
|
|
129
|
+
/** The id of a storage extension, for a persistent queue. */
|
|
130
|
+
storage?: string;
|
|
131
|
+
blocking?: boolean;
|
|
132
|
+
sizer?: "requests" | "items" | "bytes";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** `exporterhelper` settings every queued exporter accepts. */
|
|
136
|
+
export interface ExporterHelperSettings {
|
|
137
|
+
timeout?: Duration;
|
|
138
|
+
retry_on_failure?: RetrySettings;
|
|
139
|
+
sending_queue?: QueueSettings;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** One action in the `attributes` and `resource` processors. */
|
|
143
|
+
export interface AttributeAction {
|
|
144
|
+
key?: string;
|
|
145
|
+
action: "insert" | "update" | "upsert" | "delete" | "hash" | "extract" | "convert";
|
|
146
|
+
value?: string | number | boolean;
|
|
147
|
+
pattern?: string;
|
|
148
|
+
from_attribute?: string;
|
|
149
|
+
from_context?: string;
|
|
150
|
+
converted_type?: "int" | "double" | "string";
|
|
151
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in exporters: otlp, otlphttp, debug, prometheus, googlecloud.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { defineBuiltin } from "../define";
|
|
6
|
+
import type { Duration, ExporterHelperSettings, GRPCClientSettings, HTTPClientSettings, TLSServerSettings } from "./common";
|
|
7
|
+
|
|
8
|
+
// ── otlp ─────────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export type OtlpExporterConfig = GRPCClientSettings & ExporterHelperSettings;
|
|
11
|
+
|
|
12
|
+
/** Sends OTLP over gRPC to another collector or a backend. */
|
|
13
|
+
export const OtlpExporter = defineBuiltin<OtlpExporterConfig, "exporter", "otlp">({
|
|
14
|
+
kind: "exporter",
|
|
15
|
+
type: "otlp",
|
|
16
|
+
description: "Sends traces, metrics and logs over OTLP gRPC",
|
|
17
|
+
validate: (c) => (c.endpoint ? [] : ["endpoint is empty"]),
|
|
18
|
+
endpoints: (c) => (c.endpoint ? [c.endpoint] : []),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// ── otlphttp ─────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export type OtlpHttpExporterConfig = HTTPClientSettings &
|
|
24
|
+
ExporterHelperSettings & {
|
|
25
|
+
traces_endpoint?: string;
|
|
26
|
+
metrics_endpoint?: string;
|
|
27
|
+
logs_endpoint?: string;
|
|
28
|
+
encoding?: "proto" | "json";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Sends OTLP over HTTP. `endpoint` gets `/v1/traces` etc. appended; the per-signal endpoints are used as given. */
|
|
32
|
+
export const OtlpHttpExporter = defineBuiltin<OtlpHttpExporterConfig, "exporter", "otlphttp">({
|
|
33
|
+
kind: "exporter",
|
|
34
|
+
type: "otlphttp",
|
|
35
|
+
description: "Sends traces, metrics and logs over OTLP HTTP",
|
|
36
|
+
validate: (c) =>
|
|
37
|
+
c.endpoint || c.traces_endpoint || c.metrics_endpoint || c.logs_endpoint
|
|
38
|
+
? []
|
|
39
|
+
: ["set endpoint, or at least one of traces_endpoint, metrics_endpoint and logs_endpoint"],
|
|
40
|
+
endpoints: (c) =>
|
|
41
|
+
[c.endpoint, c.traces_endpoint, c.metrics_endpoint, c.logs_endpoint].filter((e): e is string => typeof e === "string" && e !== ""),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// ── debug ────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export interface DebugExporterConfig {
|
|
47
|
+
verbosity?: "basic" | "normal" | "detailed";
|
|
48
|
+
sampling_initial?: number;
|
|
49
|
+
sampling_thereafter?: number;
|
|
50
|
+
use_internal_logger?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Writes telemetry to the collector's console, for debugging. */
|
|
54
|
+
export const DebugExporter = defineBuiltin<DebugExporterConfig, "exporter", "debug">({
|
|
55
|
+
kind: "exporter",
|
|
56
|
+
type: "debug",
|
|
57
|
+
description: "Writes telemetry to the collector's console, for debugging",
|
|
58
|
+
endpoints: () => ["console"],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// ── prometheus ───────────────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
export interface PrometheusExporterConfig {
|
|
64
|
+
/** The address the exporter serves `/metrics` on, e.g. `0.0.0.0:8889`. */
|
|
65
|
+
endpoint: string;
|
|
66
|
+
namespace?: string;
|
|
67
|
+
const_labels?: Record<string, string>;
|
|
68
|
+
send_timestamps?: boolean;
|
|
69
|
+
metric_expiration?: Duration;
|
|
70
|
+
enable_open_metrics?: boolean;
|
|
71
|
+
add_metric_suffixes?: boolean;
|
|
72
|
+
resource_to_telemetry_conversion?: { enabled: boolean };
|
|
73
|
+
tls?: TLSServerSettings;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Serves metrics on an endpoint Prometheus scrapes. */
|
|
77
|
+
export const PrometheusExporter = defineBuiltin<PrometheusExporterConfig, "exporter", "prometheus">({
|
|
78
|
+
kind: "exporter",
|
|
79
|
+
type: "prometheus",
|
|
80
|
+
description: "Serves metrics on an endpoint for Prometheus to scrape",
|
|
81
|
+
validate: (c) => (c.endpoint ? [] : ["endpoint is empty, so there is nothing to scrape"]),
|
|
82
|
+
endpoints: (c) => (c.endpoint ? [c.endpoint] : []),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// ── googlecloud ──────────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
export interface GoogleCloudResourceFilter {
|
|
88
|
+
prefix?: string;
|
|
89
|
+
regex?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface GoogleCloudExporterConfig extends ExporterHelperSettings {
|
|
93
|
+
/** The GCP project. Detected from credentials when omitted. */
|
|
94
|
+
project?: string;
|
|
95
|
+
user_agent?: string;
|
|
96
|
+
destination_project_quota?: boolean;
|
|
97
|
+
metric?: {
|
|
98
|
+
prefix?: string;
|
|
99
|
+
endpoint?: string;
|
|
100
|
+
use_insecure?: boolean;
|
|
101
|
+
known_domains?: string[];
|
|
102
|
+
skip_create_descriptor?: boolean;
|
|
103
|
+
instrumentation_library_labels?: boolean;
|
|
104
|
+
create_service_timeseries?: boolean;
|
|
105
|
+
create_metric_descriptor_buffer_size?: number;
|
|
106
|
+
service_resource_labels?: boolean;
|
|
107
|
+
resource_filters?: GoogleCloudResourceFilter[];
|
|
108
|
+
cumulative_normalization?: boolean;
|
|
109
|
+
sum_of_squared_deviation?: boolean;
|
|
110
|
+
};
|
|
111
|
+
trace?: {
|
|
112
|
+
endpoint?: string;
|
|
113
|
+
use_insecure?: boolean;
|
|
114
|
+
attribute_mappings?: Array<{ key: string; replacement: string }>;
|
|
115
|
+
};
|
|
116
|
+
log?: {
|
|
117
|
+
endpoint?: string;
|
|
118
|
+
use_insecure?: boolean;
|
|
119
|
+
default_log_name?: string;
|
|
120
|
+
resource_filters?: GoogleCloudResourceFilter[];
|
|
121
|
+
service_resource_labels?: boolean;
|
|
122
|
+
error_reporting_type?: boolean;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Sends traces to Cloud Trace, metrics to Cloud Monitoring and logs to Cloud
|
|
128
|
+
* Logging. With no endpoint overrides its topology endpoint is
|
|
129
|
+
* `googlecloud://projects/<project>`, naming where the data lands.
|
|
130
|
+
*/
|
|
131
|
+
export const GoogleCloudExporter = defineBuiltin<GoogleCloudExporterConfig, "exporter", "googlecloud">({
|
|
132
|
+
kind: "exporter",
|
|
133
|
+
type: "googlecloud",
|
|
134
|
+
description: "Sends traces to Cloud Trace, metrics to Cloud Monitoring and logs to Cloud Logging",
|
|
135
|
+
endpoints: (c) => {
|
|
136
|
+
const overrides = [c.trace?.endpoint, c.metric?.endpoint, c.log?.endpoint].filter(
|
|
137
|
+
(e): e is string => typeof e === "string" && e !== "",
|
|
138
|
+
);
|
|
139
|
+
return [`googlecloud://projects/${c.project ?? "(detected)"}`, ...overrides];
|
|
140
|
+
},
|
|
141
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in extensions: health_check, pprof, zpages.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { defineBuiltin } from "../define";
|
|
6
|
+
import type { TLSServerSettings } from "./common";
|
|
7
|
+
|
|
8
|
+
export interface HealthCheckExtensionConfig {
|
|
9
|
+
/** Default `localhost:13133`. */
|
|
10
|
+
endpoint?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
tls?: TLSServerSettings;
|
|
13
|
+
response_body?: { healthy?: string; unhealthy?: string };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Serves an HTTP health endpoint for liveness and readiness probes. */
|
|
17
|
+
export const HealthCheckExtension = defineBuiltin<HealthCheckExtensionConfig, "extension", "health_check">({
|
|
18
|
+
kind: "extension",
|
|
19
|
+
type: "health_check",
|
|
20
|
+
description: "Serves an HTTP health endpoint for liveness and readiness probes",
|
|
21
|
+
endpoints: (c) => [`${c.endpoint ?? "localhost:13133"}${c.path ?? "/"}`],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export interface PprofExtensionConfig {
|
|
25
|
+
/** Default `localhost:1777`. */
|
|
26
|
+
endpoint?: string;
|
|
27
|
+
block_profile_fraction?: number;
|
|
28
|
+
mutex_profile_fraction?: number;
|
|
29
|
+
save_to_file?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Serves Go's net/http/pprof profiling endpoints. */
|
|
33
|
+
export const PprofExtension = defineBuiltin<PprofExtensionConfig, "extension", "pprof">({
|
|
34
|
+
kind: "extension",
|
|
35
|
+
type: "pprof",
|
|
36
|
+
description: "Serves Go pprof profiling endpoints",
|
|
37
|
+
endpoints: (c) => [c.endpoint ?? "localhost:1777"],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export interface ZPagesExtensionConfig {
|
|
41
|
+
/** Default `localhost:55679`. */
|
|
42
|
+
endpoint?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Serves in-process zPages for live debugging of pipelines. */
|
|
46
|
+
export const ZPagesExtension = defineBuiltin<ZPagesExtensionConfig, "extension", "zpages">({
|
|
47
|
+
kind: "extension",
|
|
48
|
+
type: "zpages",
|
|
49
|
+
description: "Serves zPages for live debugging of receivers and exporters",
|
|
50
|
+
endpoints: (c) => [c.endpoint ?? "localhost:55679"],
|
|
51
|
+
});
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in processors: batch, memory_limiter, resource, attributes,
|
|
3
|
+
* k8sattributes, resourcedetection.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { defineBuiltin } from "../define";
|
|
7
|
+
import type { AttributeAction, Duration } from "./common";
|
|
8
|
+
|
|
9
|
+
// ── batch ────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
export interface BatchProcessorConfig {
|
|
12
|
+
timeout?: Duration;
|
|
13
|
+
send_batch_size?: number;
|
|
14
|
+
send_batch_max_size?: number;
|
|
15
|
+
metadata_keys?: string[];
|
|
16
|
+
metadata_cardinality_limit?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Batches telemetry before export, to cut request count and compress better. */
|
|
20
|
+
export const BatchProcessor = defineBuiltin<BatchProcessorConfig, "processor", "batch">({
|
|
21
|
+
kind: "processor",
|
|
22
|
+
type: "batch",
|
|
23
|
+
description: "Groups telemetry into batches before export",
|
|
24
|
+
validate: (c) =>
|
|
25
|
+
c.send_batch_max_size !== undefined && c.send_batch_max_size !== 0 && c.send_batch_size !== undefined && c.send_batch_max_size < c.send_batch_size
|
|
26
|
+
? [`send_batch_max_size (${c.send_batch_max_size}) is below send_batch_size (${c.send_batch_size}); the collector rejects this`]
|
|
27
|
+
: [],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// ── memory_limiter ───────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
export interface MemoryLimiterProcessorConfig {
|
|
33
|
+
check_interval: Duration;
|
|
34
|
+
limit_mib?: number;
|
|
35
|
+
spike_limit_mib?: number;
|
|
36
|
+
limit_percentage?: number;
|
|
37
|
+
spike_limit_percentage?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Refuses data when the collector nears its memory limit. Belongs first in every pipeline. */
|
|
41
|
+
export const MemoryLimiterProcessor = defineBuiltin<MemoryLimiterProcessorConfig, "processor", "memory_limiter">({
|
|
42
|
+
kind: "processor",
|
|
43
|
+
type: "memory_limiter",
|
|
44
|
+
description: "Refuses data when the collector nears a memory limit; runs first in a pipeline",
|
|
45
|
+
validate: (c) => {
|
|
46
|
+
const problems: string[] = [];
|
|
47
|
+
if (c.limit_mib === undefined && c.limit_percentage === undefined) {
|
|
48
|
+
problems.push("set limit_mib or limit_percentage; with neither the collector refuses to start");
|
|
49
|
+
}
|
|
50
|
+
if (c.limit_mib !== undefined && c.spike_limit_mib !== undefined && c.spike_limit_mib >= c.limit_mib) {
|
|
51
|
+
problems.push(`spike_limit_mib (${c.spike_limit_mib}) must be below limit_mib (${c.limit_mib})`);
|
|
52
|
+
}
|
|
53
|
+
if (c.limit_percentage !== undefined && (c.limit_percentage <= 0 || c.limit_percentage > 100)) {
|
|
54
|
+
problems.push(`limit_percentage (${c.limit_percentage}) must be between 1 and 100`);
|
|
55
|
+
}
|
|
56
|
+
return problems;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// ── resource ─────────────────────────────────────────────────────────
|
|
61
|
+
|
|
62
|
+
export interface ResourceProcessorConfig {
|
|
63
|
+
attributes: AttributeAction[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Inserts, updates or deletes resource attributes. */
|
|
67
|
+
export const ResourceProcessor = defineBuiltin<ResourceProcessorConfig, "processor", "resource">({
|
|
68
|
+
kind: "processor",
|
|
69
|
+
type: "resource",
|
|
70
|
+
description: "Inserts, updates or deletes resource attributes",
|
|
71
|
+
validate: (c) => actionProblems(c.attributes, "attributes"),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// ── attributes ───────────────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
export interface AttributesMatch {
|
|
77
|
+
match_type: "strict" | "regexp";
|
|
78
|
+
services?: string[];
|
|
79
|
+
span_names?: string[];
|
|
80
|
+
log_bodies?: string[];
|
|
81
|
+
log_severity_texts?: string[];
|
|
82
|
+
metric_names?: string[];
|
|
83
|
+
attributes?: Array<{ key: string; value?: unknown }>;
|
|
84
|
+
resources?: Array<{ key: string; value?: unknown }>;
|
|
85
|
+
libraries?: Array<{ name: string; version?: string }>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface AttributesProcessorConfig {
|
|
89
|
+
actions: AttributeAction[];
|
|
90
|
+
include?: AttributesMatch;
|
|
91
|
+
exclude?: AttributesMatch;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Inserts, updates, hashes or deletes span, log and metric attributes. */
|
|
95
|
+
export const AttributesProcessor = defineBuiltin<AttributesProcessorConfig, "processor", "attributes">({
|
|
96
|
+
kind: "processor",
|
|
97
|
+
type: "attributes",
|
|
98
|
+
description: "Inserts, updates, hashes or deletes span, log and metric attributes",
|
|
99
|
+
validate: (c) => actionProblems(c.actions, "actions"),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
function actionProblems(actions: AttributeAction[] | undefined, field: string): string[] {
|
|
103
|
+
if (!actions || actions.length === 0) return [`${field} is empty, so the processor changes nothing`];
|
|
104
|
+
const problems: string[] = [];
|
|
105
|
+
actions.forEach((a, i) => {
|
|
106
|
+
if (a.action !== "extract" && !a.key) problems.push(`${field}[${i}] (${a.action}) needs a key`);
|
|
107
|
+
if (a.action === "extract" && !a.pattern) problems.push(`${field}[${i}] (extract) needs a pattern`);
|
|
108
|
+
if (
|
|
109
|
+
(a.action === "insert" || a.action === "update" || a.action === "upsert") &&
|
|
110
|
+
a.value === undefined &&
|
|
111
|
+
a.from_attribute === undefined &&
|
|
112
|
+
a.from_context === undefined
|
|
113
|
+
) {
|
|
114
|
+
problems.push(`${field}[${i}] (${a.action}) needs value, from_attribute or from_context`);
|
|
115
|
+
}
|
|
116
|
+
if (a.action === "convert" && !a.converted_type) problems.push(`${field}[${i}] (convert) needs converted_type`);
|
|
117
|
+
});
|
|
118
|
+
return problems;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ── k8sattributes ────────────────────────────────────────────────────
|
|
122
|
+
|
|
123
|
+
export interface K8sFieldExtract {
|
|
124
|
+
tag_name?: string;
|
|
125
|
+
key?: string;
|
|
126
|
+
key_regex?: string;
|
|
127
|
+
from: "pod" | "namespace" | "node";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface K8sPodAssociationSource {
|
|
131
|
+
from: "resource_attribute" | "connection";
|
|
132
|
+
name?: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface K8sAttributesProcessorConfig {
|
|
136
|
+
auth_type?: "none" | "serviceAccount" | "kubeConfig" | "tls";
|
|
137
|
+
passthrough?: boolean;
|
|
138
|
+
filter?: {
|
|
139
|
+
node?: string;
|
|
140
|
+
node_from_env_var?: string;
|
|
141
|
+
namespace?: string;
|
|
142
|
+
fields?: Array<{ key: string; value: string; op?: "equals" | "not-equals" }>;
|
|
143
|
+
labels?: Array<{ key: string; value: string; op?: "equals" | "not-equals" | "exists" | "does-not-exist" }>;
|
|
144
|
+
};
|
|
145
|
+
extract?: {
|
|
146
|
+
metadata?: string[];
|
|
147
|
+
labels?: K8sFieldExtract[];
|
|
148
|
+
annotations?: K8sFieldExtract[];
|
|
149
|
+
otel_annotations?: boolean;
|
|
150
|
+
};
|
|
151
|
+
pod_association?: Array<{ sources: K8sPodAssociationSource[] }>;
|
|
152
|
+
exclude?: { pods?: Array<{ name: string }> };
|
|
153
|
+
wait_for_metadata?: boolean;
|
|
154
|
+
wait_for_metadata_timeout?: Duration;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Adds Kubernetes pod, namespace and node metadata to telemetry. */
|
|
158
|
+
export const K8sAttributesProcessor = defineBuiltin<K8sAttributesProcessorConfig, "processor", "k8sattributes">({
|
|
159
|
+
kind: "processor",
|
|
160
|
+
type: "k8sattributes",
|
|
161
|
+
description: "Adds Kubernetes pod, namespace and node metadata to telemetry",
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// ── resourcedetection ────────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
export type ResourceDetector =
|
|
167
|
+
| "env"
|
|
168
|
+
| "system"
|
|
169
|
+
| "docker"
|
|
170
|
+
| "gcp"
|
|
171
|
+
| "ec2"
|
|
172
|
+
| "ecs"
|
|
173
|
+
| "eks"
|
|
174
|
+
| "elasticbeanstalk"
|
|
175
|
+
| "lambda"
|
|
176
|
+
| "azure"
|
|
177
|
+
| "aks"
|
|
178
|
+
| "consul"
|
|
179
|
+
| "heroku"
|
|
180
|
+
| "openshift"
|
|
181
|
+
| "k8snode"
|
|
182
|
+
| "kubeadm"
|
|
183
|
+
| "dynatrace";
|
|
184
|
+
|
|
185
|
+
export interface ResourceDetectionProcessorConfig {
|
|
186
|
+
detectors: Array<ResourceDetector | (string & {})>;
|
|
187
|
+
timeout?: Duration;
|
|
188
|
+
override?: boolean;
|
|
189
|
+
/** Per-detector settings, e.g. `system: { hostname_sources: ["os"] }`. */
|
|
190
|
+
system?: Record<string, unknown>;
|
|
191
|
+
ec2?: Record<string, unknown>;
|
|
192
|
+
gcp?: Record<string, unknown>;
|
|
193
|
+
azure?: Record<string, unknown>;
|
|
194
|
+
k8snode?: Record<string, unknown>;
|
|
195
|
+
docker?: Record<string, unknown>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Detects the host's resource attributes (cloud, container, host) and adds them. */
|
|
199
|
+
export const ResourceDetectionProcessor = defineBuiltin<
|
|
200
|
+
ResourceDetectionProcessorConfig,
|
|
201
|
+
"processor",
|
|
202
|
+
"resourcedetection"
|
|
203
|
+
>({
|
|
204
|
+
kind: "processor",
|
|
205
|
+
type: "resourcedetection",
|
|
206
|
+
description: "Detects cloud, container and host resource attributes",
|
|
207
|
+
validate: (c) => (c.detectors?.length ? [] : ["detectors is empty, so nothing is detected"]),
|
|
208
|
+
});
|