@@ -137,6 +137,7 @@ const (
137
137
epCleanTombstones = apiPrefix + "/admin/tsdb/clean_tombstones"
138
138
epConfig = apiPrefix + "/status/config"
139
139
epFlags = apiPrefix + "/status/flags"
140
+ epRuntimeinfo = apiPrefix + "/status/runtimeinfo"
140
141
)
141
142
142
143
// AlertState models the state of an alert.
@@ -238,6 +239,8 @@ type API interface {
238
239
Query (ctx context.Context , query string , ts time.Time ) (model.Value , Warnings , error )
239
240
// QueryRange performs a query for the given range.
240
241
QueryRange (ctx context.Context , query string , r Range ) (model.Value , Warnings , error )
242
+ // Runtimeinfo returns the various runtime information properties about the Prometheus server.
243
+ Runtimeinfo (ctx context.Context ) (RuntimeinfoResult , error )
241
244
// Series finds series by label matchers.
242
245
Series (ctx context.Context , matches []string , startTime time.Time , endTime time.Time ) ([]model.LabelSet , Warnings , error )
243
246
// Snapshot creates a snapshot of all current data into snapshots/<datetime>-<rand>
@@ -277,6 +280,22 @@ type ConfigResult struct {
277
280
// FlagsResult contains the result from querying the flag endpoint.
278
281
type FlagsResult map [string ]string
279
282
283
+ // RuntimeinfoResult contains the result from querying the runtimeinfo endpoint.
284
+ type RuntimeinfoResult struct {
285
+ StartTime string `json:"startTime"`
286
+ CWD string `json:"CWD"`
287
+ ReloadConfigSuccess bool `json:"reloadConfigSuccess"`
288
+ LastConfigTime string `json:"lastConfigTime"`
289
+ ChunkCount int `json:"chunkCount"`
290
+ TimeSeriesCount int `json:"timeSeriesCount"`
291
+ CorruptionCount int `json:"corruptionCount"`
292
+ GoroutineCount int `json:"goroutineCount"`
293
+ GOMAXPROCS int `json:"GOMAXPROCS"`
294
+ GOGC string `json:"GOGC"`
295
+ GODEBUG string `json:"GODEBUG"`
296
+ StorageRetention string `json:"storageRetention"`
297
+ }
298
+
280
299
// SnapshotResult contains the result from querying the snapshot endpoint.
281
300
type SnapshotResult struct {
282
301
Name string `json:"name"`
@@ -640,6 +659,23 @@ func (h *httpAPI) Flags(ctx context.Context) (FlagsResult, error) {
640
659
return res , json .Unmarshal (body , & res )
641
660
}
642
661
662
+ func (h * httpAPI ) Runtimeinfo (ctx context.Context ) (RuntimeinfoResult , error ) {
663
+ u := h .client .URL (epRuntimeinfo , nil )
664
+
665
+ req , err := http .NewRequest (http .MethodGet , u .String (), nil )
666
+ if err != nil {
667
+ return RuntimeinfoResult {}, err
668
+ }
669
+
670
+ _ , body , _ , err := h .client .Do (ctx , req )
671
+ if err != nil {
672
+ return RuntimeinfoResult {}, err
673
+ }
674
+
675
+ var res RuntimeinfoResult
676
+ return res , json .Unmarshal (body , & res )
677
+ }
678
+
643
679
func (h * httpAPI ) LabelNames (ctx context.Context ) ([]string , Warnings , error ) {
644
680
u := h .client .URL (epLabels , nil )
645
681
req , err := http .NewRequest (http .MethodGet , u .String (), nil )
0 commit comments