NewMetrics registers the provider metrics against reg.
(reg prometheus.Registerer)
| 29 | |
| 30 | // NewMetrics registers the provider metrics against reg. |
| 31 | func NewMetrics(reg prometheus.Registerer) *Metrics { |
| 32 | factory := promauto.With(reg) |
| 33 | |
| 34 | return &Metrics{ |
| 35 | registerer: reg, |
| 36 | |
| 37 | ProviderInfo: factory.NewGaugeVec(prometheus.GaugeOpts{ |
| 38 | Name: "provider_info", |
| 39 | Help: "One series per configured AI provider. Value is always 1; the status label (enabled, disabled, error) carries the alertable signal.", |
| 40 | }, []string{"provider_name", "provider_type", "status"}), |
| 41 | |
| 42 | ProvidersLastReloadTimestampSeconds: factory.NewGauge(prometheus.GaugeOpts{ |
| 43 | Name: "providers_last_reload_timestamp_seconds", |
| 44 | Help: "Unix timestamp of the last provider reload attempt, success or failure.", |
| 45 | }), |
| 46 | |
| 47 | ProvidersLastReloadSuccessTimestampSeconds: factory.NewGauge(prometheus.GaugeOpts{ |
| 48 | Name: "providers_last_reload_success_timestamp_seconds", |
| 49 | Help: "Unix timestamp of the last provider reload that successfully refreshed the pool. A gap against coder_aibridged_providers_last_reload_timestamp_seconds means the loop is firing but the refresh function is failing.", |
| 50 | }), |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // Unregister removes the provider metrics from the registerer. |
| 55 | func (m *Metrics) Unregister() { |
no outgoing calls