Skip to content

Commit

Permalink
chore: use same metric to expose binary build info (#2293)
Browse files Browse the repository at this point in the history
  • Loading branch information
whynowy authored Dec 18, 2024
1 parent 7450e16 commit 40ecf06
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
5 changes: 4 additions & 1 deletion pkg/daemon/server/daemon_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/numaproj/numaflow/pkg/daemon/server/service"
server "github.com/numaproj/numaflow/pkg/daemon/server/service/rater"
"github.com/numaproj/numaflow/pkg/isbsvc"
"github.com/numaproj/numaflow/pkg/metrics"
jsclient "github.com/numaproj/numaflow/pkg/shared/clients/nats"
redisclient "github.com/numaproj/numaflow/pkg/shared/clients/redis"
"github.com/numaproj/numaflow/pkg/shared/logging"
Expand Down Expand Up @@ -156,7 +157,9 @@ func (ds *daemonServer) Run(ctx context.Context) error {
go ds.exposeMetrics(ctx)

version := numaflow.GetVersion()
pipeline_info.WithLabelValues(version.Version, version.Platform, ds.pipeline.Name).Set(1)
// TODO: clean it up in v1.6
deprecatedPipelineInfo.WithLabelValues(version.Version, version.Platform, ds.pipeline.Name).Set(1)
metrics.BuildInfo.WithLabelValues(v1alpha1.ComponentDaemon, ds.pipeline.Name, version.Version, version.Platform).Set(1)

log.Infof("Daemon server started successfully on %s", address)
<-ctx.Done()
Expand Down
5 changes: 3 additions & 2 deletions pkg/daemon/server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
)

var (
pipeline_info = promauto.NewGaugeVec(prometheus.GaugeOpts{
// Deprecated: Use pkg/metrics.BuildInfo instead.
deprecatedPipelineInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Subsystem: "pipeline",
Name: "build_info",
Help: "A metric with a constant value '1', labeled by Numaflow binary version and platform, as well as the pipeline name",
Help: "A metric with a constant value '1', labeled by Numaflow binary version and platform, as well as the pipeline name. Deprecated: Use build_info instead",
}, []string{metrics.LabelVersion, metrics.LabelPlatform, metrics.LabelPipeline})

// Pipeline processing lag, max(watermark) - min(watermark)
Expand Down
5 changes: 5 additions & 0 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ const (
)

var (
BuildInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "build_info",
Help: "A metric with a constant value '1', labeled by Numaflow binary version, platform, and other information",
}, []string{LabelComponent, LabelComponentName, LabelVersion, LabelPlatform})

SDKInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "sdk_info",
Help: "A metric with a constant value '1', labeled by SDK information such as version, language, and type",
Expand Down
5 changes: 4 additions & 1 deletion pkg/mvtxdaemon/server/daemon_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/numaproj/numaflow"
"github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1"
"github.com/numaproj/numaflow/pkg/apis/proto/mvtxdaemon"
"github.com/numaproj/numaflow/pkg/metrics"
"github.com/numaproj/numaflow/pkg/mvtxdaemon/server/service"
rateServer "github.com/numaproj/numaflow/pkg/mvtxdaemon/server/service/rater"
"github.com/numaproj/numaflow/pkg/shared/logging"
Expand Down Expand Up @@ -108,7 +109,9 @@ func (ds *daemonServer) Run(ctx context.Context) error {
}()

version := numaflow.GetVersion()
monoVertexInfo.WithLabelValues(version.Version, version.Platform, ds.monoVtx.Name).Set(1)
// Todo: clean it up in v1.6
deprecatedMonoVertexInfo.WithLabelValues(version.Version, version.Platform, ds.monoVtx.Name).Set(1)
metrics.BuildInfo.WithLabelValues(v1alpha1.ComponentMonoVertexDaemon, ds.monoVtx.Name, version.Version, version.Platform).Set(1)

log.Infof("MonoVertex daemon server started successfully on %s", address)
<-ctx.Done()
Expand Down
5 changes: 3 additions & 2 deletions pkg/mvtxdaemon/server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import (
)

var (
monoVertexInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
// Deprecated: Use pkg/metrics.BuildInfo instead.
deprecatedMonoVertexInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Subsystem: "monovtx",
Name: "build_info",
Help: "A metric with a constant value '1', labeled by Numaflow binary version and platform, as well as the mono vertex name",
Help: "A metric with a constant value '1', labeled by Numaflow binary version and platform, as well as the mono vertex name. Deprecated: Use build_info instead",
}, []string{metrics.LabelVersion, metrics.LabelPlatform, metrics.LabelMonoVertexName})
)

0 comments on commit 40ecf06

Please sign in to comment.