Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added label for upstream cache hit status #12256

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1196,4 +1196,4 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsA
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
32 changes: 18 additions & 14 deletions internal/ingress/metric/collectors/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type socketData struct {
Latency float64 `json:"upstreamLatency"`
HeaderTime float64 `json:"upstreamHeaderTime"`
ResponseTime float64 `json:"upstreamResponseTime"`
CacheStatus string `json:"upstreamCacheStatus"`
Namespace string `json:"namespace"`
Ingress string `json:"ingress"`
Service string `json:"service"`
Expand Down Expand Up @@ -96,6 +97,7 @@ var requestTags = []string{
"ingress",
"service",
"canary",
"cacheStatus",
}

// NewSocketCollector creates a new SocketCollector instance using
Expand Down Expand Up @@ -319,23 +321,25 @@ func (sc *SocketCollector) handleMessage(msg []byte) {

// Note these must match the order in requestTags at the top
requestLabels := prometheus.Labels{
"status": stats.Status,
"method": stats.Method,
"path": stats.Path,
"namespace": stats.Namespace,
"ingress": stats.Ingress,
"service": stats.Service,
"canary": stats.Canary,
"status": stats.Status,
"method": stats.Method,
"path": stats.Path,
"namespace": stats.Namespace,
"ingress": stats.Ingress,
"service": stats.Service,
"canary": stats.Canary,
"cacheStatus": stats.CacheStatus,
}

collectorLabels := prometheus.Labels{
"namespace": stats.Namespace,
"ingress": stats.Ingress,
"status": stats.Status,
"service": stats.Service,
"canary": stats.Canary,
"method": stats.Method,
"path": stats.Path,
"namespace": stats.Namespace,
"ingress": stats.Ingress,
"status": stats.Status,
"service": stats.Service,
"canary": stats.Canary,
"method": stats.Method,
"path": stats.Path,
"cacheStatus": stats.CacheStatus,
}
if sc.metricsPerHost {
requestLabels["host"] = stats.Host
Expand Down
Loading
Loading