@vymalo/opencode-otel 0.12.0 → 0.14.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/dist/config.d.ts CHANGED
@@ -3,25 +3,37 @@ export declare const SIGNALS: readonly SignalName[];
3
3
  /** Env source, injectable so tests never touch `process.env`. */
4
4
  export type EnvSource = Record<string, string | undefined>;
5
5
  /**
6
- * Parse the OTel `key=value,key2=value2` list format used by both
7
- * `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_RESOURCE_ATTRIBUTES`. Values are
8
- * percent-decoded per spec; an undecodable value is kept verbatim rather than
9
- * dropping the whole pair.
10
- */
6
+ * Parse the OTel `key=value,key2=value2` list format used by both
7
+ * `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_RESOURCE_ATTRIBUTES`. Values are
8
+ * percent-decoded per spec; an undecodable value is kept verbatim rather than
9
+ * dropping the whole pair.
10
+ */
11
11
  export declare function parseKeyValueList(raw: string | undefined): Record<string, string>;
12
12
  /**
13
- * Resolve plugin options against the environment.
14
- *
15
- * **Precedence: environment overrides plugin options.** Options are the base
16
- * layer so a `.well-known/opencode` document can ship a working default for a
17
- * whole organization; `OTEL_*` variables override per machine so a developer
18
- * can point at a local collector without editing served config. See
19
- * `plans/otel.md`.
20
- */
13
+ * Normalise a command to argv. An array is taken verbatim — that is the form to
14
+ * use when a path contains spaces. A string is split on whitespace, with **no
15
+ * shell**: no quoting, no substitution, no injection surface.
16
+ *
17
+ * The split is decided by the type of the value actually supplied, not by the
18
+ * type of some other candidate. Keying it on the wrong source silently produced
19
+ * a single argv element like `"governance-auth token"` whenever an environment
20
+ * override sat on top of an array in config — which `execFile` then failed to
21
+ * spawn, so every export went out unauthenticated.
22
+ */
23
+ export declare function parseCommand(raw: unknown): string[];
24
+ /**
25
+ * Resolve plugin options against the environment.
26
+ *
27
+ * **Precedence: environment overrides plugin options.** Options are the base
28
+ * layer so a `.well-known/opencode` document can ship a working default for a
29
+ * whole organization; `OTEL_*` variables override per machine so a developer
30
+ * can point at a local collector without editing served config. See
31
+ * `plans/otel.md`.
32
+ */
21
33
  export declare function resolveOtelConfig(raw: unknown, env?: EnvSource): ResolvedOtelConfig;
22
34
  /**
23
- * Resolve the OTLP URL for one signal. A per-signal endpoint is used verbatim
24
- * (spec: it already includes the path); the base endpoint gets the signal path
25
- * appended.
26
- */
35
+ * Resolve the OTLP URL for one signal. A per-signal endpoint is used verbatim
36
+ * (spec: it already includes the path); the base endpoint gets the signal path
37
+ * appended.
38
+ */
27
39
  export declare function signalUrl(config: ResolvedOtelConfig, signal: SignalName): string | undefined;
package/dist/config.js CHANGED
@@ -1,224 +1,237 @@
1
- export const SIGNALS = ["traces", "metrics", "logs"];
1
+ import { DEFAULT_REFRESH_MS } from "./token-source.js";
2
+ export const SIGNALS = [
3
+ "traces",
4
+ "metrics",
5
+ "logs"
6
+ ];
2
7
  const DEFAULTS = {
3
- serviceName: "opencode",
4
- metricExportIntervalMs: 60_000,
5
- logExportIntervalMs: 5_000,
6
- traceExportIntervalMs: 5_000,
7
- metricTemporality: "delta"
8
+ serviceName: "opencode",
9
+ metricExportIntervalMs: 6e4,
10
+ logExportIntervalMs: 5e3,
11
+ traceExportIntervalMs: 5e3,
12
+ metricTemporality: "delta"
8
13
  };
