You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/08/12 05:56:18 UTC
[GitHub] [apisix] gxthrj commented on issue #2042: feat: We can add the hostname field to prometheus
gxthrj commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-672622252
> 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)
...
```
----------------------------------------------------------------
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:
users@infra.apache.org