Skip to content
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
8 changes: 6 additions & 2 deletions pkg/app/launcher/cmd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,12 @@ func (l *launcher) createAPIClient(ctx context.Context, address, projectID, pipe

// makePipedArgs generates arguments for Piped from the ones passed to Launcher.
func makePipedArgs(launcherArgs []string, configFile string) []string {
pipedArgs := make([]string, 0, len(launcherArgs)+2)
pipedArgs = append(pipedArgs, "piped", "--config-file="+configFile)
pipedArgs := make([]string, 0, len(launcherArgs)+3)
pipedArgs = append(pipedArgs,
"piped",
"--config-file="+configFile,
"--launcher-version="+version.Get().Version,
)

for _, a := range launcherArgs {
normalizedArg := strings.TrimLeft(a, "-")
Expand Down
8 changes: 6 additions & 2 deletions pkg/app/piped/cmd/piped/piped.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type piped struct {
enableDefaultKubernetesCloudProvider bool
gracePeriod time.Duration
addLoginUserToPasswd bool
launcherVersion string
}

func NewCommand() *cobra.Command {
Expand Down Expand Up @@ -118,6 +119,8 @@ func NewCommand() *cobra.Command {
cmd.Flags().BoolVar(&p.addLoginUserToPasswd, "add-login-user-to-passwd", p.addLoginUserToPasswd, "Whether to add login user to $HOME/passwd. This is typically for applications running as a random user ID.")
cmd.Flags().DurationVar(&p.gracePeriod, "grace-period", p.gracePeriod, "How long to wait for graceful shutdown.")

cmd.Flags().StringVar(&p.launcherVersion, "launcher-version", p.launcherVersion, "The version of launcher which initialized this Piped.")

return cmd
}

Expand All @@ -137,7 +140,7 @@ func (p *piped) run(ctx context.Context, input cli.Input) (runErr error) {
}

// Register all metrics.
registry := registerMetrics(cfg.PipedID, cfg.ProjectID)
registry := registerMetrics(cfg.PipedID, cfg.ProjectID, p.launcherVersion)

// Configure SSH config if needed.
if cfg.Git.ShouldConfigureSSHConfig() {
Expand Down Expand Up @@ -721,13 +724,14 @@ func (p *piped) getConfigDataFromSecretManager(ctx context.Context) ([]byte, err
return resp.Payload.Data, nil
}

func registerMetrics(pipedID, projectID string) *prometheus.Registry {
func registerMetrics(pipedID, projectID, launcherVersion string) *prometheus.Registry {
r := prometheus.NewRegistry()
wrapped := prometheus.WrapRegistererWith(
map[string]string{
"pipecd_component": "piped",
"piped": pipedID,
"piped_version": version.Get().Version,
"launcher_version": launcherVersion,
"project": projectID,
},
r,
Expand Down