9
14
  /**
10
- * The `OTEL_*` variable names read per signal. The first entry of each tuple is
11
- * the OTel-spec name; the second (where present) is the Claude-Code-compatible
12
- * alias, accepted so an operator can move a working env block across tools.
13
- */
15
+ * The `OTEL_*` variable names read per signal. The first entry of each tuple is
16
+ * the OTel-spec name; the second (where present) is the Claude-Code-compatible
17
+ * alias, accepted so an operator can move a working env block across tools.
18
+ */
14
19
  const SIGNAL_ENV = {
15
- traces: {
16
- exporter: "OTEL_TRACES_EXPORTER",
17
- endpoint: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
18
- interval: ["OTEL_BSP_SCHEDULE_DELAY", "OTEL_TRACES_EXPORT_INTERVAL"]
19
- },
20
- metrics: {
21
- exporter: "OTEL_METRICS_EXPORTER",
22
- endpoint: "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT",
23
- interval: ["OTEL_METRIC_EXPORT_INTERVAL"]
24
- },
25
- logs: {
26
- exporter: "OTEL_LOGS_EXPORTER",
27
- endpoint: "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",
28
- interval: ["OTEL_BLRP_SCHEDULE_DELAY", "OTEL_LOGS_EXPORT_INTERVAL"]
29
- }
20
+ traces: {
21
+ exporter: "OTEL_TRACES_EXPORTER",
22
+ endpoint: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
23
+ interval: ["OTEL_BSP_SCHEDULE_DELAY", "OTEL_TRACES_EXPORT_INTERVAL"]
24
+ },
25
+ metrics: {
26
+ exporter: "OTEL_METRICS_EXPORTER",
27
+ endpoint: "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT",
28
+ interval: ["OTEL_METRIC_EXPORT_INTERVAL"]
29
+ },
30
+ logs: {
31
+ exporter: "OTEL_LOGS_EXPORTER",
32
+ endpoint: "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",
33
+ interval: ["OTEL_BLRP_SCHEDULE_DELAY", "OTEL_LOGS_EXPORT_INTERVAL"]
34
+ }
30
35
  };
31
36
  function parseBool(value) {
32
- if (value === undefined) {
33
- return undefined;
34
- }
35
- if (/^(1|true|yes|on)$/i.test(value)) {
36
- return true;
37
- }
38
- if (/^(0|false|no|off)$/i.test(value)) {
39
- return false;
40
- }
41
- return undefined;
37
+ if (value === undefined) {
38
+ return undefined;
39
+ }
40
+ if (/^(1|true|yes|on)$/i.test(value)) {
41
+ return true;
42
+ }
43
+ if (/^(0|false|no|off)$/i.test(value)) {
44
+ return false;
45
+ }
46
+ return undefined;
42
47
  }
43
48
  function parsePositiveInt(value) {
44
- if (value === undefined) {
45
- return undefined;
46
- }
47
- const n = Number.parseInt(value.trim(), 10);
48
- return Number.isFinite(n) && n > 0 ? n : undefined;
49
+ if (value === undefined) {
50
+ return undefined;
51
+ }
52
+ const n = Number.parseInt(value.trim(), 10);
53
+ return Number.isFinite(n) && n > 0 ? n : undefined;
49
54
  }
50
55
  /**
51
- * Parse the OTel `key=value,key2=value2` list format used by both
52
- * `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_RESOURCE_ATTRIBUTES`. Values are
53
- * percent-decoded per spec; an undecodable value is kept verbatim rather than
54
- * dropping the whole pair.
55
- */
56
+ * Parse the OTel `key=value,key2=value2` list format used by both
57
+ * `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_RESOURCE_ATTRIBUTES`. Values are
58
+ * percent-decoded per spec; an undecodable value is kept verbatim rather than
59
+ * dropping the whole pair.
60
+ */
56
61
  export function parseKeyValueList(raw) {
57
- if (!raw) {
58
- return {};
59
- }
60
- const out = {};
61
- for (const pair of raw.split(",")) {
62
- const eq = pair.indexOf("=");
63
- if (eq <= 0) {
64
- continue;
65
- }
66
- const key = pair.slice(0, eq).trim();
67
- const rawValue = pair.slice(eq + 1).trim();
68
- if (!key) {
69
- continue;
70
- }
71
- try {
72
- out[key] = decodeURIComponent(rawValue);
73
- }
74
- catch {
75
- out[key] = rawValue;
76
- }
77
- }
78
- return out;
62
+ if (!raw) {
63
+ return {};
64
+ }
65
+ const out = {};
66
+ for (const pair of raw.split(",")) {
67
+ const eq = pair.indexOf("=");
68
+ if (eq <= 0) {
69
+ continue;
70
+ }
71
+ const key = pair.slice(0, eq).trim();
72
+ const rawValue = pair.slice(eq + 1).trim();
73
+ if (!key) {
74
+ continue;
75
+ }
76
+ try {
77
+ out[key] = decodeURIComponent(rawValue);
78
+ } catch {
79
+ out[key] = rawValue;
80
+ }
81
+ }
82
+ return out;
79
83
  }
