(organizationId: string)
| 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* () { |
nothing calls this directly
no test coverage detected