Skip to content

Commit c7d2706

Browse files
committed
A few comments
1 parent 9e2b578 commit c7d2706

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

apps/webapp/app/v3/eventRepository/clickhouseEventRepository.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,11 @@ export class ClickhouseEventRepository implements IEventRepository {
13791379
}
13801380
}
13811381

1382+
// Parse attributes from the first record that has them, then re-parse for the
1383+
// completed SPAN record. The completed record's attributes are a superset of the
1384+
// partial's (includes enriched trigger.llm.* cost data added during ingestion).
1385+
// This means at most 2x JSON.parse per span detail query, but only on this
1386+
// read path (span detail view), not on ingestion.
13821387
if (typeof record.attributes_text === "string") {
13831388
const shouldUpdate =
13841389
span.properties == null ||

internal-packages/llm-pricing/src/registry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ function compilePattern(pattern: string): RegExp {
2222
export class ModelPricingRegistry {
2323
private _prisma: PrismaClient | PrismaReplicaClient;
2424
private _patterns: CompiledPattern[] = [];
25+
// TODO: When we add project-based models (users adding their own), this cache grows unbounded
26+
// between reloads. Fine-tuned model IDs (e.g. "ft:gpt-3.5-turbo:org:name:id") create unique
27+
// entries per model string. Consider adding an LRU cap or size limit at that point.
2528
private _exactMatchCache: Map<string, LlmModelWithPricing | null> = new Map();
2629
private _loaded = false;
2730
private _readyResolve!: () => void;

0 commit comments

Comments
 (0)