Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use same metric to expose binary build info #2293

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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})
)
Loading