@@ -135,6 +135,7 @@ const (
135
135
epCleanTombstones = apiPrefix + "/admin/tsdb/clean_tombstones"
136
136
epConfig = apiPrefix + "/status/config"
137
137
epFlags = apiPrefix + "/status/flags"
138
+ epBuildinfo = apiPrefix + "/status/buildinfo"
138
139
epRuntimeinfo = apiPrefix + "/status/runtimeinfo"
139
140
epTSDB = apiPrefix + "/status/tsdb"
140
141
)
@@ -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
+ // Buildinfo returns various build information properties about the Prometheus server
243
+ Buildinfo (ctx context.Context ) (BuildinfoResult , error )
241
244
// Runtimeinfo returns the various runtime information properties about the Prometheus server.
242
245
Runtimeinfo (ctx context.Context ) (RuntimeinfoResult , error )
243
246
// Series finds series by label matchers.
@@ -281,6 +284,16 @@ type ConfigResult struct {
281
284
// FlagsResult contains the result from querying the flag endpoint.
282
285
type FlagsResult map [string ]string
283
286
287
+ // BuildinfoResult contains the results from querying the buildinfo endpoint.
288
+ type BuildinfoResult struct {
289
+ Version string `json:"version"`
290
+ Revision string `json:"revision"`
291
+ Branch string `json:"branch"`
292
+ BuildUser string `json:"buildUser"`
293
+ BuildDate string `json:"buildDate"`
294
+ GoVersion string `json:"goVersion"`
295
+ }
296
+
284
297
// RuntimeinfoResult contains the result from querying the runtimeinfo endpoint.
285
298
type RuntimeinfoResult struct {
286
299
StartTime time.Time `json:"startTime"`
@@ -674,6 +687,23 @@ func (h *httpAPI) Flags(ctx context.Context) (FlagsResult, error) {
674
687
return res , json .Unmarshal (body , & res )
675
688
}
676
689
690
+ func (h * httpAPI ) Buildinfo (ctx context.Context ) (BuildinfoResult , error ) {
691
+ u := h .client .URL (epBuildinfo , nil )
692
+
693
+ req , err := http .NewRequest (http .MethodGet , u .String (), nil )
694
+ if err != nil {
695
+ return BuildinfoResult {}, err
696
+ }
697
+
698
+ _ , body , _ , err := h .client .Do (ctx , req )
699
+ if err != nil {
700
+ return BuildinfoResult {}, err
701
+ }
702
+
703
+ var res BuildinfoResult
704
+ return res , json .Unmarshal (body , & res )
705
+ }
706
+
677
707
func (h * httpAPI ) Runtimeinfo (ctx context.Context ) (RuntimeinfoResult , error ) {
678
708
u := h .client .URL (epRuntimeinfo , nil )
679
709
0 commit comments