Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9e6b3e4a
Commit
9e6b3e4a
authored
Sep 23, 2015
by
Jimmi Dyson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose version as prometheus metric
parent
28585bc6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
version.go
pkg/version/version.go
+16
-0
No files found.
pkg/version/version.go
View file @
9e6b3e4a
...
...
@@ -16,6 +16,8 @@ limitations under the License.
package
version
import
"github.com/prometheus/client_golang/prometheus"
// Info contains versioning information.
// TODO: Add []string of api versions supported? It's still unclear
// how we'll want to distribute that information.
...
...
@@ -45,3 +47,17 @@ func Get() Info {
func
(
info
Info
)
String
()
string
{
return
info
.
GitVersion
}
func
init
()
{
buildInfo
:=
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Name
:
"kubernetes_build_info"
,
Help
:
"A metric with a constant '1' value labeled by major, minor, git version, git commit and git tree state from which Kubernetes was built."
,
},
[]
string
{
"major"
,
"minor"
,
"gitVersion"
,
"gitCommit"
,
"gitTreeState"
},
)
info
:=
Get
()
buildInfo
.
WithLabelValues
(
info
.
Major
,
info
.
Minor
,
info
.
GitVersion
,
info
.
GitCommit
,
info
.
GitTreeState
)
.
Set
(
1
)
prometheus
.
MustRegister
(
buildInfo
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment