mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-28 13:47:12 +02:00
feat: add OpenTelemetry settings UI and sidecar environment wiring
Add a global Telemetry section in the settings panel with: - Toggle to enable/disable OTLP export - Text input for the OTLP endpoint URL (default: http://localhost:4317) - Guidance note about using \un run aspire\ for local testing Wire the setting through the full stack: - OpenTelemetrySettings type in shared domain with normalization - IPC channel, preload binding, and handler for persistence - SidecarClient forwards settings to createSidecarEnvironment - Sidecar environment injects OTEL_EXPORTER_OTLP_ENDPOINT when enabled - Settings loaded from workspace.json on startup and on change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import type { OpenTelemetrySettings } from '@shared/domain/tooling';
|
||||
|
||||
const blockedEnvironmentPrefixes = ['BUN_', 'COPILOT_', 'ELECTRON_', 'NODE_', 'NPM_'];
|
||||
|
||||
export function createSidecarEnvironment(baseEnvironment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
||||
export function createSidecarEnvironment(
|
||||
baseEnvironment: NodeJS.ProcessEnv,
|
||||
openTelemetry?: OpenTelemetrySettings,
|
||||
): NodeJS.ProcessEnv {
|
||||
const sanitizedEnvironment: NodeJS.ProcessEnv = {};
|
||||
|
||||
for (const [name, value] of Object.entries(baseEnvironment)) {
|
||||
@@ -13,5 +18,9 @@ export function createSidecarEnvironment(baseEnvironment: NodeJS.ProcessEnv): No
|
||||
sanitizedEnvironment[name] = value;
|
||||
}
|
||||
|
||||
if (openTelemetry?.enabled && openTelemetry.endpoint) {
|
||||
sanitizedEnvironment.OTEL_EXPORTER_OTLP_ENDPOINT = openTelemetry.endpoint;
|
||||
}
|
||||
|
||||
return sanitizedEnvironment;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import type {
|
||||
} from '@shared/contracts/sidecar';
|
||||
import type { ApprovalDecision } from '@shared/domain/approval';
|
||||
import type { ChatMessageRecord } from '@shared/domain/session';
|
||||
import type { OpenTelemetrySettings } from '@shared/domain/tooling';
|
||||
import { createSidecarEnvironment } from '@main/sidecar/sidecarEnvironment';
|
||||
import {
|
||||
markRunTurnPendingErrored,
|
||||
@@ -109,6 +110,11 @@ export class SidecarClient {
|
||||
private processState?: ManagedSidecarProcess;
|
||||
private nextProcessId = 0;
|
||||
private readonly pending = new Map<string, PendingCommand>();
|
||||
private openTelemetrySettings?: OpenTelemetrySettings;
|
||||
|
||||
setOpenTelemetrySettings(settings?: OpenTelemetrySettings): void {
|
||||
this.openTelemetrySettings = settings;
|
||||
}
|
||||
|
||||
async describeCapabilities(): Promise<SidecarCapabilities> {
|
||||
const command = await this.dispatch<SidecarCapabilities>({
|
||||
@@ -240,7 +246,7 @@ export class SidecarClient {
|
||||
});
|
||||
const childProcess = spawn(sidecar.command, sidecar.args, {
|
||||
cwd: sidecar.cwd,
|
||||
env: createSidecarEnvironment(process.env),
|
||||
env: createSidecarEnvironment(process.env, this.openTelemetrySettings),
|
||||
stdio: 'pipe',
|
||||
windowsHide: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user