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

Function trackExecution

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

Source from the content-addressed store, hash-verified

260 );
261
262 const trackExecution = (organizationId: string) =>
263 Effect.gen(function* () {
264 yield* Effect.annotateCurrentSpan({ "autumn.customer.id": organizationId });
265 yield* withProvisionedCustomer(
266 organizationId,
267 use((c) => c.track({ customerId: organizationId, featureId: "executions", value: 1 })),
268 ).pipe(
269 Effect.catch((error) =>
270 Effect.gen(function* () {
271 // Silent billing data loss is worth paging on: autumn.trackExecution
272 // is fire-and-forget so the caller doesn't handle it themselves.
273 yield* Effect.sync(() => {
274 console.error("[billing] track failed");
275 });
276 yield* captureCauseEffect(error);
277 yield* Effect.annotateCurrentSpan({ "autumn.track.failed": true });
278 }),
279 ),
280 );
281 }).pipe(Effect.withSpan("autumn.trackExecution"));
282
283 const setMemberSeats = (organizationId: string, seats: number) =>
284 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