#include "components/metrics/debug/structured/structured_metrics_debug_provider.h"
#include <optional>
#include <string_view>
#include <utility>
#include "base/i18n/number_formatting.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_util.h"
#include "components/metrics/structured/event_validator.h"
#include "components/metrics/structured/project_validator.h"
#include "components/metrics/structured/proto/event_storage.pb.h"
#include "components/metrics/structured/recorder.h"
#include "components/metrics/structured/structured_metrics_service.h"
#include "components/metrics/structured/structured_metrics_validator.h"
#include "third_party/metrics_proto/structured_data.pb.h"
namespace metrics::structured {
namespace {
struct EventInfo { … };
std::string Normalize(std::string_view value) { … }
std::string EventInfo::NormalizeProjectName() const { … }
std::string EventInfo::NormalizeEventName() const { … }
std::optional<EventInfo> GetEventInfo(const StructuredEventProto& proto) { … }
base::Value::Dict CreateKeyValue(std::string_view key, base::Value value) { … }
std::optional<base::Value> MetricToValue(
const StructuredEventProto::Metric& metric) { … }
base::Value::List CreateMetricsList(const google::protobuf::RepeatedPtrField<
StructuredEventProto::Metric>& metrics,
const EventValidator* event_validator) { … }
base::Value::Dict CreateEventMetadataDict(
const StructuredEventProto::EventSequenceMetadata& sequence_metadata) { … }
base::Value::Dict CreateEventDict(const StructuredEventProto& proto) { … }
}
StructuredMetricsDebugProvider::StructuredMetricsDebugProvider(
StructuredMetricsService* service)
: … { … }
StructuredMetricsDebugProvider::~StructuredMetricsDebugProvider() { … }
void StructuredMetricsDebugProvider::OnEventRecorded(
const StructuredEventProto& event) { … }
void StructuredMetricsDebugProvider::LoadRecordedEvents() { … }
}