Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbf03b88 authored by Olivier Gaillard's avatar Olivier Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Metric id should be serialized as int64 (part 2)"

parents 214f5460 f48fb042
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@ void StatsdStats::noteBucketBoundaryDelayNs(int64_t metricId, int64_t timeDelayN
            std::min(pullStats.minBucketBoundaryDelayNs, timeDelayNs);
}

StatsdStats::AtomMetricStats& StatsdStats::getAtomMetricStats(int metricId) {
StatsdStats::AtomMetricStats& StatsdStats::getAtomMetricStats(int64_t metricId) {
    auto atomMetricStatsIter = mAtomMetricStats.find(metricId);
    if (atomMetricStatsIter != mAtomMetricStats.end()) {
        return atomMetricStatsIter->second;
+2 −2
Original line number Diff line number Diff line
@@ -488,7 +488,7 @@ private:
    std::map<int, PulledAtomStats> mPulledAtomStats;

    // Maps metric ID to its stats. The size is capped by the number of metrics.
    std::map<int, AtomMetricStats> mAtomMetricStats;
    std::map<int64_t, AtomMetricStats> mAtomMetricStats;

    struct LogLossStats {
        LogLossStats(int32_t sec, int32_t count, int32_t error)
@@ -532,7 +532,7 @@ private:
     * Get a reference to AtomMetricStats for a metric. If none exists, create it. The reference
     * will live as long as `this`.
     */
    StatsdStats::AtomMetricStats& getAtomMetricStats(int metricId);
    StatsdStats::AtomMetricStats& getAtomMetricStats(int64_t metricId);

    FRIEND_TEST(StatsdStatsTest, TestValidConfigAdd);
    FRIEND_TEST(StatsdStatsTest, TestInvalidConfigAdd);
+2 −2
Original line number Diff line number Diff line
@@ -489,11 +489,11 @@ void writePullerStatsToStream(const std::pair<int, StatsdStats::PulledAtomStats>
    protoOutput->end(token);
}

void writeAtomMetricStatsToStream(const std::pair<int, StatsdStats::AtomMetricStats> &pair,
void writeAtomMetricStatsToStream(const std::pair<int64_t, StatsdStats::AtomMetricStats> &pair,
                                  util::ProtoOutputStream *protoOutput) {
    uint64_t token = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_ATOM_METRIC_STATS |
                                        FIELD_COUNT_REPEATED);
    protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_METRIC_ID, (int32_t)pair.first);
    protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_METRIC_ID, (long long)pair.first);
    protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_HARD_DIMENSION_LIMIT_REACHED,
                       (long long)pair.second.hardDimensionLimitReached);
    protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_LATE_LOG_EVENT_SKIPPED,
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ void writePullerStatsToStream(const std::pair<int, StatsdStats::PulledAtomStats>
                              util::ProtoOutputStream* protoOutput);

// Helper function to write AtomMetricStats to ProtoOutputStream
void writeAtomMetricStatsToStream(const std::pair<int, StatsdStats::AtomMetricStats> &pair,
void writeAtomMetricStatsToStream(const std::pair<int64_t, StatsdStats::AtomMetricStats> &pair,
                                  util::ProtoOutputStream *protoOutput);

template<class T>