You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2013/03/09 02:20:10 UTC

svn commit: r1454635 - /incubator/mesos/branches/0.12.x/third_party/libprocess/src/statistics.cpp

Author: benh
Date: Sat Mar  9 01:20:10 2013
New Revision: 1454635

URL: http://svn.apache.org/r1454635
Log:
Fixed a bug in the slave that crashed it when
hitting /statistics/snapshot.json.

From: Ben Mahler <be...@gmail.com>
Review: https://reviews.apache.org/r/9748

Modified:
    incubator/mesos/branches/0.12.x/third_party/libprocess/src/statistics.cpp

Modified: incubator/mesos/branches/0.12.x/third_party/libprocess/src/statistics.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.12.x/third_party/libprocess/src/statistics.cpp?rev=1454635&r1=1454634&r2=1454635&view=diff
==============================================================================
--- incubator/mesos/branches/0.12.x/third_party/libprocess/src/statistics.cpp (original)
+++ incubator/mesos/branches/0.12.x/third_party/libprocess/src/statistics.cpp Sat Mar  9 01:20:10 2013
@@ -346,21 +346,19 @@ Future<Response> StatisticsProcess::snap
 
   foreachkey (const string& context, statistics) {
     foreachkey (const string& name, statistics[context]) {
-      // Exclude archived time series.
-      if (statistics[context][name].archived) {
+      // Exclude archived and empty time series.
+      if (statistics[context][name].archived ||
+          statistics[context][name].values.empty()) {
         continue;
       }
 
       // Skip statistics that don't match the query, if present.
       if (queryContext.isSome() && queryContext.get() != context) {
         continue;
-      }
-      if (queryName.isSome() && queryName.get() != name) {
+      } else if (queryName.isSome() && queryName.get() != name) {
         continue;
       }
 
-      CHECK(statistics[context][name].values.size() > 0);
-
       JSON::Object object;
       object.values["context"] = context;
       object.values["name"] = name;