Skip to content

feat(server-ai): stamp modelKey and modelVersion on AI usage events (…#308

Open
atornsii wants to merge 1 commit into
mainfrom
atornsii/AIC-2856/net-add-model-key-version
Open

feat(server-ai): stamp modelKey and modelVersion on AI usage events (…#308
atornsii wants to merge 1 commit into
mainfrom
atornsii/AIC-2856/net-add-model-key-version

Conversation

@atornsii

@atornsii atornsii commented Jul 8, 2026

Copy link
Copy Markdown

…AIC-2856)

Read modelKey and modelVersion from the AI Config variation payload and stamp them on all LdAiConfigTracker metric event payloads alongside existing modelName/providerName fields.

  • Add ModelKey/ModelVersion to ModelConfig
  • Parse new fields from variation payload in ConfigFactory
  • Include modelVersion unconditionally (default 1) and modelKey when non-empty in track data; exclude both from resumption token
  • Additive/backward compatible — older payloads without the new fields continue to work

Part of AIC-2849. Depends on AIC-2876 (backend payload).

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

Provide a clear and concise description of what you expect to happen.

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the pull request here.


Note

Low Risk
Additive telemetry and parsing with safe defaults; no auth or breaking API changes beyond optional new track payload fields.

Overview
The server-ai SDK now reads modelKey and modelVersion from the AI Config variation’s model object and surfaces them on ModelConfig, then forwards them into LdAiConfigTracker metric payloads.

ConfigFactory parses the new fields (defaulting modelVersion to 1 when missing) and passes them when creating trackers. LdAiConfigTracker always includes modelVersion on track data and adds modelKey only when non-empty; neither field is encoded in resumption tokens, so trackers rebuilt via FromResumptionToken report modelVersion 1 and omit modelKey.

Behavior stays backward compatible for older flag payloads without these properties. Tests cover parsing, defaults, track payload shape, and resumption behavior.

Reviewed by Cursor Bugbot for commit 0bea107. Bugbot is set up for automated code reviews on this repo. Configure here.

…AIC-2856)

Read modelKey and modelVersion from the AI Config variation payload and stamp
them on all LdAiConfigTracker metric event payloads alongside existing
modelName/providerName fields.

- Add ModelKey/ModelVersion to ModelConfig
- Parse new fields from variation payload in ConfigFactory
- Include modelVersion unconditionally (default 1) and modelKey when non-empty
  in track data; exclude both from resumption token
- Additive/backward compatible — older payloads without the new fields continue
  to work

Part of AIC-2849. Depends on AIC-2876 (backend payload).

Co-authored-by: Anthony Torns II <atornsii@users.noreply.github.com>
@jsonbailey

Copy link
Copy Markdown
Contributor

Holding based on our conversation today and we will follow up on slack before reviewing.

@atornsii atornsii marked this pull request as ready for review July 9, 2026 20:32
@atornsii atornsii requested a review from a team as a code owner July 9, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants