MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / trackExecution

Function trackExecution

apps/cloud/src/extensions/billing/service.ts:68–86  ·  view source on GitHub ↗
(organizationId: string)

Source from the content-addressed store, hash-verified

66 }).pipe(Effect.withSpan(`autumn.${fn.name ?? "use"}`));
67
68 const trackExecution = (organizationId: string) =>
69 Effect.gen(function* () {
70 yield* Effect.annotateCurrentSpan({ "autumn.customer.id": organizationId });
71 yield* use((c) =>
72 c.track({ customerId: organizationId, featureId: "executions", value: 1 }),
73 ).pipe(
74 Effect.catchTag("AutumnError", (error) =>
75 Effect.gen(function* () {
76 // Silent billing data loss is worth paging on: autumn.trackExecution
77 // is fire-and-forget so the caller doesn't handle it themselves.
78 yield* Effect.sync(() => {
79 console.error("[billing] track failed:", error);
80 });
81 yield* captureCauseEffect(error);
82 yield* Effect.annotateCurrentSpan({ "autumn.track.failed": true });
83 }),
84 ),
85 );
86 }).pipe(Effect.withSpan("autumn.trackExecution"));
87
88 const checkExecutionBalance = (organizationId: string) =>
89 Effect.gen(function* () {

Callers

nothing calls this directly

Calls 4

captureCauseEffectFunction · 0.90
errorMethod · 0.80
useFunction · 0.70
syncMethod · 0.65

Tested by

no test coverage detected