nic-6443 commented on code in PR #13088:
URL: https://github.com/apache/apisix/pull/13088#discussion_r2944861214
##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -355,24 +355,26 @@ function _M.http_log(conf, ctx)
vars.request_type, vars.request_llm_model, vars.llm_model,
unpack(bandwidth_extra_label_values)))
- local llm_time_to_first_token = vars.llm_time_to_first_token
- if llm_time_to_first_token ~= "" then
- metrics.llm_latency:observe(tonumber(llm_time_to_first_token),
- gen_arr(route_id, service_id, consumer_name, balancer_ip,
- vars.request_type, vars.request_llm_model, vars.llm_model,
- unpack(extra_labels("llm_latency", ctx))))
- end
- if vars.llm_prompt_tokens ~= "" then
- metrics.llm_prompt_tokens:inc(tonumber(vars.llm_prompt_tokens),
- gen_arr(route_id, service_id, consumer_name, balancer_ip,
- vars.request_type, vars.request_llm_model, vars.llm_model,
- unpack(extra_labels("llm_prompt_tokens", ctx))))
- end
- if vars.llm_completion_tokens ~= "" then
- metrics.llm_completion_tokens:inc(tonumber(vars.llm_completion_tokens),
- gen_arr(route_id, service_id, consumer_name, balancer_ip,
- vars.request_type, vars.request_llm_model, vars.llm_model,
- unpack(extra_labels("llm_completion_tokens", ctx))))
+ if vars.request_type == "ai_stream" or vars.request_type == "ai_chat" then
+ local llm_time_to_first_token = vars.llm_time_to_first_token
+ if llm_time_to_first_token ~= "" then
Review Comment:
It seems that these judgments about token variables are incorrect; they will
never be equal to an empty string:
https://github.com/apache/apisix/blob/4990927937280037602e81bb1b9554a784afa076/apisix/cli/ngx_tpl.lua#L816-L819
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]