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 #3862 from jaellio/eventMetric
Browse files Browse the repository at this point in the history
feat(metrics): proxy broadcast event count
  • Loading branch information
jaellio authored Jul 29, 2021
2 parents 6122763 + 7e42e6e commit f258b86
Show file tree
Hide file tree
Showing 3 changed files with 14 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.ProxyConnectCount,
metricsstore.DefaultMetricsStore.ProxyReconnectCount,
metricsstore.DefaultMetricsStore.ProxyConfigUpdateTime,
metricsstore.DefaultMetricsStore.ProxyBroadcastEventCount,
metricsstore.DefaultMetricsStore.CertIssuedCount,
metricsstore.DefaultMetricsStore.CertIssuedTime,
)
Expand Down
3 changes: 3 additions & 0 deletions pkg/catalog/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

a "github.com/openservicemesh/osm/pkg/announcements"
"github.com/openservicemesh/osm/pkg/k8s/events"
"github.com/openservicemesh/osm/pkg/metricsstore"
)

const (
Expand Down Expand Up @@ -101,6 +102,7 @@ func (mc *MeshCatalog) dispatcher() {
events.GetPubSubInstance().Publish(events.PubSubMessage{
AnnouncementType: a.ProxyBroadcast,
})
metricsstore.DefaultMetricsStore.ProxyBroadcastEventCount.Inc()

// broadcast done, reset timer channels
broadcastScheduled = false
Expand All @@ -112,6 +114,7 @@ func (mc *MeshCatalog) dispatcher() {
events.GetPubSubInstance().Publish(events.PubSubMessage{
AnnouncementType: a.ProxyBroadcast,
})
metricsstore.DefaultMetricsStore.ProxyBroadcastEventCount.Inc()

// broadcast done, reset timer channels
broadcastScheduled = false
Expand Down
10 changes: 10 additions & 0 deletions pkg/metricsstore/metricsstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type MetricsStore struct {
// ProxyConfigUpdateTime is the histogram to track time spent for proxy configuration and its occurrences
ProxyConfigUpdateTime *prometheus.HistogramVec

// ProxyBroadcastEventCounter is the metric for the total number of ProxyBroadcast events published
ProxyBroadcastEventCount prometheus.Counter

/*
* Injector metrics
*/
Expand Down Expand Up @@ -134,6 +137,13 @@ func init() {
"success", // further labels if the operation succeeded or not
})

defaultMetricsStore.ProxyBroadcastEventCount = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: metricsRootNamespace,
Subsystem: "proxy",
Name: "broadcast_event_count",
Help: "Represents the number of ProxyBroadcast events published by the OSM controller",
})

/*
* Injector metrics
*/
Expand Down

0 comments on commit f258b86

Please sign in to comment.