Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3844 from nshankar13/add_metric_proxy_reconnect
Browse files Browse the repository at this point in the history
feat(metrics): proxy reconnect count
  • Loading branch information
nshankar13 authored Jul 26, 2021
2 parents 53e8bc3 + 6fb139f commit 8a80bd2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/osm-controller/osm-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func startMetricsStore() {
metricsstore.DefaultMetricsStore.K8sMeshPodCount,
metricsstore.DefaultMetricsStore.K8sMeshServiceCount,
metricsstore.DefaultMetricsStore.ProxyConnectCount,
metricsstore.DefaultMetricsStore.ProxyReconnectCount,
metricsstore.DefaultMetricsStore.ProxyConfigUpdateTime,
metricsstore.DefaultMetricsStore.CertIssuedCount,
metricsstore.DefaultMetricsStore.CertIssuedTime,
Expand Down
1 change: 1 addition & 0 deletions pkg/envoy/ads/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func respondToRequest(proxy *envoy.Proxy, discoveryRequest *xds_discovery.Discov
proxy.String(), typeURL.Short(), requestNonce, requestVersion)
proxy.SetLastSentVersion(typeURL, requestVersion)
proxy.SetLastAppliedVersion(typeURL, requestVersion)
metricsstore.DefaultMetricsStore.ProxyReconnectCount.Inc()
return true
}

Expand Down
10 changes: 10 additions & 0 deletions pkg/metricsstore/metricsstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type MetricsStore struct {
// ProxyConnectCount is the metric for the total number of proxies connected to the controller
ProxyConnectCount prometheus.Gauge

// ProxyReconnectCount is the metric for the total reconnects from known proxies to the controller
ProxyReconnectCount prometheus.Counter

// ProxyConfigUpdateTime is the histogram to track time spent for proxy configuration and its occurrences
ProxyConfigUpdateTime *prometheus.HistogramVec

Expand Down Expand Up @@ -111,6 +114,13 @@ func init() {
Help: "represents the number of proxies connected to OSM controller",
})

defaultMetricsStore.ProxyReconnectCount = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: metricsRootNamespace,
Subsystem: "proxy",
Name: "reconnect_count",
Help: "represents the number of reconnects from known proxies to OSM controller",
})

defaultMetricsStore.ProxyConfigUpdateTime = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricsRootNamespace,
Expand Down

0 comments on commit 8a80bd2

Please sign in to comment.