80
84
  function parseExporter(value) {
81
- if (value === undefined) {
82
- return undefined;
83
- }
84
- // The spec allows a comma-separated list; we honour the first recognised
85
- // entry rather than fanning out to multiple exporters.
86
- for (const candidate of value.split(",").map((v) => v.trim().toLowerCase())) {
87
- if (candidate === "otlp" || candidate === "console" || candidate === "none") {
88
- return candidate;
89
- }
90
- }
91
- return undefined;
85
+ if (value === undefined) {
86
+ return undefined;
87
+ }
88
+ // The spec allows a comma-separated list; we honour the first recognised
89
+ // entry rather than fanning out to multiple exporters.
90
+ for (const candidate of value.split(",").map((v) => v.trim().toLowerCase())) {
91
+ if (candidate === "otlp" || candidate === "console" || candidate === "none") {
92
+ return candidate;
93
+ }
94
+ }
95
+ return undefined;
92
96
  }
93
97
  function firstDefined(env, keys) {
94
- for (const key of keys) {
95
- const value = env[key];
96
- if (value !== undefined && value !== "") {
97
- return value;
98
- }
99
- }
100
- return undefined;
98
+ for (const key of keys) {
99
+ const value = env[key];
100
+ if (value !== undefined && value !== "") {
101
+ return value;
102
+ }
103
+ }
104
+ return undefined;
101
105
  }
102
106
  function stringRecord(raw) {
103
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
104
- return {};
105
- }
106
- const out = {};
107
- for (const [key, value] of Object.entries(raw)) {
108
- if (typeof value === "string") {
109
- out[key] = value;
110
- }
111
- else if (typeof value === "number" || typeof value === "boolean") {
112
- out[key] = String(value);
113
- }
114
- }
115
- return out;
107
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
108
+ return {};
109
+ }
110
+ const out = {};
111
+ for (const [key, value] of Object.entries(raw)) {
112
+ if (typeof value === "string") {
113
+ out[key] = value;
114
+ } else if (typeof value === "number" || typeof value === "boolean") {
115
+ out[key] = String(value);
116
+ }
117
+ }
118
+ return out;
116
119
  }
117
120
  function stringList(raw) {
118
- if (Array.isArray(raw)) {
119
- return raw.filter((v) => typeof v === "string" && v.trim() !== "");
120
- }
121
- if (typeof raw === "string") {
122
- return raw
123
- .split(",")
124
- .map((v) => v.trim())
125
- .filter((v) => v !== "");
126
- }
127
- return [];
121
+ if (Array.isArray(raw)) {
122
+ return raw.filter((v) => typeof v === "string" && v.trim() !== "");
123
+ }
124
+ if (typeof raw === "string") {
125
+ return raw.split(",").map((v) => v.trim()).filter((v) => v !== "");
126
+ }
127
+ return [];
128
128
  }
