Inherits AZ::Metrics::IEventLogger.
Public Types | |
using | JsonEventString = AZStd::fixed_string< MaxEventJsonStringSize > |
Public Types inherited from AZ::Metrics::IEventLogger | |
using | ErrorString = AZStd::fixed_string< 256 > |
Outcome which is populated with an error message should the event recording fail. | |
using | ResultOutcome = AZ::Outcome< void, ErrorString > |
Public Member Functions | |
JsonTraceEventLogger (JsonTraceEventLoggerConfig) | |
JsonTraceEventLogger (AZStd::unique_ptr< AZ::IO::GenericStream > stream) | |
Generic stream which owned by the JsonEventLogger. | |
JsonTraceEventLogger (AZStd::unique_ptr< AZ::IO::GenericStream > stream, JsonTraceEventLoggerConfig) | |
void | SetName (AZStd::string_view) override |
Set the name associated of this event logger. | |
AZStd::string_view | GetName () const override |
Returns the name associated with this event logger. | |
void | Flush () override |
Writes and json data to the stream. | |
ResultOutcome | RecordDurationEventBegin (const DurationArgs &) override |
ResultOutcome | RecordDurationEventEnd (const DurationArgs &) override |
ResultOutcome | RecordCompleteEvent (const CompleteArgs &) override |
ResultOutcome | RecordInstantEvent (const InstantArgs &) override |
ResultOutcome | RecordCounterEvent (const CounterArgs &) override |
ResultOutcome | RecordAsyncEventStart (const AsyncArgs &) override |
ResultOutcome | RecordAsyncEventInstant (const AsyncArgs &) override |
ResultOutcome | RecordAsyncEventEnd (const AsyncArgs &) override |
void | ResetStream (AZStd::unique_ptr< AZ::IO::GenericStream > stream) |
Closes the previous stream and associates a new stream. | |
Public Member Functions inherited from AZ::Metrics::IEventLogger | |
AZ_RTTI (IEventLogger, "{D39D09FA-DEA0-4874-BC45-4B310C3DD52E}") | |
virtual void | SetName (AZStd::string_view name) |
virtual AZStd::string_view | GetName () const |
virtual void | Flush ()=0 |
virtual ResultOutcome | RecordDurationEventBegin (const DurationArgs &)=0 |
virtual ResultOutcome | RecordDurationEventEnd (const DurationArgs &)=0 |
virtual ResultOutcome | RecordCompleteEvent (const CompleteArgs &)=0 |
virtual ResultOutcome | RecordInstantEvent (const InstantArgs &)=0 |
virtual ResultOutcome | RecordCounterEvent (const CounterArgs &)=0 |
virtual ResultOutcome | RecordAsyncEventStart (const AsyncArgs &)=0 |
virtual ResultOutcome | RecordAsyncEventInstant (const AsyncArgs &)=0 |
virtual ResultOutcome | RecordAsyncEventEnd (const AsyncArgs &)=0 |
Static Public Attributes | |
static constexpr size_t | MaxEventJsonStringSize = 1024 |
Protected Member Functions | |
bool | FlushRequest (const EventDesc &) |
Responsible for writing the recorded event data to JSON. | |
bool | Start (AZ::IO::GenericStream &stream) |
Start the JSON document by adding the opening '[' bracket. | |
bool | Complete (AZ::IO::GenericStream &stream) |
Complete the JSON document by adding the ending ']' bracket. | |
void | ResetSettingsHandler () |
Protected Attributes | |
AZStd::mutex | m_flushToStreamMutex |
AZStd::unique_ptr< AZ::IO::GenericStream > | m_stream |
AZStd::string | m_name |
Provides a user friendly name for the event logger. | |
bool | m_active { GetDefaultActiveState() } |
AZ::SettingsRegistryInterface * | m_settingsRegistry {} |
AZ::SettingsRegistryInterface::NotifyEventHandler | m_settingsHandler |
AZStd::atomic_bool | m_prependComma { false } |
size_t | m_eventCount {} |
Tracks the number of events written so far. | |
|
overridevirtual |
Writes and json data to the stream.
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Returns the name associated with this event logger.
Reimplemented from AZ::Metrics::IEventLogger.
|
overridevirtual |
Records an end async event Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records an instant async event Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records a start async event Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records a complete event(encapsulates a beging and end duration event) Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records a Counter Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records a begin duration event Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records an end duration event Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
overridevirtual |
Records an instant event Uses the event header to populate the event fields
Implements AZ::Metrics::IEventLogger.
|
protected |
Reads the event logger "/O3DE/Metrics/<Name>/Active" setting from the Settings Registry and resets a handler to listen for changes to any setting below "/O3DE/Metrics/<Name>" key
|
overridevirtual |
Set the name associated of this event logger.
Reimplemented from AZ::Metrics::IEventLogger.
|
protected |
Active flag to to allow the record functions to write event data to the stream member The default is true When the name of the event logger is set, the value is updated from the settings registry "/O3DE/Metrics/<Name>/Active" bool
|
protected |
Keep track of whether this is the first event being logged This is used to prepend a leading comma before the event entry in the trace events array
|
protected |
Stores a pointer to the SettingsRegistry used to query settings associated with this event logger instance If nullptr, the global SettingsRegistry is queried