Merge lp:~lucio.torre/txstatsd/distinct-plugin-fix-bucket-name into lp:~txstatsd-dev/txstatsd/distinct-plugin

Proposed by Lucio Torre
Status: Merged
Approved by: Lucio Torre
Approved revision: 8
Merge reported by: Lucio Torre
Merged at revision: not available
Proposed branch: lp:~lucio.torre/txstatsd/distinct-plugin-fix-bucket-name
Merge into: lp:~txstatsd-dev/txstatsd/distinct-plugin
Diff against target: 30 lines (+10/-2)
2 files modified
distinctdb/distinctmetric.py (+1/-1)
distinctdb/tests/test_distinct.py (+9/-1)
To merge this branch: bzr merge lp:~lucio.torre/txstatsd/distinct-plugin-fix-bucket-name
Reviewer Review Type Date Requested Status
Sidnei da Silva Approve
Review via email: mp+96436@code.launchpad.net

Commit message

fix bucket name

Description of the change

make sure metrics get one bucket for each

To post a comment you must log in.
Revision history for this message
Sidnei da Silva (sidnei) wrote :

Looks good, +1!

review: Approve
Revision history for this message
Ubuntu One Server Tarmac Bot (ubuntuone-server-tarmac) wrote :
Download full text (4.6 KiB)

The attempt to merge lp:~lucio.torre/txstatsd/distinct-plugin-fix-bucket-name into lp:~txstatsd-dev/txstatsd/distinct-plugin failed. Below is the output from the failed tests.

./bin/start-database.sh
## Starting postgres in /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1 ##
The files belonging to this database system will be owned by user "tarmac".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

fixing permissions on existing directory /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 28MB
creating configuration files ... ok
creating template1 database in /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/8.4/bin/postgres -D /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data
or
    /usr/lib/postgresql/8.4/bin/pg_ctl -D /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data -l logfile start

waiting for server to start.... done
server started
CREATE ROLE
To set your environment so psql will connect to this DB instance type:
    export PGHOST=/mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1
## Done. ##
psql -h `pwd`/tmp/db1 -d distinct < bin/schema.sql
CREATE TABLE
CREATE TABLE
CREATE INDEX
./bin/start-redis.sh
trial distinctdb/
                                                                        [ERROR]

===============================================================================
[ERROR]: distinctdb.tests.test_distinct

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py", line 563, in loadPackage
    module = modinfo.load()
  File "/usr/lib/python2.6/dist-packages/twisted/python/modules.py", line 381, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/usr/lib/python2.6/dist-packages/twisted/python/reflect.py", line 464, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/mnt/tarmac/cache/txstatsd/distinct-plugin/distinctdb/tests/test_distinct.py", line 22, in <module>
    from twisted.plugins import distinctdbplugin
  File "/mnt/tarmac/cache/txstatsd/distinct-plugin/twisted/plugins/distinctdbplugin.py", line 4, in <module>
    from txstatsd.itxstatsd import IMetricFactory
exceptions.ImportError: No module named txstatsd.itxstatsd
-------------------------------------------------------------------------------

FAILED (errors=1)

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
ERROR: role "client" already exi...

Read more...

Revision history for this message
Ubuntu One Server Tarmac Bot (ubuntuone-server-tarmac) wrote :
Download full text (4.0 KiB)

The attempt to merge lp:~lucio.torre/txstatsd/distinct-plugin-fix-bucket-name into lp:~txstatsd-dev/txstatsd/distinct-plugin failed. Below is the output from the failed tests.

./bin/start-database.sh
## Starting postgres in /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1 ##
The files belonging to this database system will be owned by user "tarmac".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

fixing permissions on existing directory /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 28MB
creating configuration files ... ok
creating template1 database in /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/8.4/bin/postgres -D /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data
or
    /usr/lib/postgresql/8.4/bin/pg_ctl -D /mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1/data -l logfile start

waiting for server to start.... done
server started
CREATE ROLE
To set your environment so psql will connect to this DB instance type:
    export PGHOST=/mnt/tarmac/cache/txstatsd/distinct-plugin/tmp/db1
## Done. ##
psql -h `pwd`/tmp/db1 -d distinct < bin/schema.sql
CREATE TABLE
CREATE TABLE
CREATE INDEX
./bin/start-redis.sh
trial distinctdb/
distinctdb.tests.test_distinct
  TestDatabase
    test_connect ... [OK]
    test_create_metric_id ... [OK]
    test_find_saved_data ... [OK]
    test_load_metric_id ... [OK]
  TestDistinctMetricReporter
    test_configure ... [OK]
    test_get_bucket_no ... [OK]
    test_max ... [OK]
    test_reports ... [OK]
  TestPlugin
    test_factory ... [OK]
  TestRedis
    test_bucket_name ... [OK]
    test_configure ... [OK]
    test_connect ... [OK]
    test_load ... [OK]
/usr/lib/pymodules/python2.6/redis/client.py:814: DeprecationWarning: Passing 'value' and 'score' has been deprecated. Please pass via kwargs instead.
    test_usage ... ...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'distinctdb/distinctmetric.py'
2--- distinctdb/distinctmetric.py 2011-12-15 21:13:11 +0000
3+++ distinctdb/distinctmetric.py 2012-03-07 19:24:31 +0000
4@@ -75,7 +75,7 @@
5 reactor.callInThread(self._update_count, item, now)
6
7 def bucket_name_for(self, period):
8- return "bucket_" + str(period)
9+ return self.name + "_bucket_" + str(period)
10
11 def _update_count(self, value, when):
12 for period in self.periods:
13
14=== modified file 'distinctdb/tests/test_distinct.py'
15--- distinctdb/tests/test_distinct.py 2011-12-15 21:13:11 +0000
16+++ distinctdb/tests/test_distinct.py 2012-03-07 19:24:31 +0000
17@@ -220,4 +220,12 @@
18 dmr._flush_redis(time.time())
19 duration = time.time() - start
20 self.assertEquals(dmr.count_1hour(), 1000)
21- self.assertTrue(duration < 10)
22+ self.assertTrue(duration < 10)
23+
24+ def test_bucket_name(self):
25+ dmr1 = distinct.DistinctMetricReporter("somename")
26+ dmr2 = distinct.DistinctMetricReporter("othename")
27+ dmr3 = distinct.DistinctMetricReporter("somename")
28+
29+ self.assertEquals(dmr1.bucket_name_for(1), dmr3.bucket_name_for(1))
30+ self.assertNotEquals(dmr1.bucket_name_for(1), dmr2.bucket_name_for(1))

Subscribers

People subscribed via source and target branches