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

Function trackExecution

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

Source from the content-addressed store, hash-verified

149 );
150
151 const trackExecution = (organizationId: string) =>
152 Effect.gen(function* () {
153 yield* Effect.annotateCurrentSpan({ "autumn.customer.id": organizationId });
154 yield* withProvisionedCustomer(
155 organizationId,
156 use((c) => c.track({ customerId: organizationId, featureId: "executions", value: 1 })),
157 ).pipe(
158 Effect.catch((error) =>
159 Effect.gen(function* () {
160 // Silent billing data loss is worth paging on: autumn.trackExecution
161 // is fire-and-forget so the caller doesn't handle it themselves.
162 yield* Effect.sync(() => {
163 console.error("[billing] track failed:", error);
164 });
165 yield* captureCauseEffect(error);
166 yield* Effect.annotateCurrentSpan({ "autumn.track.failed": true });
167 }),
168 ),
169 );
170 }).pipe(Effect.withSpan("autumn.trackExecution"));
171
172 const checkExecutionBalance = (organizationId: string) =>
173 Effect.gen(function* () {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected