Skip to content

Commit 888ebcf

Browse files
authored
fix(observability): desktop dev version and web environment match the other services (#75)
2 parents fdfeaa4 + 61b5e2b commit 888ebcf

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎apps/desktop/src/app/DesktopObservability.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import * as SynchronizedRef from "effect/SynchronizedRef";
2929
import * as Tracer from "effect/Tracer";
3030
import { OtlpExporter, OtlpLogger, OtlpTracer } from "effect/unstable/observability";
3131

32+
import desktopPackageJson from "../../package.json" with { type: "json" };
33+
3234
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
3335

3436
const DESKTOP_LOG_FILE_MAX_BYTES = 10 * 1024 * 1024;
@@ -628,7 +630,8 @@ const telemetryLayer = Layer.unwrap(
628630
const endpoints = yield* resolveOtlpEndpoints;
629631
const resource = {
630632
serviceName: "t3code-desktop",
631-
serviceVersion: environment.appVersion,
633+
// Unpackaged runs launch a script, so Electron reports its own version.
634+
serviceVersion: environment.isPackaged ? environment.appVersion : desktopPackageJson.version,
632635
attributes: {
633636
"service.namespace": "t3code",
634637
...nodeProcessResourceAttributes({

‎apps/web/src/observability/clientTracing.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const CLIENT_TRACING_RESOURCE = {
5050
attributes: {
5151
"service.namespace": "t3code",
5252
"service.instance.id": serviceInstanceId,
53+
"deployment.environment.name": import.meta.env.DEV ? "development" : "production",
5354
"t3code.client.surface": isElectron ? "desktop" : "web",
5455
...browserResourceAttributes(),
5556
},

‎docs/operations/observability.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,9 @@ it.
598598

599599
The UI runs as `t3code-web` in both a browser and the desktop window, since it is the same code. Its
600600
`t3code.client.surface` resource attribute is `desktop` or `web`, and `user_agent.original` carries the
601-
full user agent. The server's `t3code.server.managed_by` is `desktop` when the desktop app launched it
602-
and `standalone` otherwise.
601+
full user agent. Its `deployment.environment.name` follows the build: `development` under the Vite dev
602+
server and `production` otherwise. The server's `t3code.server.managed_by` is `desktop` when the
603+
desktop app launched it and `standalone` otherwise.
603604

604605
If the OTLP URLs are unset, local tracing still works, metrics stay in-process only, and logs stay
605606
on stdout only.

0 commit comments

Comments
 (0)