129
129
  /**
130
- * Resolve plugin options against the environment.
131
- *
132
- * **Precedence: environment overrides plugin options.** Options are the base
133
- * layer so a `.well-known/opencode` document can ship a working default for a
134
- * whole organization; `OTEL_*` variables override per machine so a developer
135
- * can point at a local collector without editing served config. See
136
- * `plans/otel.md`.
137
- */
130
+ * Normalise a command to argv. An array is taken verbatim — that is the form to
131
+ * use when a path contains spaces. A string is split on whitespace, with **no
132
+ * shell**: no quoting, no substitution, no injection surface.
133
+ *
134
+ * The split is decided by the type of the value actually supplied, not by the
135
+ * type of some other candidate. Keying it on the wrong source silently produced
136
+ * a single argv element like `"governance-auth token"` whenever an environment
137
+ * override sat on top of an array in config — which `execFile` then failed to
138
+ * spawn, so every export went out unauthenticated.
139
+ */
140
+ export function parseCommand(raw) {
141
+ if (Array.isArray(raw)) {
142
+ return raw.filter((part) => typeof part === "string" && part.trim() !== "");
143
+ }
144
+ if (typeof raw === "string") {
145
+ return raw.split(/\s+/).filter((part) => part !== "");
146
+ }
147
+ return [];
148
+ }
149
+ /**
150
+ * Resolve plugin options against the environment.
151
+ *
152
+ * **Precedence: environment overrides plugin options.** Options are the base
153
+ * layer so a `.well-known/opencode` document can ship a working default for a
154
+ * whole organization; `OTEL_*` variables override per machine so a developer
155
+ * can point at a local collector without editing served config. See
156
+ * `plans/otel.md`.
157
+ */
138
158
  export function resolveOtelConfig(raw, env = process.env) {
139
- const opts = (raw ?? {});
140
- const enabled = parseBool(env.OPENCODE_OTEL_ENABLED) ?? opts.enabled !== false;
141
- const endpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT || opts.endpoint || undefined;
142
- const endpoints = {};
143
- for (const signal of SIGNALS) {
144
- const value = env[SIGNAL_ENV[signal].endpoint] || opts.endpoints?.[signal];
145
- if (value) {
146
- endpoints[signal] = value;
147
- }
148
- }
149
- // Env headers merge over option headers key-by-key rather than replacing the
150
- // map, so a machine can override just its auth token without restating the
151
- // whole set the served config provided.
152
- const headers = {
153
- ...stringRecord(opts.headers),
154
- ...parseKeyValueList(env.OTEL_EXPORTER_OTLP_HEADERS)
155
- };
156
- // An endpoint anywhere is what makes OTLP the implicit default; with none
157
- // configured the plugin stays completely inert.
158
- const hasEndpoint = Boolean(endpoint) || SIGNALS.some((s) => Boolean(endpoints[s]));
159
- const fallback = hasEndpoint ? "otlp" : "none";
160
- const exporters = {};
161
- for (const signal of SIGNALS) {
162
- exporters[signal] =
163
- parseExporter(env[SIGNAL_ENV[signal].exporter]) ?? opts.exporters?.[signal] ?? fallback;
164
- }
165
- const resourceAttributes = {
166
- ...stringRecord(opts.resourceAttributes),
167
- ...parseKeyValueList(env.OTEL_RESOURCE_ATTRIBUTES)
168
- };
169
- const temporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE?.trim().toLowerCase() === "cumulative"
170
- ? "cumulative"
171
- : env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE?.trim().toLowerCase() === "delta"
172
- ? "delta"
173
- : (opts.metricTemporality ?? DEFAULTS.metricTemporality);
174
- const filteredTools = new Set(env.OTEL_OPENCODE_FILTERED_TOOLS !== undefined
175
- ? stringList(env.OTEL_OPENCODE_FILTERED_TOOLS)
176
- : stringList(opts.filteredTools));
177
- const enabledSignals = SIGNALS.filter((s) => exporters[s] !== "none");
178
- return {
179
- enabled,
180
- active: enabled && enabledSignals.length > 0,
181
- endpoint,
182
- endpoints,
183
- headers,
184
- exporters,
185
- serviceName: env.OTEL_SERVICE_NAME || opts.serviceName || DEFAULTS.serviceName,
186
- environment: env.OPENCODE_OTEL_ENVIRONMENT || opts.environment || undefined,
187
- resourceAttributes,
188
- metricExportIntervalMs: parsePositiveInt(firstDefined(env, SIGNAL_ENV.metrics.interval)) ??
189
- (opts.metricExportIntervalMs && opts.metricExportIntervalMs > 0
190
- ? opts.metricExportIntervalMs
191
- : DEFAULTS.metricExportIntervalMs),
192
- logExportIntervalMs: parsePositiveInt(firstDefined(env, SIGNAL_ENV.logs.interval)) ??
193
- (opts.logExportIntervalMs && opts.logExportIntervalMs > 0
194
- ? opts.logExportIntervalMs
195
- : DEFAULTS.logExportIntervalMs),
196
- traceExportIntervalMs: parsePositiveInt(firstDefined(env, SIGNAL_ENV.traces.interval)) ??
197
- (opts.traceExportIntervalMs && opts.traceExportIntervalMs > 0
198
- ? opts.traceExportIntervalMs
199
- : DEFAULTS.traceExportIntervalMs),
200
- metricTemporality: temporality,
201
- includeSessionId: parseBool(env.OTEL_METRICS_INCLUDE_SESSION_ID) ?? opts.includeSessionId === true,
202
- filteredTools,
203
- propagateTraceContext: parseBool(env.OPENCODE_OTEL_PROPAGATE_TRACE_CONTEXT) ??
204
- (opts.propagateTraceContext !== false && exporters.traces !== "none")
205
- };
159
+ const opts = raw ?? {};
160
+ const enabled = parseBool(env.OPENCODE_OTEL_ENABLED) ?? opts.enabled !== false;
161
+ const endpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT || opts.endpoint || undefined;
162
+ const endpoints = {};
163
+ for (const signal of SIGNALS) {
164
+ const value = env[SIGNAL_ENV[signal].endpoint] || opts.endpoints?.[signal];
165
+ if (value) {
166
+ endpoints[signal] = value;
167
+ }
168
+ }
169
+ // Env headers merge over option headers key-by-key rather than replacing the
170
+ // map, so a machine can override just its auth token without restating the
171
+ // whole set the served config provided.
172
+ const headers = {
173
+ ...stringRecord(opts.headers),
174
+ ...parseKeyValueList(env.OTEL_EXPORTER_OTLP_HEADERS)
175
+ };
176
+ // An endpoint anywhere is what makes OTLP the implicit default; with none
177
+ // configured the plugin stays completely inert.
178
+ const hasEndpoint = Boolean(endpoint) || SIGNALS.some((s) => Boolean(endpoints[s]));
179
+ const fallback = hasEndpoint ? "otlp" : "none";
180
+ const exporters = {};
181
+ for (const signal of SIGNALS) {
182
+ exporters[signal] = parseExporter(env[SIGNAL_ENV[signal].exporter]) ?? opts.exporters?.[signal] ?? fallback;
183
+ }
184
+ const resourceAttributes = {
185
+ ...stringRecord(opts.resourceAttributes),
186
+ ...parseKeyValueList(env.OTEL_RESOURCE_ATTRIBUTES)
187
+ };
188
+ const temporality = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE?.trim().toLowerCase() === "cumulative" ? "cumulative" : env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE?.trim().toLowerCase() === "delta" ? "delta" : opts.metricTemporality ?? DEFAULTS.metricTemporality;
189
+ const filteredTools = new Set(env.OTEL_OPENCODE_FILTERED_TOOLS !== undefined ? stringList(env.OTEL_OPENCODE_FILTERED_TOOLS) : stringList(opts.filteredTools));
190
+ // Resolve the source first, then normalise based on *its* own type — see
191
+ // `parseCommand` for why keying the split on anything else is a trap.
192
+ const tokenCommand = parseCommand(env.OPENCODE_OTEL_TOKEN_COMMAND ?? opts.tokenCommand);
193
+ const enabledSignals = SIGNALS.filter((s) => exporters[s] !== "none");
194
+ return {
195
+ enabled,
196
+ active: enabled && enabledSignals.length > 0,
197
+ endpoint,
198
+ endpoints,
199
+ headers,
200
+ tokenCommand,
201
+ tokenHeader: env.OPENCODE_OTEL_TOKEN_HEADER || opts.tokenHeader || "Authorization",
202
+ tokenPrefix: env.OPENCODE_OTEL_TOKEN_PREFIX ?? opts.tokenPrefix ?? "Bearer ",
203
+ tokenRefreshMs: parsePositiveInt(env.OPENCODE_OTEL_TOKEN_REFRESH_MS) ?? (opts.tokenRefreshMs && opts.tokenRefreshMs > 0 ? opts.tokenRefreshMs : DEFAULT_REFRESH_MS),
204
+ tokenTimeoutMs: parsePositiveInt(env.OPENCODE_OTEL_TOKEN_TIMEOUT_MS) ?? (opts.tokenTimeoutMs && opts.tokenTimeoutMs > 0 ? opts.tokenTimeoutMs : 1e4),
205
+ exporters,
206
+ serviceName: env.OTEL_SERVICE_NAME || opts.serviceName || DEFAULTS.serviceName,
207
+ environment: env.OPENCODE_OTEL_ENVIRONMENT || opts.environment || undefined,
208
+ resourceAttributes,
209
+ collectVcs: parseBool(env.OPENCODE_OTEL_COLLECT_VCS) ?? opts.collectVcs !== false,
210
+ metricExportIntervalMs: parsePositiveInt(firstDefined(env, SIGNAL_ENV.metrics.interval)) ?? (opts.metricExportIntervalMs && opts.metricExportIntervalMs > 0 ? opts.metricExportIntervalMs : DEFAULTS.metricExportIntervalMs),
211
+ logExportIntervalMs: parsePositiveInt(firstDefined(env, SIGNAL_ENV.logs.interval)) ?? (opts.logExportIntervalMs && opts.logExportIntervalMs > 0 ? opts.logExportIntervalMs : DEFAULTS.logExportIntervalMs),
212
+ traceExportIntervalMs: parsePositiveInt(firstDefined(env, SIGNAL_ENV.traces.interval)) ?? (opts.traceExportIntervalMs && opts.traceExportIntervalMs > 0 ? opts.traceExportIntervalMs : DEFAULTS.traceExportIntervalMs),
213
+ metricTemporality: temporality,
214
+ includeSessionId: parseBool(env.OTEL_METRICS_INCLUDE_SESSION_ID) ?? opts.includeSessionId === true,
215
+ filteredTools,
216
+ propagateTraceContext: parseBool(env.OPENCODE_OTEL_PROPAGATE_TRACE_CONTEXT) ?? (opts.propagateTraceContext !== false && exporters.traces !== "none")
217
+ };
206
218
  }
