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 25, 07:30 UTC
[codex] migrate Effect.fn in apps/server/src/telemetry/Layers/AnalyticsService.ts (#1642)
Co-authored-by: codex <codex@users.noreply.github.com>
Julius Marminge committed
Apr 1, 2026 at 08:53 UTC
ddffdfc0957315b422ae7bc092d4c2145866d3a2
1 file changed
+29
-28
apps/server/src/telemetry/Layers/AnalyticsService.ts
+29
-28
@@ -70,34 +70,35 @@ const makeAnalyticsService = Effect.gen(function* () {
70
}),
71
);
72
73
- const sendBatch = (events: ReadonlyArray<BufferedAnalyticsEvent>) =>
74
- Effect.gen(function* () {
75
- if (!telemetryConfig.enabled || !identifier) return;
76
-
77
- const payload = {
78
- api_key: telemetryConfig.posthogKey,
79
- batch: events.map((event) => ({
80
- event: event.event,
81
- distinct_id: identifier,
82
- properties: {
83
- ...event.properties,
84
- $process_person_profile: false,
85
- platform: process.platform,
86
- wsl: process.env.WSL_DISTRO_NAME,
87
- arch: process.arch,
88
- t3CodeVersion: version,
89
- clientType,
90
- },
91
- timestamp: event.capturedAt,
92
- })),
93
- };
94
-
95
- yield* HttpClientRequest.post(`${telemetryConfig.posthogHost}/batch/`).pipe(
96
- HttpClientRequest.bodyJson(payload),
97
- Effect.flatMap(httpClient.execute),
98
- Effect.flatMap(HttpClientResponse.filterStatusOk),
99
- );
100
- });
73
+ const sendBatch = Effect.fn("sendBatch")(function* (
74
+ events: ReadonlyArray<BufferedAnalyticsEvent>,
75
+ ) {
76
+ if (!telemetryConfig.enabled || !identifier) return;
77
+
78
+ const payload = {
79
+ api_key: telemetryConfig.posthogKey,
80
+ batch: events.map((event) => ({
81
+ event: event.event,
82
+ distinct_id: identifier,
83
+ properties: {
84
+ ...event.properties,
85
+ $process_person_profile: false,
86
+ platform: process.platform,
87
+ wsl: process.env.WSL_DISTRO_NAME,
88
+ arch: process.arch,
89
+ t3CodeVersion: version,
90
+ clientType,
91
+ },
92
+ timestamp: event.capturedAt,
93
+ })),
94
+ };
95
+
96
+ yield* HttpClientRequest.post(`${telemetryConfig.posthogHost}/batch/`).pipe(
97
+ HttpClientRequest.bodyJson(payload),
98
+ Effect.flatMap(httpClient.execute),
99
+ Effect.flatMap(HttpClientResponse.filterStatusOk),
100
+ );
101
+ });
102
103
const flush: AnalyticsServiceShape["flush"] = Effect.gen(function* () {
104
while (true) {