nic-chen commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-673240125
> > we could get hostname from `vars`. but prometheus can store only numbers
as value.
>
> hi, @nic-chen
> I don’t quite understand what you said `prometheus can store only numbers
as value`
> But we can add a label named host for each metric, such as this
>
> ```lua
> -- Take metrics.status as an example
> ...
> metrics.status = prometheus:counter("http_status",
> "HTTP status codes per service in APISIX",
> {"code", "service", "node", "host"})
> ...
> metrics.status:inc(1, vars.status, service_name, balancer_ip, host_name)
> ...
> ```
good idea
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]