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

Commit 0bd73dba authored by Chenjie Yu's avatar Chenjie Yu
Browse files

Puller refactor

1) Refactor pullers and add tests.

2) Add timeout to a puller.
mPullTimeoutNs is intrinsic to puller. A pull taking longer than this is
deemed failed and the data discarded.
A metric or StatsPullerManager requesting a pull should monitor the pull
and have deadlineNs. A successful pull may come later than desired due
to statsd processing delays.

3) Add unit tests to puller now that the base puller is more
complicated.

Bug: 118756964
Test: unit test
Change-Id: I0e5d47e2527391f7beef4b2d06bfd5c2f82f1179
parent b7fc0560
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -216,6 +216,7 @@ cc_test {
        "tests/anomaly/AnomalyTracker_test.cpp",
        "tests/ConfigManager_test.cpp",
        "tests/external/puller_util_test.cpp",
	"tests/external/StatsPuller_test.cpp",
        "tests/indexed_priority_queue_test.cpp",
        "tests/LogEntryMatcher_test.cpp",
        "tests/LogEvent_test.cpp",
+1 −1
Original line number Diff line number Diff line
@@ -704,7 +704,7 @@ status_t StatsService::cmd_log_app_breadcrumb(int out, const Vector<String8>& ar
status_t StatsService::cmd_print_pulled_metrics(int out, const Vector<String8>& args) {
    int s = atoi(args[1].c_str());
    vector<shared_ptr<LogEvent> > stats;
    if (mPullerManager->Pull(s, getElapsedRealtimeNs(), &stats)) {
    if (mPullerManager->Pull(s, &stats)) {
        for (const auto& it : stats) {
            dprintf(out, "Pull from %d: %s\n", s, it->ToString().c_str());
        }
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ namespace statsd {
class PowerStatsPuller : public StatsPuller {
public:
    PowerStatsPuller();

private:
    bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
};

+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ namespace statsd {
class ResourceHealthManagerPuller : public StatsPuller {
public:
    explicit ResourceHealthManagerPuller(int tagId);

private:
    bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
};

+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ namespace statsd {
class ResourceThermalManagerPuller : public StatsPuller {
public:
    ResourceThermalManagerPuller();

private:
    bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
};

Loading