The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 18:15 UTC
fix(observability): custom resource attributes use the t3code prefix (#23974)
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Yordis Prieto committed
Oct 23, 2026 at 20:57 UTC
f252ed0cdde04978eb163aa9c614c3277b4a1b60
5 files changed
+22
-4
apps/server/src/config.ts
+1
-1
@@ -111,7 +111,7 @@ export const otlpResource = (
111
attributes: {
112
"service.namespace": "t3code",
113
"service.runtime": "t3-server",
114
- "service.mode": config.mode,
114
+ "t3code.server.managed_by": config.mode === "desktop" ? "desktop" : "standalone",
115
"host.name": config.otelEnvironment.resourceAttributes["host.name"] || hostName,
116
},
117
});
apps/server/src/serverLogger.test.ts
+13
@@ -152,6 +152,19 @@ const printThroughConsole = (fields: object) =>
152
});
153
154
describe("ServerLoggerLive", () => {
155
+ it.effect("exports a resource that names whether the desktop app launched the server", () =>
156
+ Effect.gen(function* () {
157
+ const { requests } = yield* logInSpanThrough({
158
+ otlpLogsUrl: "https://collector.example.com/v1/logs",
159
+ mode: "desktop",
160
+ });
161
+
162
+ const body = requests.map((request) => request.body).join("\n");
163
+ assert.include(body, '"key":"t3code.server.managed_by","value":{"stringValue":"desktop"}');
164
+ assert.notInclude(body, "service.mode");
165
+ }),
166
+ );
167
+
168
it.effect("prints a cause passed as a log field instead of collapsing it", () =>
169
Effect.gen(function* () {
170
const output = yield* printThroughConsole({
apps/web/src/observability/clientTracing.ts
+1
-1
@@ -20,7 +20,7 @@ const CLIENT_TRACING_RESOURCE = {
20
"service.namespace": "t3code",
21
"deployment.environment.name": import.meta.env.DEV ? "development" : "production",
22
"service.runtime": "t3-web",
23
- "service.mode": isElectron ? "electron" : "browser",
23
+ "t3code.client.surface": isElectron ? "desktop" : "web",
24
"service.version": APP_VERSION,
25
},
26
} as const;
docs/operations/observability.md
+5
@@ -629,6 +629,11 @@ resource attributes, such as `OTEL_RESOURCE_ATTRIBUTES=deployment.environment.na
629
The UI reports `deployment.environment.name` from its build: `development` under the Vite dev server
630
and `production` otherwise.
631
632
+Attributes specific to T3 Code use the `t3code.` prefix. The UI runs as `t3code-web` in both a
633
+browser and the desktop window, since it is the same code, and `t3code.client.surface` is `desktop`
634
+or `web`. The server's `t3code.server.managed_by` is `desktop` when the desktop app launched it and
635
+`standalone` otherwise.
636
+
637
If the OTLP URLs are unset, local tracing still works, metrics stay in-process only, and logs stay
638
on stdout only.
639
packages/shared/src/relayTracing.ts
+2
-2
@@ -173,8 +173,8 @@ export function layer(
173
attributes: {
174
"service.namespace": "t3code",
175
"service.runtime": resource.runtime,
176
- "service.component": resource.component ?? "relay-client",
177
- "t3.client.surface": resource.client,
176
+ "t3code.component": resource.component ?? "relay-client",
177
+ "t3code.client.surface": resource.client,
178
},
179
},
180
}).pipe(Layer.provide(OtlpSerialization.layerJson));