Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ export const additionalCallbacks = async (nodeData: INodeData, options: ICommonO
metadata: metadata,
userId: options?.user?.id,
sessionId: options.sessionId,
tags: [`Name:${chatflow.name}`],
tags: [`Name:${chatflow.name}`, 'billing:pending'],
version: chatflow.updatedDate
// TODO: This is still causing an error
// This works to keep the root trace name and have everything else update on the root trace
Expand All @@ -691,7 +691,7 @@ export const additionalCallbacks = async (nodeData: INodeData, options: ICommonO
try {
if (parentLangfuseTrace) {
parentLangfuseTrace.update({
tags: [`Name:${chatflow.name}`],
tags: [`Name:${chatflow.name}`, 'billing:pending'],
metadata,
userId: options?.user?.id,
sessionId: options.sessionId,
Expand Down
13 changes: 13 additions & 0 deletions packages/server/src/aai-utils/billing/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ export const BILLING_CONFIG = {
BATCH_DELAY_MS: 1000
},

// Sync configuration
SYNC: {
LOOKBACK_DAYS: parseInt(process.env.BILLING_SYNC_LOOKBACK_DAYS || '90'),
PAGE_BATCH_SIZE: 15, // Number of pages to fetch in parallel
RATE_LIMIT_DELAY_MS: 1000, // Delay between page batches
// Enable tag-based filtering (requires backfill)
// WARNING: Only enable after backfill is complete AND you have a mechanism to tag new traces
// When enabled, only fetches traces with 'billing:pending' tag
// New traces created after backfill won't have tags and will be MISSED
// Options: (1) Run backfill periodically, (2) Tag new traces on creation, or (3) Keep disabled
USE_TAG_FILTERING: process.env.BILLING_USE_TAG_FILTERING === 'true'
},

// Resource configuration
AI_TOKENS: {
TOKENS_PER_CREDIT: 10, // 1,000 tokens = 100 Credits
Expand Down
Loading
Loading