Browse Source

correction de la requete sql des gauges

dpacaud 12 years ago
parent
commit
9ca5ed8158
3 changed files with 8 additions and 7 deletions
  1. 1 1
      engines/gaugesEngine.js
  2. 6 5
      run_tests.js
  3. 1 1
      tables/gauges_statistics.sql

+ 1 - 1
engines/gaugesEngine.js

@@ -27,7 +27,7 @@ MySQLBackendGaugesEngine.prototype.buildQuerries = function(gauges, time_stamp)
          *    - userCounterName: Counter name
          *    - counterValue: Counter value
          */
-        querries.push("insert into `gauges_statistics` values ("+time_stamp+", '"+gaugeName+"', "+gaugeValue+") on duplicate key update value = " + gaugeValue + ", timestamp = " + time_stamp);
+        querries.push("insert into `gauges_statistics` values ("+time_stamp+", '"+gaugeName+"', "+gaugeValue+");");
       }
     }
 

+ 6 - 5
run_tests.js

@@ -15,10 +15,11 @@ var DEBUG = false;
 // Splice arguments
 var arguments = process.argv.splice(2);
 
-var nbUserKeys = parseInt(arguments[0]);
-var nbPacketsPerUser = parseInt(arguments[1]);
-var nbRequestsBeforeWait = parseInt(arguments[2]);
-var waitTime = parseInt(arguments[3]);
+var dataType = arguments[0]
+var nbUserKeys = parseInt(arguments[1]);
+var nbPacketsPerUser = parseInt(arguments[2]);
+var nbRequestsBeforeWait = parseInt(arguments[3]);
+var waitTime = parseInt(arguments[4]);
 
 if(!nbRequestsBeforeWait) nbRequestsBeforeWait = 10; // Default nbRequests before wait: 10;
 if(!waitTime) waitTime = 5;	//Default wait time: 5 seconds
@@ -123,7 +124,7 @@ var sendPackets = function () {
 	// Build packet message
 	var str = keysPattern.replace('${userKey}', userKey);
 	str = str.replace('${value}', value);
-	str = str.replace('${type}', 'c');
+	str = str.replace('${type}', dataType);
 	var message = new Buffer(str);
 	if(DEBUG) console.log("  - packet: " + message);
 

+ 1 - 1
tables/gauges_statistics.sql

@@ -5,4 +5,4 @@ CREATE  TABLE `statsd_db`.`gauges_statistics` (
     `timestamp` BIGINT NOT NULL ,
     `name` VARCHAR(255) NOT NULL ,
     `value` INT(11) NOT NULL ,
-PRIMARY KEY (`name`, `timestamp`) )$$
+PRIMARY KEY (`timestamp`) )$$