207
219
  /**
208
- * Resolve the OTLP URL for one signal. A per-signal endpoint is used verbatim
209
- * (spec: it already includes the path); the base endpoint gets the signal path
210
- * appended.
211
- */
220
+ * Resolve the OTLP URL for one signal. A per-signal endpoint is used verbatim
221
+ * (spec: it already includes the path); the base endpoint gets the signal path
222
+ * appended.
223
+ */
212
224
  export function signalUrl(config, signal) {
213
- const explicit = config.endpoints[signal];
214
- if (explicit) {
215
- return explicit;
216
- }
217
- if (!config.endpoint) {
218
- return undefined;
219
- }
220
- const base = config.endpoint.replace(/\/+$/, "");
221
- const path = signal === "traces" ? "v1/traces" : signal === "metrics" ? "v1/metrics" : "v1/logs";
222
- return `${base}/${path}`;
225
+ const explicit = config.endpoints[signal];
226
+ if (explicit) {
227
+ return explicit;
228
+ }
229
+ if (!config.endpoint) {
230
+ return undefined;
231
+ }
232
+ const base = config.endpoint.replace(/\/+$/, "");
233
+ const path = signal === "traces" ? "v1/traces" : signal === "metrics" ? "v1/metrics" : "v1/logs";
234
+ return `${base}/${path}`;
223
235
  }
