OSDN Git Service

Turn off verbose logging, remove the fake config.
authorYao Chen <yaochen@google.com>
Sat, 16 Dec 2017 22:34:20 +0000 (14:34 -0800)
committerYao Chen <yaochen@google.com>
Sat, 16 Dec 2017 22:34:20 +0000 (14:34 -0800)
Test: statsd_test & manual
Change-Id: I43068c8db006cbbeccacaa9d8426ab4d0394313a

12 files changed:
cmds/statsd/src/Log.h
cmds/statsd/src/condition/CombinationConditionTracker.cpp
cmds/statsd/src/config/ConfigManager.cpp
cmds/statsd/src/metrics/CountMetricProducer.cpp
cmds/statsd/src/metrics/DurationMetricProducer.cpp
cmds/statsd/src/metrics/EventMetricProducer.cpp
cmds/statsd/src/metrics/GaugeMetricProducer.cpp
cmds/statsd/src/metrics/ValueMetricProducer.cpp
cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.cpp
cmds/statsd/src/metrics/duration_helper/OringDurationTracker.cpp
cmds/statsd/tests/ConfigManager_test.cpp
cmds/statsd/tools/loadtest/src/com/android/statsd/loadtest/LoadtestActivity.java

index 7852709..87f4cba 100644 (file)
@@ -26,5 +26,8 @@
 
 #include <log/log.h>
 
+// Use the local value to turn on/off debug logs instead of using log.tag. properties.
+// The advantage is that in production compiler can remove the logging code if the local
+// DEBUG/VERBOSE is false.
 #define VLOG(...) \
     if (DEBUG) ALOGD(__VA_ARGS__);
index 02aca1a..bb4b817 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define DEBUG true  // STOPSHIP if true
+#define DEBUG false  // STOPSHIP if true
 #include "Log.h"
 #include "CombinationConditionTracker.h"
 
index 164f88f..0564c7d 100644 (file)
@@ -55,8 +55,9 @@ void ConfigManager::Startup() {
     // for (const auto& pair : configsFromDisk) {
     //    UpdateConfig(pair.first, pair.second);
     //}
-    // this should be called from StatsService when it receives a statsd_config
-    UpdateConfig(ConfigKey(1000, "fake"), build_fake_config());
+
+    // Uncomment the following line and use the hard coded config for development.
+    // UpdateConfig(ConfigKey(1000, "fake"), build_fake_config());
 }
 
 void ConfigManager::AddListener(const sp<ConfigListener>& listener) {
index 7b865c2..bc12a78 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define DEBUG true  // STOPSHIP if true
+#define DEBUG false  // STOPSHIP if true
 #include "Log.h"
 
 #include "CountMetricProducer.h"
index 6afbe45..220861d 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define DEBUG true
+#define DEBUG false
 
 #include "Log.h"
 #include "DurationMetricProducer.h"
index 4752997..6a072b0 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define DEBUG true  // STOPSHIP if true
+#define DEBUG false  // STOPSHIP if true
 #include "Log.h"
 
 #include "EventMetricProducer.h"
index ae9b86f..98014a3 100644 (file)
@@ -14,7 +14,7 @@
 * limitations under the License.
 */
 
-#define DEBUG true  // STOPSHIP if true
+#define DEBUG false  // STOPSHIP if true
 #include "Log.h"
 
 #include "GaugeMetricProducer.h"
index 9400a1c..b0b0807 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define DEBUG true  // STOPSHIP if true
+#define DEBUG false  // STOPSHIP if true
 #include "Log.h"
 
 #include "ValueMetricProducer.h"
index 08c9135..95c8a59 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define DEBUG true
+#define DEBUG false
 
 #include "Log.h"
 #include "MaxDurationTracker.h"
index 8122744..36e25ed 100644 (file)
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#define DEBUG true
+#define DEBUG false
 #include "Log.h"
 #include "OringDurationTracker.h"
 #include "guardrail/StatsdStats.h"
index 696fddf..90d3e82 100644 (file)
@@ -88,12 +88,6 @@ TEST(ConfigManagerTest, TestAddUpdateRemove) {
     {
         InSequence s;
 
-        // The built-in fake one.
-        // TODO: Remove this when we get rid of the fake one, and make this
-        // test loading one from disk somewhere.
-        EXPECT_CALL(*(listener.get()),
-                    OnConfigUpdated(ConfigKeyEq(1000, "fake"), StatsdConfigEq("CONFIG_12345")))
-                .RetiresOnSaturation();
         manager->Startup();
 
         // Add another one
@@ -147,7 +141,7 @@ TEST(ConfigManagerTest, TestRemoveUid) {
 
     StatsdConfig config;
 
-    EXPECT_CALL(*(listener.get()), OnConfigUpdated(_, _)).Times(6);
+    EXPECT_CALL(*(listener.get()), OnConfigUpdated(_, _)).Times(5);
     EXPECT_CALL(*(listener.get()), OnConfigRemoved(ConfigKeyEq(2, "xxx")));
     EXPECT_CALL(*(listener.get()), OnConfigRemoved(ConfigKeyEq(2, "yyy")));
     EXPECT_CALL(*(listener.get()), OnConfigRemoved(ConfigKeyEq(2, "zzz")));
index a72f72e..0a30ff8 100644 (file)
@@ -419,11 +419,6 @@ public class LoadtestActivity extends Activity {
     private void clearConfigs() {
         // TODO: Clear all configs instead of specific ones.
         if (mStatsManager != null) {
-            if (!mStatsManager.removeConfiguration("fake")) {
-                Log.d(TAG, "Removed \"fake\" statsd configs.");
-            } else {
-                Log.d(TAG, "Failed to remove \"fake\" config. Loadtest results cannot be trusted.");
-            }
             if (mStarted) {
                 if (!mStatsManager.removeConfiguration(ConfigFactory.CONFIG_NAME)) {
                     Log.d(TAG, "Removed loadtest statsd configs.");