Skip to content

Commit

Permalink
spire-server/agent: log version at start up (#5637)
Browse files Browse the repository at this point in the history
Signed-off-by: Sorin Dumitru <[email protected]>
  • Loading branch information
sorindumitru authored Nov 5, 2024
1 parent ac5eb6a commit 6fd9e75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/spiffe/spire/pkg/common/telemetry"
"github.com/spiffe/spire/pkg/common/uptime"
"github.com/spiffe/spire/pkg/common/util"
"github.com/spiffe/spire/pkg/common/version"
_ "golang.org/x/net/trace" // registers handlers on the DefaultServeMux
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand All @@ -51,7 +52,10 @@ type Agent struct {
// This method initializes the agent, including its plugins,
// and then blocks on the main event loop.
func (a *Agent) Run(ctx context.Context) error {
a.c.Log.Infof("Starting agent with data directory: %q", a.c.DataDir)
a.c.Log.WithFields(logrus.Fields{
telemetry.DataDir: a.c.DataDir,
telemetry.Version: version.Version(),
}).Info("Starting agent")
if err := diskutil.CreateDataDirectory(a.c.DataDir); err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/spiffe/spire/pkg/common/telemetry"
"github.com/spiffe/spire/pkg/common/uptime"
"github.com/spiffe/spire/pkg/common/util"
"github.com/spiffe/spire/pkg/common/version"
"github.com/spiffe/spire/pkg/server/authpolicy"
bundle_client "github.com/spiffe/spire/pkg/server/bundle/client"
ds_pubmanager "github.com/spiffe/spire/pkg/server/bundle/datastore"
Expand Down Expand Up @@ -74,6 +75,7 @@ func (s *Server) run(ctx context.Context) (err error) {
telemetry.AdminIDs: s.config.AdminIDs,
telemetry.DataDir: s.config.DataDir,
telemetry.LaunchLogLevel: s.config.Log.GetLevel(),
telemetry.Version: version.Version(),
}).Info("Configured")

// create the data directory if needed
Expand Down

0 comments on commit 6fd9e75

Please sign in to comment.