Integrate OSprofiler and Trove

*) Add osprofiler wsgi middleware
This middleware is used for 2 things:
1) It checks that the person who wants to trace is trusted and knows
the secret HMAC key.
2) It start tracing in case of proper trace headers
and adds the first wsgi trace point, with info about the HTTP request.

*) Add initialization of osprofiler at start of service
Initialize osprofiler with oslo.messaging notifier which
is used to send notifications to Ceilometer.

*) Use profile enabled context in services rpc interaction
Change context serializer to pass profile context to service;
rpc server will use trace info to initialize their profile context
to continue the profiling for the request as a transaction.

*) Add tracing on service manager and sqlalchemy db engine object

NOTE to test this:
You should put to localrc:
  CEILOMETER_NOTIFICATION_TOPICS=notifications,profiler
  ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral
  ENABLED_SERVICES+=,ceilometer-anotification,ceilometer-collector
  ENABLED_SERVICES+=,ceilometer-alarm-evaluator,ceilometer-alarm-notifier
  ENABLED_SERVICES+=,ceilometer-api

Run any command with --profile <SECRET_KEY>
  $ trove --profile <SECRET_KEY> list
  # it will print <Trace ID>
Get pretty HTML with traces:
  $ osprofiler trace show --html <Trace ID>
Note: Trace showing can be executed with the admin account only.

The change to enable Trove exchange in ceilometer has been merged:
Idce1c327c6d21a767c612c13c1ad52a794017d71 .

The change to enable profile in python-troveclient has been merged:
I5a76e11d428c63d33f6d2c2021426090ebf8340c

We prepared a common BP in oslo-spec as the integration change is
similar in all projects: I95dccdc9f274661767d2659c18b96da169891f30
Currently there are 2 other projects are using osprofiler: Glance &
Cinder, and some others are a work in progress.

Change-Id: I580cce8d2b3c4ec9ce625ac09de6f14e1249f6f5
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
This commit is contained in:
Zhi Yan Liu
2014-08-25 23:13:21 +08:00
committed by Peter Stachowski
parent 2ed02b5331
commit fe25422628
12 changed files with 124 additions and 5 deletions

View File

@@ -105,6 +105,11 @@ root_grant_option = True
log_dir = /tmp/
log_file = logfile.txt
[profiler]
# If False fully disable profiling feature.
#enabled = False
# If False doesn't trace SQL requests.
#trace_sqlalchemy = True
# ========== Datastore Specific Configuration Options ==========