diff --git a/server/fleet/errors.go b/server/fleet/errors.go index e8630e1dcab2..bc2159e8b991 100644 --- a/server/fleet/errors.go +++ b/server/fleet/errors.go @@ -538,6 +538,7 @@ func (fe FleetdError) Error() string { // about the error can be logged by the components that use zerolog (Orbit, // Fleet Desktop) func (fe FleetdError) MarshalZerologObject(e *zerolog.Event) { + e.Bool("vital", fe.Vital) e.Str("error_source", fe.ErrorSource) e.Str("error_source_version", fe.ErrorSourceVersion) e.Time("error_timestamp", fe.ErrorTimestamp) diff --git a/server/fleet/errors_test.go b/server/fleet/errors_test.go index d40fd8a8f51a..433c5e780077 100644 --- a/server/fleet/errors_test.go +++ b/server/fleet/errors_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/rs/zerolog" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -62,7 +63,8 @@ func TestFleetdErrors(t *testing.T) { } require.Equal(t, "test message", ferr.Error()) - require.Equal(t, map[string]any{ + assert.Equal(t, map[string]any{ + "vital": ferr.Vital, "error_source": ferr.ErrorSource, "error_source_version": ferr.ErrorSourceVersion, "error_timestamp": ferr.ErrorTimestamp, @@ -75,5 +77,7 @@ func TestFleetdErrors(t *testing.T) { zevent := logger.Log() ferr.MarshalZerologObject(zevent) zevent.Send() - require.JSONEq(t, `{"error_source":"orbit","error_source_version":"1.1.1","error_timestamp":"1969-06-19T21:44:05Z","error_message":"test message","error_additional_info":{"foo":"bar"}}`, logBuf.String()) + assert.JSONEq(t, + `{"error_source":"orbit","error_source_version":"1.1.1","error_timestamp":"1969-06-19T21:44:05Z","error_message":"test message","error_additional_info":{"foo":"bar"},"vital":false}`, + logBuf.String()) }