Skip to content

Commit

Permalink
feat(ai-proxy): add telemetry for ai-proxy (#12492)
Browse files Browse the repository at this point in the history
(cherry picked from commit 00211cb)
  • Loading branch information
tysoekong authored and github-actions[bot] committed Feb 1, 2024
1 parent 0ec6a36 commit 95638ab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/add-ai-proxy-telemetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: Adds telemetry collection for AI Proxy, AI Request Transformer, and AI Response Transformer, pertaining to model and provider usage.
type: feature
scope: Core
21 changes: 21 additions & 0 deletions kong/api/routes/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ local function reports_timer(premature, data)
r_data.e = "c"
end

if data.name == "ai-proxy" then
r_data.config = {
llm = {
model = {}
}
}

r_data.config.llm.model.name = data.config.model.name
r_data.config.llm.model.provider = data.config.model.provider

elseif data.name == "ai-request-transformer" or data.name == "ai-response-transformer" then
r_data.config = {
llm = {
model = {}
}
}

r_data.config.llm.model.name = data.config.llm.model.name
r_data.config.llm.model.provider = data.config.llm.model.provider
end

reports.send("api", r_data)
end

Expand Down

0 comments on commit 95638ab

Please sign in to comment.