~ubuntu-branches/ubuntu/vivid/heat/vivid

« back to all changes in this revision

Viewing changes to heat/common/profiler.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Corey Bryant
  • Date: 2015-01-06 08:55:22 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150106085522-4o3hnaff5lacvtrf
Tags: 2015.1~b1-0ubuntu1
[ Chuck Short ]
* Open up for vivid.
* debian/control: Update bzr branch. 
* debian/control: Add python-saharaclient,
  python-osprofiler, python-oslo.middleware, python-oslo.serialization.
* debian/patches/fix-reqirements.patch: Refreshed.
* debian/patches/skip-tests.patch: Updated to skip more tests.
* debian/rules: Skip integration tests.

[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/watch: Update uversionmangle for kilo beta naming.
  - d/rules: Generate heat.conf.sample and apply patch before copy.
  - d/rules: Run base tests instead of integration tests.
  - d/p/fix-requirements.patch: Refreshed.
  - d/p/remove-gettextutils-import.patch: Cherry picked from master.
* d/control: Bumped Standards-Version to 3.9.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
3
#    not use this file except in compliance with the License. You may obtain
 
4
#    a copy of the License at
 
5
#
 
6
#         http://www.apache.org/licenses/LICENSE-2.0
 
7
#
 
8
#    Unless required by applicable law or agreed to in writing, software
 
9
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
10
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
11
#    License for the specific language governing permissions and limitations
 
12
#    under the License.
 
13
 
 
14
from oslo.config import cfg
 
15
from oslo import messaging
 
16
import osprofiler.profiler
 
17
import osprofiler.web
 
18
 
 
19
from heat.common import context
 
20
from heat.common.i18n import _LW
 
21
from heat.common import messaging as rpc_messaging
 
22
from heat.openstack.common import log as logging
 
23
 
 
24
cfg.CONF.import_opt('profiler_enabled', 'heat.common.config', group='profiler')
 
25
 
 
26
LOG = logging.getLogger(__name__)
 
27
 
 
28
 
 
29
def setup(binary, host):
 
30
    if cfg.CONF.profiler.profiler_enabled:
 
31
        _notifier = osprofiler.notifier.create(
 
32
            "Messaging", messaging, context.get_admin_context().to_dict(),
 
33
            rpc_messaging.TRANSPORT, "heat", binary, host)
 
34
        osprofiler.notifier.set(_notifier)
 
35
        LOG.warning(_LW("OSProfiler is enabled.\nIt means that person who "
 
36
                        "knows any of hmac_keys that are specified in "
 
37
                        "/etc/heat/api-paste.ini can trace his requests. \n"
 
38
                        "In real life only operator can read this file so "
 
39
                        "there is no security issue. Note that even if person "
 
40
                        "can trigger profiler, only admin user can retrieve "
 
41
                        "trace information.\n"
 
42
                        "To disable OSprofiler set in heat.conf:\n"
 
43
                        "[profiler]\nenabled=false"))
 
44
    else:
 
45
        osprofiler.web.disable()