Remove prometheus labels with high cardinality

This commit is contained in:
Manuel de Brito Fontes 2018-06-25 09:22:28 -04:00 committed by Manuel Alejandro de Brito Fontes
parent c0ed143fbd
commit 6c8647a27d
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
3 changed files with 8 additions and 27 deletions

View file

@ -30,15 +30,10 @@ type socketData struct {
Host string `json:"host"` // Label
Status string `json:"status"` // Label
RealIPAddress string `json:"realIpAddr"` // Label
RemoteAddress string `json:"remoteAddr"` // Label
RemoteUser string `json:"remoteUser"` // Label
BytesSent float64 `json:"bytesSent"` // Metric
Protocol string `json:"protocol"` // Label
Method string `json:"method"` // Label
URI string `json:"uri"` // Label
RequestLength float64 `json:"requestLength"` // Metric
RequestTime float64 `json:"requestTime"` // Metric
@ -51,6 +46,7 @@ type socketData struct {
Namespace string `json:"namespace"` // Label
Ingress string `json:"ingress"` // Label
Service string `json:"service"` // Label
Path string `json:"path"` // Label
}
// SocketCollector stores prometheus metrics and ingress meta-data
@ -82,7 +78,7 @@ func NewInstance(ns string, class string) error {
sc.ns = ns
sc.ingressClass = class
requestTags := []string{"host", "status", "remote_address", "real_ip_address", "remote_user", "protocol", "method", "uri", "upstream_name", "upstream_ip", "upstream_status", "namespace", "ingress", "service"}
requestTags := []string{"host", "status", "protocol", "method", "path", "upstream_name", "upstream_ip", "upstream_status", "namespace", "ingress", "service"}
collectorTags := []string{"namespace", "ingress_class"}
sc.upstreamResponseTime = prometheus.NewHistogramVec(
@ -181,12 +177,9 @@ func (sc *SocketCollector) handleMessage(msg []byte) {
requestLabels := prometheus.Labels{
"host": stats.Host,
"status": stats.Status,
"remote_address": stats.RemoteAddress,
"real_ip_address": stats.RealIPAddress,
"remote_user": stats.RemoteUser,
"protocol": stats.Protocol,
"method": stats.Method,
"uri": stats.URI,
"path": stats.Path,
"upstream_name": stats.UpstreamName,
"upstream_ip": stats.UpstreamIP,
"upstream_status": stats.UpstreamStatus,