From 8eb4a53de77d05425166bdfb79b3852fb6b423af Mon Sep 17 00:00:00 2001 From: Dina Belova Date: Mon, 18 Jan 2016 13:45:59 +0300 Subject: [PATCH] Use raw data storage for events to collect more info OSprofiler uses free-form notifications in fact, so any kind of data might be included to the profiling trace. To be able to do that in Ceilometer case, that use explicit event definitions, we need to use its raw data events storage, that will include all notification message. To use this feature the following section needs to be set in ceilometer.conf: [event] store_raw = info where info is the notification level used. Warning: if raw data is used, ALL events that come into ceilometer with info notification level will be stored with raw data included, there is no way to set this parameter only for profiler.* events. Change-Id: I3ebf8ee34ac01e68d530a676ae840f7a62d897bd --- osprofiler/parsers/ceilometer.py | 9 +--- osprofiler/tests/parsers/test_ceilometer.py | 48 ++++++++++----------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/osprofiler/parsers/ceilometer.py b/osprofiler/parsers/ceilometer.py index a87b319..b267979 100644 --- a/osprofiler/parsers/ceilometer.py +++ b/osprofiler/parsers/ceilometer.py @@ -77,19 +77,14 @@ def parse_notifications(notifications): "name": name.split("-")[0], "project": project, "service": service, - "meta.host": host, "host": host, }, "trace_id": trace_id, "parent_id": parent_id, } - skip_keys = ["base_id", "trace_id", "parent_id", - "name", "project", "service", "host", "timestamp"] - - for k in traits: - if k["name"] not in skip_keys: - result[trace_id]["info"]["meta.%s" % k["name"]] = k["value"] + result[trace_id]["info"]["meta.raw_payload.%s" % name] = n.get( + "raw", {}).get("payload", {}) if name.endswith("stop"): result[trace_id]["info"]["finished"] = timestamp diff --git a/osprofiler/tests/parsers/test_ceilometer.py b/osprofiler/tests/parsers/test_ceilometer.py index ffc548e..103f244 100644 --- a/osprofiler/tests/parsers/test_ceilometer.py +++ b/osprofiler/tests/parsers/test_ceilometer.py @@ -352,34 +352,32 @@ class CeilometerParserTestCase(test.TestCase): ] expected = {"children": [ - {"children": [ - {"children": [], - "info": {"finished": 76, - "host": "ubuntu", - "meta.db.params": "[]", - "meta.db.statement": "SELECT 1", - "meta.host": "ubuntu", - "name": "db", - "project": "keystone", - "service": "main", - "started": 56}, - "parent_id": "06320327-2c2c-45ae-923a-515de890276a", - "trace_id": "1baf1d24-9ca9-4f4c-bd3f-01b7e0c0735a"}], - "info": {"finished": 0, - "host": "ubuntu", - "meta.host": "ubuntu", - "meta.method": "POST", - "name": "wsgi", - "project": "keystone", - "service": "main", - "started": 0}, - "parent_id": "7253ca8c-33b3-4f84-b4f1-f5a4311ddfa4", - "trace_id": "06320327-2c2c-45ae-923a-515de890276a"}, + {"children": [{"children": [], + "info": {"finished": 76, + "host": "ubuntu", + "meta.raw_payload.db-start": {}, + "meta.raw_payload.db-stop": {}, + "name": "db", + "project": "keystone", + "service": "main", + "started": 56}, + "parent_id": "06320327-2c2c-45ae-923a-515de890276a", + "trace_id": "1baf1d24-9ca9-4f4c-bd3f-01b7e0c0735a"} + ], + "info": {"finished": 0, + "host": "ubuntu", + "meta.raw_payload.wsgi-start": {}, + "name": "wsgi", + "project": "keystone", + "service": "main", + "started": 0}, + "parent_id": "7253ca8c-33b3-4f84-b4f1-f5a4311ddfa4", + "trace_id": "06320327-2c2c-45ae-923a-515de890276a"}, {"children": [], "info": {"finished": 41, "host": "ubuntu", - "meta.host": "ubuntu", - "meta.method": "GET", + "meta.raw_payload.wsgi-start": {}, + "meta.raw_payload.wsgi-stop": {}, "name": "wsgi", "project": "keystone", "service": "main",