Author: nunofsantos
Date: 2007-11-16 16:59:23 -0500 (Fri, 16 Nov 2007)
New Revision: 1329
Modified:
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schema.py
mgmt/mint/python/mint/schema.sql
mgmt/mint/schemaparser.py
Log:
add statsPrev (statistics from the previous time interval) to all entities
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-16 20:07:46 UTC (rev 1328)
+++ mgmt/mint/python/mint/__init__.py 2007-11-16 21:59:23 UTC (rev 1329)
@@ -111,6 +111,7 @@
d = dict()
if (timestamps[2] != 0):
d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
+ d["statsPrev"] = queue.stats
d["stats"] = queueStats
queue.set(**d)
result = queueStats
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2007-11-16 20:07:46 UTC (rev 1328)
+++ mgmt/mint/python/mint/schema.py 2007-11-16 21:59:23 UTC (rev 1329)
@@ -11,6 +11,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('SystemStats', cascade='null', default=None)
+ statsPrev = ForeignKey('SystemStats', cascade='null', default=None)
sysId = StringCol(length=1000, default=None)
class SystemStats(SQLObject):
@@ -25,6 +26,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('BrokerStats', cascade='null', default=None)
+ statsPrev = ForeignKey('BrokerStats', cascade='null', default=None)
system = ForeignKey('System', cascade='null', default=None)
port = SmallIntCol(default=None)
workerThreads = SmallIntCol(default=None)
@@ -75,6 +77,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('VhostStats', cascade='null', default=None)
+ statsPrev = ForeignKey('VhostStats', cascade='null', default=None)
broker = ForeignKey('Broker', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -90,6 +93,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('QueueStats', cascade='null', default=None)
+ statsPrev = ForeignKey('QueueStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
name = StringCol(length=1000, default=None)
durable = BoolCol(default=None)
@@ -164,6 +168,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('ExchangeStats', cascade='null', default=None)
+ statsPrev = ForeignKey('ExchangeStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
name = StringCol(length=1000, default=None)
type = StringCol(length=1000, default=None)
@@ -192,6 +197,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('BindingStats', cascade='null', default=None)
+ statsPrev = ForeignKey('BindingStats', cascade='null', default=None)
queue = ForeignKey('Queue', cascade='null', default=None)
exchange = ForeignKey('Exchange', cascade='null', default=None)
bindingKey = StringCol(length=1000, default=None)
@@ -209,6 +215,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('ClientStats', cascade='null', default=None)
+ statsPrev = ForeignKey('ClientStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
ipAddr = IntCol(default=None)
port = SmallIntCol(default=None)
@@ -240,6 +247,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('SessionStats', cascade='null', default=None)
+ statsPrev = ForeignKey('SessionStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
name = StringCol(length=1000, default=None)
client = ForeignKey('Client', cascade='null', default=None)
@@ -280,6 +288,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('DestinationStats', cascade='null', default=None)
+ statsPrev = ForeignKey('DestinationStats', cascade='null',
default=None)
session = ForeignKey('Session', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -317,6 +326,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('ProducerStats', cascade='null', default=None)
+ statsPrev = ForeignKey('ProducerStats', cascade='null', default=None)
destination = ForeignKey('Destination', cascade='null', default=None)
exchange = ForeignKey('Exchange', cascade='null', default=None)
@@ -334,6 +344,7 @@
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
stats = ForeignKey('ConsumerStats', cascade='null', default=None)
+ statsPrev = ForeignKey('ConsumerStats', cascade='null', default=None)
destination = ForeignKey('Destination', cascade='null', default=None)
queue = ForeignKey('Queue', cascade='null', default=None)
Modified: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql 2007-11-16 20:07:46 UTC (rev 1328)
+++ mgmt/mint/python/mint/schema.sql 2007-11-16 21:59:23 UTC (rev 1329)
@@ -6,6 +6,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
queue_id INT,
exchange_id INT,
binding_key VARCHAR(1000)
@@ -27,6 +28,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
system_id INT,
port SMALLINT,
worker_threads SMALLINT,
@@ -57,6 +59,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
vhost_id INT,
ip_addr INT,
port SMALLINT
@@ -82,6 +85,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
destination_id INT,
queue_id INT
);
@@ -106,6 +110,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
session_id INT,
name VARCHAR(1000)
);
@@ -130,6 +135,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
type VARCHAR(1000)
@@ -162,6 +168,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
destination_id INT,
exchange_id INT
);
@@ -183,6 +190,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
durable BOOL,
@@ -248,6 +256,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
client_id INT,
@@ -272,6 +281,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
sys_id VARCHAR(1000)
);
@@ -290,6 +300,7 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_id INT,
+ stats_prev_id INT,
broker_id INT,
name VARCHAR(1000)
);
@@ -303,6 +314,8 @@
ALTER TABLE binding ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
binding_stats (id) ON DELETE SET NULL;
+ALTER TABLE binding ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES binding_stats (id) ON DELETE SET NULL;
+
ALTER TABLE binding ADD CONSTRAINT queue_id_exists FOREIGN KEY (queue_id) REFERENCES
queue (id) ON DELETE SET NULL;
ALTER TABLE binding ADD CONSTRAINT exchange_id_exists FOREIGN KEY (exchange_id)
REFERENCES exchange (id) ON DELETE SET NULL;
@@ -311,18 +324,24 @@
ALTER TABLE broker ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
broker_stats (id) ON DELETE SET NULL;
+ALTER TABLE broker ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES broker_stats (id) ON DELETE SET NULL;
+
ALTER TABLE broker ADD CONSTRAINT system_id_exists FOREIGN KEY (system_id) REFERENCES
system (id) ON DELETE SET NULL;
ALTER TABLE broker_stats ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id)
REFERENCES broker (id) ON DELETE SET NULL;
ALTER TABLE client ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
client_stats (id) ON DELETE SET NULL;
+ALTER TABLE client ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES client_stats (id) ON DELETE SET NULL;
+
ALTER TABLE client ADD CONSTRAINT vhost_id_exists FOREIGN KEY (vhost_id) REFERENCES vhost
(id) ON DELETE SET NULL;
ALTER TABLE client_stats ADD CONSTRAINT client_id_exists FOREIGN KEY (client_id)
REFERENCES client (id) ON DELETE SET NULL;
ALTER TABLE consumer ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
consumer_stats (id) ON DELETE SET NULL;
+ALTER TABLE consumer ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES consumer_stats (id) ON DELETE SET NULL;
+
ALTER TABLE consumer ADD CONSTRAINT destination_id_exists FOREIGN KEY (destination_id)
REFERENCES destination (id) ON DELETE SET NULL;
ALTER TABLE consumer ADD CONSTRAINT queue_id_exists FOREIGN KEY (queue_id) REFERENCES
queue (id) ON DELETE SET NULL;
@@ -331,18 +350,24 @@
ALTER TABLE destination ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
destination_stats (id) ON DELETE SET NULL;
+ALTER TABLE destination ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES destination_stats (id) ON DELETE SET NULL;
+
ALTER TABLE destination ADD CONSTRAINT session_id_exists FOREIGN KEY (session_id)
REFERENCES session (id) ON DELETE SET NULL;
ALTER TABLE destination_stats ADD CONSTRAINT destination_id_exists FOREIGN KEY
(destination_id) REFERENCES destination (id) ON DELETE SET NULL;
ALTER TABLE exchange ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
exchange_stats (id) ON DELETE SET NULL;
+ALTER TABLE exchange ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES exchange_stats (id) ON DELETE SET NULL;
+
ALTER TABLE exchange ADD CONSTRAINT vhost_id_exists FOREIGN KEY (vhost_id) REFERENCES
vhost (id) ON DELETE SET NULL;
ALTER TABLE exchange_stats ADD CONSTRAINT exchange_id_exists FOREIGN KEY (exchange_id)
REFERENCES exchange (id) ON DELETE SET NULL;
ALTER TABLE producer ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
producer_stats (id) ON DELETE SET NULL;
+ALTER TABLE producer ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES producer_stats (id) ON DELETE SET NULL;
+
ALTER TABLE producer ADD CONSTRAINT destination_id_exists FOREIGN KEY (destination_id)
REFERENCES destination (id) ON DELETE SET NULL;
ALTER TABLE producer ADD CONSTRAINT exchange_id_exists FOREIGN KEY (exchange_id)
REFERENCES exchange (id) ON DELETE SET NULL;
@@ -351,12 +376,16 @@
ALTER TABLE queue ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
queue_stats (id) ON DELETE SET NULL;
+ALTER TABLE queue ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES queue_stats (id) ON DELETE SET NULL;
+
ALTER TABLE queue ADD CONSTRAINT vhost_id_exists FOREIGN KEY (vhost_id) REFERENCES vhost
(id) ON DELETE SET NULL;
ALTER TABLE queue_stats ADD CONSTRAINT queue_id_exists FOREIGN KEY (queue_id) REFERENCES
queue (id) ON DELETE SET NULL;
ALTER TABLE session ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
session_stats (id) ON DELETE SET NULL;
+ALTER TABLE session ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES session_stats (id) ON DELETE SET NULL;
+
ALTER TABLE session ADD CONSTRAINT vhost_id_exists FOREIGN KEY (vhost_id) REFERENCES
vhost (id) ON DELETE SET NULL;
ALTER TABLE session ADD CONSTRAINT client_id_exists FOREIGN KEY (client_id) REFERENCES
client (id) ON DELETE SET NULL;
@@ -365,10 +394,14 @@
ALTER TABLE system ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
system_stats (id) ON DELETE SET NULL;
+ALTER TABLE system ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES system_stats (id) ON DELETE SET NULL;
+
ALTER TABLE system_stats ADD CONSTRAINT system_id_exists FOREIGN KEY (system_id)
REFERENCES system (id) ON DELETE SET NULL;
ALTER TABLE vhost ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES
vhost_stats (id) ON DELETE SET NULL;
+ALTER TABLE vhost ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES vhost_stats (id) ON DELETE SET NULL;
+
ALTER TABLE vhost ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES
broker (id) ON DELETE SET NULL;
ALTER TABLE vhost_stats ADD CONSTRAINT vhost_id_exists FOREIGN KEY (vhost_id) REFERENCES
vhost (id) ON DELETE SET NULL;
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-16 20:07:46 UTC (rev 1328)
+++ mgmt/mint/schemaparser.py 2007-11-16 21:59:23 UTC (rev 1329)
@@ -82,6 +82,7 @@
self.generateTimestampAttrib("deletion")
self.generateAttrib("managedBroker", "StringCol",
"length=1000")
self.generateForeignKeyAttrib("stats", statsPythonName)
+ self.generateForeignKeyAttrib("statsPrev", statsPythonName)
self.final += "classToSchemaNameMap['%s'] = '%s'\n" %
(pythonName, schemaName)
def generateMethod(self, elem):