Add GatewaySyncer metrics
@@ -7,8 +7,10 @@ import (
"sync"
"time"
+ "github.com/prometheus/client_golang/prometheus"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog"
@@ -16,7 +18,6 @@ import (
v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1"
"github.com/submariner-io/submariner/pkg/cableengine"
v1typed "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1"
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
type GatewaySyncer struct {
@@ -30,8 +31,17 @@ type GatewaySyncer struct {
var GatewayUpdateInterval = 5 * time.Second
var GatewayStaleTimeout = GatewayUpdateInterval * 3
+var gatewaySyncIterations = prometheus.NewCounter(prometheus.CounterOpts{
+ Name: "gateway_sync_iterations",
+ Help: "Gateway synchronization iterations",
+})
+
const updateTimestampAnnotation = "update-timestamp"
+func init() {
+ prometheus.MustRegister(gatewaySyncIterations)
+}
+
// NewEngine creates a new Engine for the local cluster
func NewGatewaySyncer(engine cableengine.Engine, client v1typed.GatewayInterface,
version string) *GatewaySyncer {
@@ -68,6 +78,7 @@ func (i *GatewaySyncer) SetGatewayStatusError(err error) {
func (i *GatewaySyncer) syncGatewayStatusSafe() {
klog.V(log.TRACE).Info("Running Gateway status sync")
+ gatewaySyncIterations.Inc()
gatewayObj := i.generateGatewayObject()