236
+
224
237
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,OAAO,GAA0B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AAErF,MAAM,QAAQ,GAAG;IACf,WAAW,EAAE,UAAU;IACvB,sBAAsB,EAAE,MAAM;IAC9B,mBAAmB,EAAE,KAAK;IAC1B,qBAAqB,EAAE,KAAK;IAC5B,iBAAiB,EAAE,OAA4B;CACvC,CAAC;AAKX;;;;GAIG;AACH,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE;QACN,QAAQ,EAAE,sBAAsB;QAChC,QAAQ,EAAE,oCAAoC;QAC9C,QAAQ,EAAE,CAAC,yBAAyB,EAAE,6BAA6B,CAAC;KACrE;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,uBAAuB;QACjC,QAAQ,EAAE,qCAAqC;QAC/C,QAAQ,EAAE,CAAC,6BAA6B,CAAC;KAC1C;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,oBAAoB;QAC9B,QAAQ,EAAE,kCAAkC;QAC5C,QAAQ,EAAE,CAAC,0BAA0B,EAAE,2BAA2B,CAAC;KACpE;CAIF,CAAC;AAEF,SAAS,SAAS,CAAC,KAAyB;IAC1C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,gB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OAAO,SAAS,QAAQ,QAAQ,EAAE;CAC/C,MAAM,OAAO,WAAW,WAAW,cAAc,WAAW,YAAY,eAAe;CACvF,OAAO,GAAG,KAAK,GAAG;AACpB","names":[],"sources":["../src/config.ts"],"version":3,"file":"config.js","sourceRoot":""}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A resource attribute whose value only becomes known after the plugin has
3
+ * already started — OpenCode reports the host version and the git branch as
4
+ * *events*, not as plugin input, but an OTel `Resource` is fixed at provider
5
+ * construction.
6
+ *
7
+ * The OTel resource API accepts promise-valued attributes and exporters await
8
+ * them before the first export, so a deferred value is the supported way to
9
+ * bridge that gap. The timeout is not optional: a promise that never settles
10
+ * would block every export forever, so an attribute that has not arrived in
11
+ * time resolves to `undefined` and is dropped from the resource.
12
+ */
13
+ export interface DeferredAttribute {
14
+ /** Hand this to `resourceFromAttributes`. */
15
+ readonly value: Promise<string | undefined>;
16
+ /** Settle it with the real value. Later calls are ignored. */
17
+ settle(value: string | undefined): void;
18
+ /** Give up and settle as absent. Idempotent. */
19
+ abandon(): void;
20
+ }
21
+ export declare const DEFAULT_DEFERRED_TIMEOUT_MS = 2e3;
22
+ export declare function deferredAttribute(timeoutMs?: number, schedule?: typeof setTimeout): DeferredAttribute;
@@ -0,0 +1,29 @@
1
+ export const DEFAULT_DEFERRED_TIMEOUT_MS = 2e3;
2
+ export function deferredAttribute(timeoutMs = DEFAULT_DEFERRED_TIMEOUT_MS, schedule = setTimeout) {
3
+ let resolve = () => {};
4
+ let settled = false;
5
+ const value = new Promise((r) => {
6
+ resolve = r;
7
+ });
8
+ const finish = (next) => {
9
+ if (settled) {
10
+ return;
11
+ }
12
+ settled = true;
13
+ resolve(next);
14
+ };
15
+ const timer = schedule(() => finish(undefined), timeoutMs);
16
+ // Never hold a short CLI invocation open just to wait for an attribute.
17
+ timer.unref?.();
18
+ return {
19
+ value,
20
+ settle: (next) => {
21
+ if (next !== undefined && next !== "") {
22
+ finish(next);
23
+ }
24
+ },
25
+ abandon: () => finish(undefined)
26
+ };
27
+ }
28
+
29
+ //# sourceMappingURL=deferred.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAqBA,OAAO,MAAM,8BAA8B;AAE3C,OAAO,SAAS,kBACd,YAAoB,6BACpB,WAA8B,YACX;CACnB,IAAI,gBAAqD,CAAC;CAC1D,IAAI,UAAU;CACd,MAAM,QAAQ,IAAI,SAA6B,MAAM;EACnD,UAAU;CACZ,CAAC;CAED,MAAM,UAAU,SAAmC;EACjD,IAAI,SAAS;GACX;EACF;EACA,UAAU;EACV,QAAQ,IAAI;CACd;CAEA,MAAM,QAAQ,eAAe,OAAO,SAAS,GAAG,SAAS;;CAEzD,AAAC,MAAiC,QAAQ;CAE1C,OAAO;EACL;EACA,SAAS,SAAS;GAChB,IAAI,SAAS,aAAa,SAAS,IAAI;IACrC,OAAO,IAAI;GACb;EACF;EACA,eAAe,OAAO,SAAS;CACjC;AACF","names":[],"sources":["../src/deferred.ts"],"version":3,"file":"deferred.js","sourceRoot":""}
@@ -0,0 +1,28 @@
1
+ import { type ExportResult } from "@opentelemetry/core";
2
+ import type { Logger } from "./logging.js";
3
+ import type { SignalName } from "./types.js";
4
+ /**
5
+ * The shape all three OTel exporters share: `export(items, resultCallback)`.
6
+ * Typed structurally rather than against `SpanExporter | PushMetricExporter |
7
+ * LogRecordExporter`, whose item types are unrelated.
8
+ */
9
+ export interface ExporterLike {
10
+ export(items: never, resultCallback: (result: ExportResult) => void): void;
11
+ shutdown(): Promise<void>;
12
+ forceFlush?(): Promise<void>;
13
+ }
14
+ /**
15
+ * Wrap an exporter so a failed export reaches the host log stream.
16
+ *
17
+ * Without this, a rejected OTLP request — an expired credential, a wrong
18
+ * audience, an unreachable collector — is reported only through the OTel SDK's
19
+ * own `diag` channel, which nothing here subscribes to. The visible symptom is
20
+ * that telemetry silently stops while the session looks entirely healthy.
21
+ *
22
+ * Deliberately not `diag.setLogger`: that is process-global and would hijack
23
+ * the channel for the host and every other plugin. Decorating our own exporters
24
+ * observes exactly the failures we caused and nothing else.
25
+ */
26
+ export declare function withFailureLogging<T extends ExporterLike>(exporter: T, signal: SignalName, logger: Logger, options?: {
27
+ onFailure?: () => void;
28
+ }): T;