diff --git a/server/metrics/metrics.go b/server/metrics/metrics.go index 5d6528c2d..effd210a7 100644 --- a/server/metrics/metrics.go +++ b/server/metrics/metrics.go @@ -7,6 +7,7 @@ import ( const ( MetricsNamespace = "msteams_connect" + MetricsSubsystemSystem = "system" MetricsSubsystemApp = "app" MetricsSubsystemHTTP = "http" MetricsSubsystemAPI = "api" @@ -23,6 +24,8 @@ type InstanceInfo struct { type Metrics struct { registry *prometheus.Registry + pluginStartTime prometheus.Gauge + apiTime *prometheus.HistogramVec httpRequestsTotal prometheus.Counter @@ -53,6 +56,16 @@ func NewMetrics(info InstanceInfo) *Metrics { additionalLabels[MetricsCloudInstallationLabel] = info.InstallationID } + m.pluginStartTime = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: MetricsNamespace, + Subsystem: MetricsSubsystemSystem, + Name: "plugin_start_time", + Help: "The time the plugin started.", + ConstLabels: additionalLabels, + }) + m.pluginStartTime.SetToCurrentTime() + m.registry.MustRegister(m.pluginStartTime) + m.apiTime = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: MetricsNamespace,