)]}'
{"ceilometer/api/controllers/v2/events.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"78ae35dfef0318ad8677a0b755750bd2a73418dc","unresolved":false,"context_lines":[{"line_number":32,"context_line":"from ceilometer.api.controllers.v2 import utils as v2_utils"},{"line_number":33,"context_line":"from ceilometer.event.storage import models as event_models"},{"line_number":34,"context_line":"from ceilometer.i18n import _"},{"line_number":35,"context_line":"from ceilometer.objects import event as object_event"},{"line_number":36,"context_line":"from ceilometer import storage"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"LOG \u003d log.getLogger(__name__)"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a4dcd0f_d7552950","line":35,"updated":"2015-08-05 13:26:19.000000000","message":"Is there a particular reason you\u0027ve chosen \"object_event\"? It reads weirdly and suggests that there is an object that is having an event and the value of that even is the value of \"object_event\".\n\nIf this is a standard naming scheme with versioned objects, that\u0027s okay, it is suitably learnable, and there\u0027s precedent. If there\u0027s not precedent, something else might be more readable.","commit_id":"92f800e0e182ec9c01a14355335b60cc568c6d80"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"6e86f5187a4c5c8af9998dea601e5c0f488360d4","unresolved":false,"context_lines":[{"line_number":209,"context_line":"        :param event_type: Event type to filter traits by"},{"line_number":210,"context_line":"        \"\"\""},{"line_number":211,"context_line":"        get_trait_name \u003d event_models.Trait.get_name_by_type"},{"line_number":212,"context_line":"        conn \u003d pecan.request.event_storage_conn"},{"line_number":213,"context_line":"        trait_types \u003d object_event.Trait.get_types(conn, event_type)"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        return [TraitDescription(name\u003dt[\u0027name\u0027],"}],"source_content_type":"text/x-python","patch_set":12,"id":"da20952f_d1ef56e7","line":212,"updated":"2015-08-29 06:50:32.000000000","message":"AFAK, the versioning object is designed to be transparent about db connection to object users, here it is weird we need to provide a conn parameter to every object method. I think maybe it is better to init a db connection in object base class when api server starting. seems this can be done in a API Hook class, like this:\n\nhttps://github.com/openstack/ceilometer/blob/master/ceilometer/api/hooks.py#L43","commit_id":"a4bba888fb9fa5309785942094a34b285ab8cb46"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"902d7edcbbe29076510b4fa0297291db560b8379","unresolved":false,"context_lines":[{"line_number":209,"context_line":"        :param event_type: Event type to filter traits by"},{"line_number":210,"context_line":"        \"\"\""},{"line_number":211,"context_line":"        get_trait_name \u003d event_models.Trait.get_name_by_type"},{"line_number":212,"context_line":"        conn \u003d pecan.request.event_storage_conn"},{"line_number":213,"context_line":"        trait_types \u003d object_event.Trait.get_types(conn, event_type)"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        return [TraitDescription(name\u003dt[\u0027name\u0027],"}],"source_content_type":"text/x-python","patch_set":12,"id":"da20952f_cc49f961","line":212,"in_reply_to":"da20952f_d1ef56e7","updated":"2015-08-29 07:38:45.000000000","message":"it don\u0027t need a Hook, just get the the db connection from cfg.CONF, or do some thing in prepare_service() method.","commit_id":"a4bba888fb9fa5309785942094a34b285ab8cb46"}],"ceilometer/objects/event.py":[{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"3cb4ffe4fdd03a5e369a9e206954798072191cc3","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    @classmethod"},{"line_number":45,"context_line":"    def get_all(cls, *args, **kwargs):"},{"line_number":46,"context_line":"        return [cls._from_db_object(cls(), db_trait)"},{"line_number":47,"context_line":"                for db_trait in db_api().get_traits(*args, **kwargs)]"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @classmethod"},{"line_number":50,"context_line":"    def get_types(cls, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_caad5b85","line":47,"updated":"2015-07-22 13:38:37.000000000","message":"the db_api() method is used to get storage connection, in this list expression, every loop, the storage connection will need to be created repeatedly.","commit_id":"76ddc1b18df344f0c22628142e5b6d673fa21844"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"878112f7b698f1fdde1204dfaba60660171fee24","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    @classmethod"},{"line_number":45,"context_line":"    def get_all(cls, *args, **kwargs):"},{"line_number":46,"context_line":"        return [cls._from_db_object(cls(), db_trait)"},{"line_number":47,"context_line":"                for db_trait in db_api().get_traits(*args, **kwargs)]"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @classmethod"},{"line_number":50,"context_line":"    def get_types(cls, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_e11cd96b","line":47,"in_reply_to":"3a50d1a3_caad5b85","updated":"2015-07-23 02:39:48.000000000","message":"please ignore above comment. but maybe it is better to implement the db_api() method in the base class, maybe it\u0027s better like this:\n\nDB_API\u003dNone\n\nclass Trait()\n\n...\n\n@property\ndef db_api()\n    if not DB_API:\n        DB_API \u003d storage.get_connection_from_config(cfg.CONF, \u0027event\u0027)\n    return DB_API\n\nand this can be a generator than a list expression, because we will traverse this result again and return a list. see the line203 of [1]\n\n[1] https://review.openstack.org/#/c/181338/9/ceilometer/api/controllers/v2/events.py","commit_id":"76ddc1b18df344f0c22628142e5b6d673fa21844"}]}
