Skip to content

Commit

Permalink
Add pilot version string to prom metrics (istio#10027)
Browse files Browse the repository at this point in the history
* Add pilot version string to prom metrics

* Fix version string

* Move metric registration to init
  • Loading branch information
ostromart authored and istio-testing committed Dec 12, 2018
1 parent 6d704b3 commit 9737f3d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pilot/pkg/bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
middleware "github.com/grpc-ecosystem/go-grpc-middleware"
prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/hashicorp/go-multierror"
prom "github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
Expand Down Expand Up @@ -119,6 +120,14 @@ func init() {
// get the grpc server wired up
// This should only be set before any RPCs are sent or received by this program.
grpc.EnableTracing = true

// Export pilot version as metric for fleet analytics.
pilotVersion := prom.NewGaugeVec(prom.GaugeOpts{
Name: "pilot_info",
Help: "Pilot version and build information.",
}, []string{"version"})
prom.MustRegister(pilotVersion)
pilotVersion.With(prom.Labels{"version": version.Info.String()}).Set(1)
}

// MeshArgs provide configuration options for the mesh. If ConfigFile is provided, an attempt will be made to
Expand Down

0 comments on commit 9737f3d

Please sign in to comment.