Skip to content

fix: Improve usage reporting#228

Merged
jsonbailey merged 6 commits intomainfrom
devin/AIC-1636-1771885282-improve-usage-reporting
Feb 25, 2026
Merged

fix: Improve usage reporting#228
jsonbailey merged 6 commits intomainfrom
devin/AIC-1636-1771885282-improve-usage-reporting

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Feb 23, 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 .NET AI SDK's usage tracking to align with the updated spec. Key changes:

  1. Renamed usage tracking event key from $ld:ai:config:function:single to $ld:ai:usage:completion-config, following the new $ld:ai:usage:* naming convention from the spec.

  2. Added SDK info tracking on initialization ($ld:ai:sdk:info). When LdAiClient is constructed, it fires a tracking event with aiSdkName, aiSdkVersion, and aiSdkLanguage using an anonymous context (kind ld_ai, key ld-internal-tracking). SDK metadata lives in a new SdkInfo static class (SdkInfo.cs) for reuse across the package.

  3. Renamed Config method to CompletionConfig on both ILdAiClient and LdAiClient. The old Config method is preserved but marked [Obsolete] and proxies to CompletionConfig.

  4. Separated usage tracking from config evaluation. Following the pattern in the JS implementation, CompletionConfig (public) handles usage tracking and delegates to a private Evaluate method for the actual config retrieval. This prevents double-counting if higher-level entry methods (e.g. createChat) are added in the future.

  5. Added SdkInfo.cs to release-please-config.json extra-files so that the SdkInfo.Version constant is automatically bumped on release (flagged by Bugbot).

  6. Updated XML doc comments to use "AI Completion Config" wording consistently across ILdAiClient.cs and LdAiClient.cs (per reviewer feedback).

Note: The .NET SDK does not currently have agent, judge, createChat, or createJudge methods, so only the single completion-config usage event key needed updating.

Human review checklist

  • Verify event key strings ($ld:ai:sdk:info, $ld:ai:usage:completion-config) exactly match the spec
  • Verify the anonymous context (kind ld_ai, key ld-internal-tracking) matches spec requirement 1.2.2.1
  • Confirm SdkInfo.Version = "0.9.1" matches the current version in LaunchDarkly.ServerSdk.Ai.csproj and that the x-release-please-version annotation in SdkInfo.cs will be picked up correctly now that it's in extra-files
  • Confirm the breaking ILdAiClient interface change (adding CompletionConfig) is acceptable for a pre-release SDK
  • Verify that SDK info tracking firing per LdAiClient 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

Additional context


Note

Medium Risk
Introduces an interface/API rename (with obsolete shim) and changes analytics event emission, which can affect downstream callers and telemetry volume/semantics.

Overview
Updates the .NET AI SDK's telemetry to match the latest spec: LdAiClient now emits $ld:ai:usage:completion-config when retrieving a config, and fires a one-time-per-instance $ld:ai:sdk:info event on construction containing SDK name/version/language.

Renames the public API from Config to CompletionConfig on ILdAiClient/LdAiClient, keeps Config as an [Obsolete] shim, and factors config retrieval into a private Evaluate method so future entry points can track usage without double-counting.

Adds SdkInfo (and includes it in release-please-config.json extra-files) and updates tests to use CompletionConfig plus new assertions for the tracking events.

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

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

@devin-ai-integration devin-ai-integration bot added the devin-pr PR was created by Devin AI label Feb 23, 2026
@jsonbailey jsonbailey marked this pull request as ready for review February 25, 2026 21:09
@jsonbailey jsonbailey requested a review from a team as a code owner February 25, 2026 21:09
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Copy link
Member

Choose a reason for hiding this comment

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

Does the wording here need to change to match the naming? LaunchDarkly AI Completion Config or something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good call — updated the doc comments in both ILdAiClient.cs and LdAiClient.cs to use "AI Completion Config" naming consistently (summary, param descriptions, and return value docs). See 11e992f.

@jsonbailey jsonbailey merged commit 376b6b0 into main Feb 25, 2026
17 checks passed
@jsonbailey jsonbailey deleted the devin/AIC-1636-1771885282-improve-usage-reporting branch February 25, 2026 23:09
jsonbailey pushed a commit that referenced this pull request Feb 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.9.2](LaunchDarkly.ServerSdk.Ai-v0.9.1...LaunchDarkly.ServerSdk.Ai-v0.9.2)
(2026-02-25)


### Bug Fixes

* Improve usage reporting
([#228](#228))
([376b6b0](376b6b0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Release/version-metadata-only changes; no functional code paths are
modified beyond the reported version string and changelog.
> 
> **Overview**
> Bumps `LaunchDarkly.ServerSdk.Ai` from `0.9.1` to `0.9.2` across
release metadata (`.release-please-manifest.json`), package versioning
(`LaunchDarkly.ServerSdk.Ai.csproj`), and runtime-reported version
constants (`SdkInfo.Version`).
> 
> Updates `pkgs/sdk/server-ai/CHANGELOG.md` with the `0.9.2` release
entry, noting a bug fix to *improve usage reporting*.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
669f538. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devin-pr PR was created by Devin AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants