jiasanshou opened a new issue, #8065:
URL: https://github.com/apache/apisix/issues/8065

   ### Current Behavior
   
   Method "batch_process:push" in batch-processor.lua report error: attempt to 
index a nil value.
   ` if prometheus and not batch_metrics and self.name
          and self.route_id and self.server_addr then
           batch_metrics = 
prometheus.get_prometheus():gauge("batch_process_entries",
                                                             "batch process 
remaining entries",
                                                             {"name", 
"route_id", "server_addr"})
       end`
   the code determine prometheus but not  prometheus.get_prometheus() .
   
   ### Expected Behavior
   
   In the version 2.12, the code is different and it works.
   `if not batch_metrics and prometheus.get_prometheus() and self.name
          and self.route_id and self.server_addr then
           batch_metrics = 
prometheus.get_prometheus():gauge("batch_process_entries",
                                                             "batch process 
remaining entries",
                                                             {"name", 
"route_id", "server_addr"})
       end`
   The code use if not batch_metrics and **prometheus.get_prometheus()** , so 
it works well.
   
   ### Error Logs
   
   2022/10/10 19:07:52 [error] 15074#0: *1109498 failed to run log_by_lua*: 
.../software/apisix-2.15.0/apisix/utils/batch-processor.lua:189: attempt to 
index a nil value
   stack traceback:
           .../software/apisix-2.15.0/apisix/utils/batch-processor.lua:189: in 
function 'push'
           ...e/apisix-2.15.0/apisix/utils/batch-processor-manager.lua:121: in 
function 'add_entry_to_new_processor'
   
   ### Steps to Reproduce
   
   1.Run apisix in docker without promethus.
   2.config a route with kafka-logger
   3.fire a request, get the error.
   
   ### Environment
   
   - APISIX version 2.15 (run `apisix version`):
   - Operating system linux (run `uname -a`):
   
   


-- 
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]

Reply via email to