Skip to content

Commit c2a9fb6

Browse files
committed
Create a startup time metric
1 parent eb0edda commit c2a9fb6

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

pkg/driver/driver.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ type Option func(*NetworkDriver)
106106

107107
func Start(ctx context.Context, driverName string, kubeClient kubernetes.Interface, nodeName string, opts ...Option) (*NetworkDriver, error) {
108108
registerMetrics()
109+
begin := time.Now()
110+
defer func() {
111+
startupTime.Set(time.Since(begin).Seconds())
112+
}()
109113

110114
rdmaNetnsMode, err := nlwrap.RdmaSystemGetNetnsMode()
111115
if err != nil {

pkg/driver/metrics.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,10 @@ var (
8787
Name: "last_published_time_seconds",
8888
Help: "The timestamp of the last successful resource publication.",
8989
})
90+
startupTime = prometheus.NewGauge(prometheus.GaugeOpts{
91+
Namespace: "dranet",
92+
Subsystem: "driver",
93+
Name: "startup_time_seconds",
94+
Help: "The timestamp of the driver startup.",
95+
})
9096
)

0 commit comments

Comments
 (0)