CDM Metrics Protocol buffer serialization.
An implementation that serializes metrics to a protocol buffer. This is a merge from wvgerrit/28440. I intend to submit 2048751, 2048750, and 2048509 together. Bug: 36217927 Bug: 36220975 Test: Added unit tests to cover modified code. Change-Id: Ie8b9d8b91d2602b015f5568890a16c0419c126df
This commit is contained in:
@@ -6,10 +6,12 @@
|
||||
#ifndef WVCDM_METRICS_METRICS_GROUP_H_
|
||||
#define WVCDM_METRICS_METRICS_GROUP_H_
|
||||
|
||||
#include <ostream>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "event_metric.h"
|
||||
#include "metrics.pb.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -80,6 +82,8 @@ class CryptoMetrics {
|
||||
public:
|
||||
CryptoMetrics();
|
||||
|
||||
void Serialize(drm_metrics::MetricsGroup* metrics);
|
||||
|
||||
/* CRYPTO SESSION */
|
||||
EventMetric<CdmResponseType> crypto_session_delete_all_usage_reports_;
|
||||
EventMetric<CdmResponseType> crypto_session_delete_multiple_usage_information_;
|
||||
@@ -173,6 +177,10 @@ class SessionMetrics {
|
||||
// This instance retains ownership of the object.
|
||||
CryptoMetrics* GetCryptoMetrics() { return &crypto_metrics_; }
|
||||
|
||||
// Serialize the session metrics to the provided |metric_group|.
|
||||
// |metric_group| is owned by the caller and must not be null.
|
||||
void Serialize(drm_metrics::MetricsGroup* metric_group);
|
||||
|
||||
// Metrics collected at the session level.
|
||||
EventMetric<> cdm_session_life_span_;
|
||||
EventMetric<CdmResponseType> cdm_session_renew_key_;
|
||||
@@ -180,6 +188,7 @@ class SessionMetrics {
|
||||
EventMetric<CdmResponseType> cdm_session_restore_usage_session_;
|
||||
|
||||
private:
|
||||
void SerializeSessionMetrics(drm_metrics::MetricsGroup* metric_group);
|
||||
CdmSessionId session_id_;
|
||||
bool completed_;
|
||||
CryptoMetrics crypto_metrics_;
|
||||
@@ -207,11 +216,16 @@ class EngineMetrics {
|
||||
// until this object is deleted.
|
||||
CryptoMetrics* GetCryptoMetrics() { return &crypto_metrics_; }
|
||||
|
||||
// Serialize all engine and completed session metrics to json format and
|
||||
// send them to the output string. |out| must NOT be null. |completed_only|
|
||||
// indicates that this call should only publish SessionMetrics instances
|
||||
// that are marked as completed.
|
||||
void JsonSerialize(std::string* out, bool completed_only);
|
||||
// Serialize engine and session metrics into a serialized MetricsGroup
|
||||
// instance and output that instance to the provided |metric_group|.
|
||||
// |metric_group| is owned by the caller and must NOT be null.
|
||||
// |completed_only| indicates that this call should only publish
|
||||
// SessionMetrics instances that are marked as completed.
|
||||
// |clear_sessions| indicates that this call should clear sessions metrics
|
||||
// for those sessions that were serialized. This allows atomic
|
||||
// serialization and closing of session-level metrics.
|
||||
void Serialize(drm_metrics::MetricsGroup* metric_group, bool completed_only,
|
||||
bool clear_serialized_sessions);
|
||||
|
||||
// Metrics recorded at the engine level.
|
||||
EventMetric<CdmResponseType> cdm_engine_add_key_;
|
||||
@@ -236,6 +250,8 @@ class EngineMetrics {
|
||||
Lock session_metrics_lock_;
|
||||
std::vector<metrics::SessionMetrics*> session_metrics_list_;
|
||||
CryptoMetrics crypto_metrics_;
|
||||
|
||||
void SerializeEngineMetrics(drm_metrics::MetricsGroup* out);
|
||||
};
|
||||
|
||||
} // namespace metrics
|
||||
|
||||
Reference in New Issue
Block a user