Skip to content

Populate provider token telemetry#446

Merged
wow-miley merged 1 commit intomainfrom
email/ampr-141-ampere-populate-tokenusage-telemetry-on
Mar 1, 2026
Merged

Populate provider token telemetry#446
wow-miley merged 1 commit intomainfrom
email/ampr-141-ampere-populate-tokenusage-telemetry-on

Conversation

@wow-miley
Copy link
Contributor

Summary

  • populate ProviderCallCompletedEvent.usage from real provider response metadata via TokenUsageExtractor
  • expose typed EventService.routingEvents() and EventService.completionEvents() flows and show token/cost telemetry in event summaries
  • make kotlinConfiguration a dependency of Kotlin compile tasks so ./gradlew jvmTest works from a clean checkout

Testing

  • ./gradlew --no-daemon jvmTest
  • ./gradlew --no-daemon ktlintFormat (fails on pre-existing repo issues in ampere-core/src/androidMain/kotlin/link/socket/ampere/agents/tools/mcp/connection/HttpMcpConnection.android.kt, ampere-core/src/androidMain/kotlin/link/socket/ampere/agents/tools/mcp/connection/StdioMcpConnection.android.kt, and ampere-desktop/src/jvmMain/kotlin/link/socket/ampere/Main.kt)

Issue Note

GitHub issue #440 describes SimpleLlmRelay, RoutingLlmRelay, ProviderRoutedEvent, and ProviderFallbackEvent, but those are not the active code paths on the current branch. In main, provider completion telemetry is emitted from AgentLLMService, routing events are RoutingEvent.RouteSelected / RoutingEvent.RouteFallback, and EventService.observe() already carries them publicly. This PR implements the issue intent against the current architecture rather than adding obsolete relay classes.

@wow-miley wow-miley force-pushed the email/ampr-141-ampere-populate-tokenusage-telemetry-on branch from 6feadf5 to 452a8dd Compare March 1, 2026 18:06
@wow-miley wow-miley merged commit 9b1a770 into main Mar 1, 2026
2 checks passed
@wow-miley wow-miley deleted the email/ampr-141-ampere-populate-tokenusage-telemetry-on branch March 1, 2026 18:10
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.

1 participant