Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(observability): honor the standard OTEL_* environment variables #12621

Closedyordis(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/12621/headopened View on GitHub

Showing 12 changed files with 166 additions and 17 deletions (loading 10).

x
0 of 12 viewed, 12 left
114 additions and 0 deletionsapps/desktop/src/backend/DesktopBackendConfiguration.test.tsModified
View file
@@ -989,6 +989,116 @@
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
​
+ it.effect("resolveWsl forwards the standard OTEL variables into the distro", () =>
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const baseDir = yield* fileSystem.makeTempDirectoryScoped({
+ prefix: "t3-desktop-backend-config-test-",
+ });
+​
+ const previousWslEnv = process.env.WSLENV;
+ const previousEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
+ const previousHeaders = process.env.OTEL_EXPORTER_OTLP_HEADERS;
+ const previousTemporality = process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE;
+ try {
+ // The bootstrap carries the resolved URLs but nothing else these
+ // variables say, and it is the lowest-priority source. Without the
+ // names crossing too, a Windows machine would reach the collector
+ // inside the distro unauthenticated, in the wrong wire format, and
+ // with an aggregation the receiver drops.
+ delete process.env.WSLENV;
+ process.env.OTEL_EXPORTER_OTLP_ENDPOINT = "https://collector.example.com";
+ process.env.OTEL_EXPORTER_OTLP_HEADERS = "authorization=Bearer%20ambient";
+ process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = "delta";
+​
+ yield* Effect.gen(function* () {
+ const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
+ const config = yield* configuration.resolveWsl({ port: 5050, distro: null });
+​