wklken commented on issue #11352:
URL: https://github.com/apache/apisix/issues/11352#issuecomment-2421648458

   just do it in the plugin:
   
   ```lua
   local exporter = require("apisix.plugins.prometheus.exporter")
   
   local metric_api_requests_total
   
   function _M.init()
       prometheus_registry = exporter.get_prometheus()
   
       -- registers  metrics.
       metric_api_requests_total = prometheus_registry:counter(
           "api_requests_total",
           "How many HTTP requests processed, partitioned by status code, 
method and HTTP path.", {
               "label1",
               "label2",
               ......
           }
       )
   end
   
   
   function _M.log(conf, ctx)
       metric_api_requests_total:inc(
           1, {
               label_value_1,
               label_value_2,
               ......
           }
       )
   end
   
   ```


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