diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index 86197f462f..3e29cf45ff 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -91,6 +91,7 @@ func (s *HTTPHandlers) AgentSelf(resp http.ResponseWriter, req *http.Request) (i Revision string Server bool Version string + BuildDate string }{ Datacenter: s.agent.config.Datacenter, PrimaryDatacenter: s.agent.config.PrimaryDatacenter, @@ -100,8 +101,10 @@ func (s *HTTPHandlers) AgentSelf(resp http.ResponseWriter, req *http.Request) (i Revision: s.agent.config.Revision, Server: s.agent.config.ServerMode, // We expect the ent version to be part of the reported version string, and that's now part of the metadata, not the actual version. - Version: s.agent.config.VersionWithMetadata(), + Version: s.agent.config.VersionWithMetadata(), + BuildDate: s.agent.config.BuildDate.Format(time.RFC3339), } + return Self{ Config: config, DebugConfig: s.agent.config.Sanitized(), diff --git a/agent/config/runtime.go b/agent/config/runtime.go index 069a463dc5..2ae9888ae0 100644 --- a/agent/config/runtime.go +++ b/agent/config/runtime.go @@ -1701,6 +1701,10 @@ func sanitize(name string, v reflect.Value) reflect.Value { x := v.Interface().(time.Duration) return reflect.ValueOf(x.String()) + case isTime(typ): + x := v.Interface().(time.Time) + return reflect.ValueOf(x.String()) + case isString(typ): if strings.HasPrefix(name, "RetryJoinLAN[") || strings.HasPrefix(name, "RetryJoinWAN[") { x := v.Interface().(string) @@ -1772,6 +1776,7 @@ func sanitize(name string, v reflect.Value) reflect.Value { } func isDuration(t reflect.Type) bool { return t == reflect.TypeOf(time.Second) } +func isTime(t reflect.Type) bool { return t == reflect.TypeOf(time.Time{}) } func isMap(t reflect.Type) bool { return t.Kind() == reflect.Map } func isNetAddr(t reflect.Type) bool { return t.Implements(reflect.TypeOf((*net.Addr)(nil)).Elem()) } func isPtr(t reflect.Type) bool { return t.Kind() == reflect.Ptr }