Skip to content

fix: Improve usage reporting#353

Merged
jsonbailey merged 6 commits intov7from
devin/AIC-1636-1772061372-improve-usage-reporting
Feb 26, 2026
Merged

fix: Improve usage reporting#353
jsonbailey merged 6 commits intov7from
devin/AIC-1636-1772061372-improve-usage-reporting

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Feb 25, 2026

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

Describe the solution you've provided

Updates the Go AI SDK's usage tracking to align with the updated spec. Four categories of changes:

  1. Renamed usage tracking event keys to the unified $ld:ai:usage:* prefix:

    Old Key New Key
    $ld:ai:config:function:single $ld:ai:usage:completion-config
    $ld:ai:judge:function:single $ld:ai:usage:judge-config
  2. Added SDK info tracking on construction ($ld:ai:sdk:info). NewClient now fires a one-time tracking event with aiSdkName, aiSdkVersion, and aiSdkLanguage, using an anonymous context (kind ld_ai, key ld-internal-tracking). SDK metadata constants (SDKName, SDKLanguage) are defined in package_info.go alongside Version.

  3. Renamed Config method to CompletionConfig. The old Config method is preserved as a deprecated proxy to CompletionConfig.

  4. Changed usage tracking data format from a plain string to an object containing configKey, consistent with the other SDK implementations.

Note: This SDK does not currently have agent config, createChat, or createJudge methods, so only the completion-config and judge-config usage event keys needed updating.

Human review checklist

  • Verify event key strings exactly match the spec ($ld:ai:sdk:info, $ld:ai:usage:completion-config, $ld:ai:usage:judge-config)
  • Verify the anonymous context (kind ld_ai, key ld-internal-tracking) matches spec requirement 1.2.2.1
  • Confirm the SDK name "launchdarkly-go-server-sdk-ai" is correct for this package (now in package_info.go)
  • Verify that SDK info tracking firing per Client instantiation (rather than once globally) aligns with spec intent
  • Note: the deprecated Config method delegates to CompletionConfig, so it will also emit the $ld:ai:usage:completion-config tracking event — confirm this is desired behavior
  • Confirm that exporting SDKName and SDKLanguage as public constants is acceptable for the package API surface

Updates since last revision

Addressed reviewer feedback:

  • Alphabetized event key constants
  • Removed unnecessary doc comment on NewClient
  • Updated CompletionConfig and JudgeConfig doc comments with clearer descriptions
  • Moved SDK name and language into package_info.go as exported constants (SDKName, SDKLanguage)

Additional context


Note

Medium Risk
Medium risk because it changes analytics/telemetry semantics (new event keys/payloads and a new constructor-time metric) and introduces a new public API (CompletionConfig) while deprecating Config, which may affect downstream expectations around tracking and call patterns.

Overview
Updates the Go AI SDK’s metric reporting to match the latest spec by renaming usage event keys to the $ld:ai:usage:* namespace and changing the metric data payload from a raw string to an object containing configKey.

NewClient now emits a one-time $ld:ai:sdk:info metric on construction using an anonymous ld_ai context and SDK metadata (SDKName, SDKLanguage, Version).

Renames Client.Config usage to CompletionConfig (with Config kept as a deprecated delegating wrapper) and updates JudgeConfig tracking to the new judge usage event; tests are updated/added to assert the new events and payloads.

Written by Cursor Bugbot for commit 5d2ca43. This will update automatically on new commits. Configure here.


Open with Devin

- Rename usage tracking event keys to $ld:ai:usage:* prefix
  - $ld:ai:config:function:single -> $ld:ai:usage:completion-config
  - $ld:ai:judge:function:single -> $ld:ai:usage:judge-config
- Add SDK info tracking on AIClient construction ($ld:ai:sdk:info)
  with anonymous ld_ai context and SDK metadata
- Rename Config method to CompletionConfig; keep Config as deprecated proxy
- Update usage tracking data format to use object with configKey field
- Update tests for new event keys, data format, and SDK info event

Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@jsonbailey jsonbailey marked this pull request as ready for review February 26, 2026 15:19
@jsonbailey jsonbailey requested a review from a team as a code owner February 26, 2026 15:19
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@jsonbailey jsonbailey merged commit 0146f76 into v7 Feb 26, 2026
46 of 47 checks passed
@jsonbailey jsonbailey deleted the devin/AIC-1636-1772061372-improve-usage-reporting branch February 26, 2026 15:59
jsonbailey pushed a commit that referenced this pull request Feb 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.8.1](ldai/v0.8.0...ldai/v0.8.1)
(2026-02-26)


### Bug Fixes

* Improve usage reporting
([#353](#353))
([0146f76](0146f76))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants