Skip to content

Commit

Permalink
Add jaeger_build_info metrics in each jaeger component
Browse files Browse the repository at this point in the history
Signed-off-by: Ashmita Bohara <[email protected]>
  • Loading branch information
Ashmita152 committed Jun 10, 2021
1 parent 68aeff3 commit cc67f80
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func main() {
mFactory := fork.New("internal",
jexpvar.NewFactory(10), // backend for internal opts
baseFactory)
version.NewInfoMetrics(mFactory)

rOpts := new(reporter.Options).InitFromViper(v, logger)
grpcBuilder := grpc.NewConnBuilder().InitFromViper(v)
Expand Down
1 change: 1 addition & 0 deletions cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ by default uses only in-memory database.`,
metricsFactory := fork.New("internal",
jexpvar.NewFactory(10), // backend for internal opts
rootMetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"}))
version.NewInfoMetrics(metricsFactory)

tracerCloser := initTracer(rootMetricsFactory, svc.Logger)

Expand Down
1 change: 1 addition & 0 deletions cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func main() {
metricsFactory := fork.New("internal",
jexpvar.NewFactory(10), // backend for internal opts
baseFactory.Namespace(metrics.NSOptions{Name: "collector"}))
version.NewInfoMetrics(metricsFactory)

storageFactory.InitFromViper(v)
if err := storageFactory.Initialize(baseFactory, logger); err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/ingester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func main() {
logger := svc.Logger // shortcut
baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
metricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "ingester"})
version.NewInfoMetrics(metricsFactory)

storageFactory.InitFromViper(v)
if err := storageFactory.Initialize(baseFactory, logger); err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/query/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func main() {
logger := svc.Logger // shortcut
baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
metricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"})
version.NewInfoMetrics(metricsFactory)

traceCfg := &jaegerClientConfig.Configuration{
ServiceName: "jaeger-query",
Expand Down
22 changes: 22 additions & 0 deletions pkg/version/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package version

import "github.com/uber/jaeger-lib/metrics"

var (
// commitFromGit is a constant representing the source version that
// generated this build. It should be set during build via -ldflags.
Expand All @@ -40,3 +42,23 @@ func Get() Info {
BuildDate: date,
}
}

// InfoMetrics hold metrics about build information
type InfoMetrics struct {
BuildInfo metrics.Gauge `metric:"build_info"`
}

// NewInfoMetrics returns a InfoMetrics
func NewInfoMetrics(infoMetrics metrics.Factory) *InfoMetrics {
var info InfoMetrics

buildTags := map[string]string{
"revision": commitSHA,
"version": latestVersion,
"build_date": date,
}
metrics.Init(&info, infoMetrics, buildTags)
info.BuildInfo.Update(1)

return &info
}

0 comments on commit cc67f80

Please sign in to comment.