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/11 02:55:05 UTC

[GitHub] [apisix] gxthrj opened a new issue #2042: feat: We can add the hostname field to prometheus

gxthrj opened a new issue #2042:
URL: https://github.com/apache/apisix/issues/2042


   ### Issue description
   We can add the hostname field to prometheus
   
   ### Environment
   
   * apisix version 1.5:
   * OS:
   
   By way of environment variables, We can get the host name through the environment variable `HOSTNAME` in k8s.
   
   
   1. need to modify apisix script, add export `env HOSTNAME;` in https://github.com/apache/apisix/blob/master/bin/apisix;
   
   2. get hostname for env in the plugin named prometheus (https://github.com/apache/apisix/blob/master/apisix/plugins/prometheus/exporter.lua);


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



[GitHub] [apisix] nic-chen commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [apisix] Gerrard-YNWA edited a comment on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA edited a comment on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766719348






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



[GitHub] [apisix] membphis commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766926441


   it seems that we can close this issue, all right?


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



[GitHub] [apisix] nic-chen edited a comment on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen edited a comment on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-671794289


   we could get hostname from `vars`. but prometheus can store only numbers as value.


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



[GitHub] [apisix] nic-chen commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-671794289


   we could get host from `vars`. but prometheus can store only numbers as value.


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



[GitHub] [apisix] nic-chen commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766833550






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



[GitHub] [apisix] Gerrard-YNWA edited a comment on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA edited a comment on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-767208257


   @nic-chen Since no extra host label for each metric's output, is there a way we can merge the two separate metrics like: `apisix_nginx_http_current_connections{state="active"} 100` and `apisix_node_info{hostname="apisix-deployment-588bc684bb-zmz2q"} 1` into one `apisix_nginx_http_current_connections{state="active", hostname="apisix-deployment-588bc684bb-zmz2q"} 100` via `promsql` ?


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



[GitHub] [apisix] nic-chen closed issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen closed issue #2042:
URL: https://github.com/apache/apisix/issues/2042


   


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



[GitHub] [apisix] Gerrard-YNWA edited a comment on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA edited a comment on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-767208257


   @nic-chen Since no extra host label for each metric's output, is there a way we can merge the two separate metrics like: `apisix_nginx_http_current_connections{state="active"} 100` and `apisix_node_info{hostname="apisix-deployment-588bc684bb-zmz2q"} 1` into one `apisix_nginx_http_current_connections{state="active", hostname="apisix-deployment-588bc684bb-zmz2q"} 100` via `promql` ?


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



[GitHub] [apisix] gxthrj commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [apisix] tokers commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766735360


   @nic-chen @gxthrj 
   


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



[GitHub] [apisix] tokers commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766735360


   @nic-chen @gxthrj 
   


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



[GitHub] [apisix] Gerrard-YNWA commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-767208257


   @nic-chen Since no extra host label for each metric's output, is there a way we can merge the two separate metric like: `apisix_nginx_http_current_connections{state="active"} 100` and `apisix_node_info{hostname="apisix-deployment-588bc684bb-zmz2q"} 1` into one `apisix_nginx_http_current_connections{state="active", hostname="apisix-deployment-588bc684bb-zmz2q"} 100` via `promsql` ?


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



[GitHub] [apisix] nic-chen closed issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen closed issue #2042:
URL: https://github.com/apache/apisix/issues/2042


   


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



[GitHub] [apisix] Gerrard-YNWA edited a comment on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA edited a comment on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766719348


   > > 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)
   > ...
   > ```
   
   Hello, any progress in this issue?  
   We have a similar requirement for collecting different apisix instance's metrics in a separate grafana panel, like `apisix_nginx_http_current_connections`.
   However, metrics from the `/apisix/prometheus/metrics` outputs without any label about instance infomation, which is quite inconvenient to find the data comes from which instance.
   If `apisix` can add a label like `host_name` to every metrics, I think it will be helpful.


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



[GitHub] [apisix] Gerrard-YNWA commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766719348






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



[GitHub] [apisix] nic-chen commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766935285


   > it seems that we can close this issue, all right?
   
   sure


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



[GitHub] [apisix] Gerrard-YNWA commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
Gerrard-YNWA commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766719348


   > > 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)
   > ...
   > ```
   
   Hello, any progress in this issue?  
   We have a similar  for collecting different apisix instance's metrics in a separate grafana panel, like `apisix_nginx_http_current_connections`.
   However, metrics from the `/apisix/prometheus/metrics` outputs without any label about instance infomation, which is quite inconvenient to find the data comes from which instance.
   If `apisix` can add a label like `host_name` to every metrics, I think it will be helpful.


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



[GitHub] [apisix] membphis commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766926441


   it seems that we can close this issue, all right?


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



[GitHub] [apisix] nic-chen commented on issue #2042: feat: We can add the hostname field to prometheus

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2042:
URL: https://github.com/apache/apisix/issues/2042#issuecomment-766833550


   @Gerrard-YNWA  we have supported hostname in metrics like 
   `apisix_node_info{hostname="apisix-deployment-588bc684bb-zmz2q"} 1`
   
   not  label for each metrics
   


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