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

Commit 5135d2a7 authored by Howard Ro's avatar Howard Ro Committed by Automerger Merge Worker
Browse files

Merge "Populate initial base info with unknown state values" into rvc-dev am:...

Merge "Populate initial base info with unknown state values" into rvc-dev am: c02b6d44 am: 4bb59689

Change-Id: I6033c85822d78339dfb85ec9f8a2e1ca2f3adb30
parents 8082fe6e 4bb59689
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -293,6 +293,17 @@ void MetricProducer::mapStateValue(const int32_t atomId, FieldValue* value) {
    }
}

HashableDimensionKey MetricProducer::getUnknownStateKey() {
    HashableDimensionKey stateKey;
    for (auto atom : mSlicedStateAtoms) {
        FieldValue fieldValue;
        fieldValue.mField.setTag(atom);
        fieldValue.mValue.setInt(StateTracker::kStateUnknown);
        stateKey.addValue(fieldValue);
    }
    return stateKey;
}

DropEvent MetricProducer::buildDropEvent(const int64_t dropTimeNs, const BucketDropReason reason) {
    DropEvent event;
    event.reason = reason;
+4 −0
Original line number Diff line number Diff line
@@ -386,6 +386,10 @@ protected:
    // If no state map exists, keep the original state value.
    void mapStateValue(const int32_t atomId, FieldValue* value);

    // Returns a HashableDimensionKey with unknown state value for each state
    // atom.
    HashableDimensionKey getUnknownStateKey();

    DropEvent buildDropEvent(const int64_t dropTimeNs, const BucketDropReason reason);

    // Returns true if the number of drop events in the current bucket has
+6 −4
Original line number Diff line number Diff line
@@ -773,22 +773,24 @@ void ValueMetricProducer::onMatchedLogEventInternalLocked(
    bool shouldSkipForPulledMetric = mIsPulled && !mUseDiff
            && mCondition != ConditionState::kTrue;
    if (shouldSkipForPushMetric || shouldSkipForPulledMetric) {
        VLOG("ValueMetric skip event because condition is false");
        VLOG("ValueMetric skip event because condition is false and we are not using diff (for "
             "pulled metric)");
        return;
    }

    if (hitGuardRailLocked(eventKey)) {
        return;
    }

    vector<BaseInfo>& baseInfos = mCurrentBaseInfo[whatKey];
    if (baseInfos.size() < mFieldMatchers.size()) {
        VLOG("Resizing number of intervals to %d", (int)mFieldMatchers.size());
        baseInfos.resize(mFieldMatchers.size());
    }

    for (auto baseInfo : baseInfos) {
    for (BaseInfo& baseInfo : baseInfos) {
        if (!baseInfo.hasCurrentState) {
            baseInfo.currentState = DEFAULT_DIMENSION_KEY;
            baseInfo.currentState = getUnknownStateKey();
            baseInfo.hasCurrentState = true;
        }
    }
@@ -1056,7 +1058,7 @@ void ValueMetricProducer::initCurrentSlicedBucket(int64_t nextBucketStartTimeNs)
        } else {
            it++;
        }
        // TODO: remove mCurrentBaseInfo entries when obsolete
        // TODO(b/157655103): remove mCurrentBaseInfo entries when obsolete
    }

    mCurrentBucketIsSkipped = false;
+291 −80

File changed.

Preview size limit exceeded, changes collapsed.