feat: add diagnostics events and otel exporter
This commit is contained in:
@@ -47,6 +47,7 @@ export type ChannelUiMetadata = {
|
||||
const GROUP_LABELS: Record<string, string> = {
|
||||
wizard: "Wizard",
|
||||
update: "Update",
|
||||
diagnostics: "Diagnostics",
|
||||
logging: "Logging",
|
||||
gateway: "Gateway",
|
||||
agents: "Agents",
|
||||
@@ -73,6 +74,7 @@ const GROUP_LABELS: Record<string, string> = {
|
||||
const GROUP_ORDER: Record<string, number> = {
|
||||
wizard: 20,
|
||||
update: 25,
|
||||
diagnostics: 27,
|
||||
gateway: 30,
|
||||
agents: 40,
|
||||
tools: 50,
|
||||
@@ -101,6 +103,17 @@ const FIELD_LABELS: Record<string, string> = {
|
||||
"meta.lastTouchedAt": "Config Last Touched At",
|
||||
"update.channel": "Update Channel",
|
||||
"update.checkOnStart": "Update Check on Start",
|
||||
"diagnostics.enabled": "Diagnostics Enabled",
|
||||
"diagnostics.otel.enabled": "OpenTelemetry Enabled",
|
||||
"diagnostics.otel.endpoint": "OpenTelemetry Endpoint",
|
||||
"diagnostics.otel.protocol": "OpenTelemetry Protocol",
|
||||
"diagnostics.otel.headers": "OpenTelemetry Headers",
|
||||
"diagnostics.otel.serviceName": "OpenTelemetry Service Name",
|
||||
"diagnostics.otel.traces": "OpenTelemetry Traces Enabled",
|
||||
"diagnostics.otel.metrics": "OpenTelemetry Metrics Enabled",
|
||||
"diagnostics.otel.logs": "OpenTelemetry Logs Enabled",
|
||||
"diagnostics.otel.sampleRate": "OpenTelemetry Trace Sample Rate",
|
||||
"diagnostics.otel.flushIntervalMs": "OpenTelemetry Flush Interval (ms)",
|
||||
"gateway.remote.url": "Remote Gateway URL",
|
||||
"gateway.remote.sshTarget": "Remote Gateway SSH Target",
|
||||
"gateway.remote.sshIdentity": "Remote Gateway SSH Identity",
|
||||
|
||||
@@ -102,6 +102,26 @@ export type LoggingConfig = {
|
||||
redactPatterns?: string[];
|
||||
};
|
||||
|
||||
export type DiagnosticsOtelConfig = {
|
||||
enabled?: boolean;
|
||||
endpoint?: string;
|
||||
protocol?: "http/protobuf" | "grpc";
|
||||
headers?: Record<string, string>;
|
||||
serviceName?: string;
|
||||
traces?: boolean;
|
||||
metrics?: boolean;
|
||||
logs?: boolean;
|
||||
/** Trace sample rate (0.0 - 1.0). */
|
||||
sampleRate?: number;
|
||||
/** Metric export interval (ms). */
|
||||
flushIntervalMs?: number;
|
||||
};
|
||||
|
||||
export type DiagnosticsConfig = {
|
||||
enabled?: boolean;
|
||||
otel?: DiagnosticsOtelConfig;
|
||||
};
|
||||
|
||||
export type WebReconnectConfig = {
|
||||
initialMs?: number;
|
||||
maxMs?: number;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentBinding, AgentsConfig } from "./types.agents.js";
|
||||
import type { AuthConfig } from "./types.auth.js";
|
||||
import type { LoggingConfig, SessionConfig, WebConfig } from "./types.base.js";
|
||||
import type { DiagnosticsConfig, LoggingConfig, SessionConfig, WebConfig } from "./types.base.js";
|
||||
import type { BrowserConfig } from "./types.browser.js";
|
||||
import type { ChannelsConfig } from "./types.channels.js";
|
||||
import type { CronConfig } from "./types.cron.js";
|
||||
@@ -53,6 +53,7 @@ export type ClawdbotConfig = {
|
||||
lastRunCommand?: string;
|
||||
lastRunMode?: "local" | "remote";
|
||||
};
|
||||
diagnostics?: DiagnosticsConfig;
|
||||
logging?: LoggingConfig;
|
||||
update?: {
|
||||
/** Update channel for git + npm installs ("stable", "beta", or "dev"). */
|
||||
|
||||
@@ -38,6 +38,27 @@ export const ClawdbotSchema = z
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
diagnostics: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
otel: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
endpoint: z.string().optional(),
|
||||
protocol: z.union([z.literal("http/protobuf"), z.literal("grpc")]).optional(),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
serviceName: z.string().optional(),
|
||||
traces: z.boolean().optional(),
|
||||
metrics: z.boolean().optional(),
|
||||
logs: z.boolean().optional(),
|
||||
sampleRate: z.number().min(0).max(1).optional(),
|
||||
flushIntervalMs: z.number().int().nonnegative().optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
logging: z
|
||||
.object({
|
||||
level: z
|
||||
|
||||
Reference in New Issue
Block a user