class InternalMetrics

Defined at line 20 of file ../../third_party/cobalt/src/logger/internal_metrics.h

InternalMetrics defines the methods used for collecting cobalt-internal

metrics.

Public Methods

util::NotNullUniquePtr<InternalMetrics> NewWithLogger (LoggerInterface * logger, DiagnosticsInterface * diagnostics)

Returns a pointer to an InternalMetrics object which can be used for

collecting cobalt-internal metrics.

|logger| the logger used to log internal metrics. If the pointer is null,

NoOpInternalMetrics will be used.

|diagnostics|: The implementation to send diagnostic information about the

functioning of the Cobalt Core library. If null, no diagnostic information

will be sent.

void LoggerCalled (LoggerCallsMadeMigratedMetricDimensionLoggerMethod method, const Project & project)

LoggerCalled (cobalt_internal::metrics::logger_calls_made_migrated) is

logged for every call to Logger along with which method was called.

void BytesUploaded (BytesUploadedMetricDimensionStatus upload_status, size_t byte_count)

cobalt_internal::metrics::bytes_uploaded is logged when the Clearcut

Uploader attempts or succeeds to upload observations from the device.

void BytesUploaded (PerProjectBytesUploadedMigratedMetricDimensionStatus upload_status, size_t byte_count, const lib::ProjectIdentifier & project_identifier)

cobalt_internal::metrics::per_project_bytes_uploaded_migrated is logged when

the Shipping Manager attempts or succeeds to store observations on the device.

void BytesStored (PerProjectBytesStoredMigratedMetricDimensionStatus upload_status, size_t byte_count, const lib::ProjectIdentifier & project_identifier)

cobalt_internal::metrics::per_project_bytes_stored_migrated is logged when the

Observation Store attempts or succeeds to store observations on the device.

void InaccurateClockEventsCached (int64_t event_count)

cobalt_internal::metrics::inaccurate_clock_events_cached_migrated is logged when

the UndatedEventManager saves an event while the clock is inaccurate.

void InaccurateClockEventsDropped (int64_t event_count)

cobalt_internal::metrics::inaccurate_clock_events_dropped_migrated is logged when

the UndatedEventManager drops a saved event while the clock is inaccurate and it

runs out of space.

void SetSoftwareDistributionInfoCalled (SetSoftwareDistributionInfoCalledMigratedEventCodes event_codes)

cobalt_internal::metrics::set_software_distribution_info_called_migrated is logged

when the SystemData receives SoftwareDistributionInfo.

void TrackDiskUsage (StorageClass storage_class, size_t bytes, int64_t max_bytes)

cobalt_internal::metrics::store_usage is used to track how much data is stored per-class on

disk.

void LocalAggregationQuotaEvent (const lib::ProjectIdentifier & project_identifier, int event_type)

Used to track what the quota state of each project on the system is.

|event_type|: tracks what the state is (1: Below quota, 2: Above quota, 3: Above quota and log

rejected).

void TrackDiskUsage (StorageClass storage_class, size_t bytes)

Defined at line 94 of file ../../third_party/cobalt/src/logger/internal_metrics.h

InternalMetricsFlusher Flusher ()

Used to ensure that internal metrics data is flushed before a scope is exited.

All calls to InternalMetrics methods should only be made after a Flusher has been created.

Defined at line 108 of file ../../third_party/cobalt/src/logger/internal_metrics.h

bool IsRealImpl ()

Returns true if this is an instance of the real implementation of

InternalMetrics that will really do internal logging and false if this

is a fake or no-op implementation.

void ~InternalMetrics ()

Defined at line 131 of file ../../third_party/cobalt/src/logger/internal_metrics.h

Protected Methods

void Flush ()

Flushes queued internal metrics.

This is necessary because we collect some metrics in places where a lock is

held (for example inside of LocalAggregation). If we immediately logged

again, this would cause a deadlock as we are still holding the lock, but

the logger call requires taking it again. With the queue-and-flush model,

we make sure that all of the internal metrics logging is done once at the

end when no more locks are held.

void IncrementFlushers ()

Notifies the internal metrics implementation that a flusher has been created.

Records

Friends

class InternalMetricsPauseWrapper