Skip to content

Commit 7f0a54c

Browse files
authored
fix: Add usage tracking to config method (#904)
1 parent 3db2700 commit 7f0a54c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/sdk/server-ai/__tests__/LDAIClientImpl.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ it('returns config with interpolated messagess', async () => {
6565
enabled: true,
6666
toVercelAISDK: expect.any(Function),
6767
});
68+
69+
// Verify tracking was called
70+
expect(mockLdClient.track).toHaveBeenCalledWith(
71+
'$ld:ai:config:function:single',
72+
testContext,
73+
key,
74+
1,
75+
);
6876
});
6977

7078
it('includes context in variables for messages interpolation', async () => {

packages/sdk/server-ai/src/LDAIClientImpl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ export class LDAIClientImpl implements LDAIClient {
146146
defaultValue: LDAIDefaults,
147147
variables?: Record<string, unknown>,
148148
): Promise<LDAIConfig> {
149+
this._ldClient.track('$ld:ai:config:function:single', context, key, 1);
150+
149151
const {
150152
tracker,
151153
enabled,

0 commit comments

Comments
 (0)