Enable osprofiler for api
Implements: blueprint osprofiler-support Change-Id: Iad0168b35a89bc8d974019029b2a08e3bacb3f95
This commit is contained in:
parent
2ea3160171
commit
6882ea411e
@ -22,10 +22,10 @@ paste.app_factory = vitrage.api.app:app_factory
|
||||
root = vitrage.api.controllers.root.VersionsController
|
||||
|
||||
[pipeline:vitragev1_keystone_pipeline]
|
||||
pipeline = cors http_proxy_to_wsgi request_id authtoken vitragev1
|
||||
pipeline = cors http_proxy_to_wsgi request_id osprofiler authtoken vitragev1
|
||||
|
||||
[pipeline:vitragev1_noauth_pipeline]
|
||||
pipeline = cors http_proxy_to_wsgi request_id vitragev1
|
||||
pipeline = cors http_proxy_to_wsgi request_id osprofiler vitragev1
|
||||
|
||||
[app:vitragev1]
|
||||
paste.app_factory = vitrage.api.app:app_factory
|
||||
@ -45,3 +45,6 @@ oslo_config_project = vitrage
|
||||
[filter:http_proxy_to_wsgi]
|
||||
paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory
|
||||
oslo_config_project = vitrage
|
||||
|
||||
[filter:osprofiler]
|
||||
paste.filter_factory = osprofiler.web:WsgiMiddleware.factory
|
||||
|
@ -7,4 +7,5 @@ namespace = oslo.middleware.healthcheck
|
||||
namespace = oslo.log
|
||||
namespace = oslo.middleware
|
||||
namespace = oslo.policy
|
||||
namespace = keystonemiddleware.auth_token
|
||||
namespace = keystonemiddleware.auth_token
|
||||
namespace = osprofiler
|
||||
|
@ -28,3 +28,5 @@ stevedore>=1.20.0 # Apache-2.0
|
||||
voluptuous>=0.8.9 # BSD License
|
||||
sympy>=0.7.6 # BSD
|
||||
pysnmp>=4.2.3 # BSD
|
||||
osprofiler>=1.4.0 # Apache-2.0
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
|
||||
from vitrage.api import app
|
||||
from vitrage import service
|
||||
|
||||
@ -19,3 +21,6 @@ from vitrage import service
|
||||
def main():
|
||||
conf = service.prepare_service()
|
||||
app.build_server(conf)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
@ -14,11 +14,14 @@
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_policy import opts as policy_opts
|
||||
from osprofiler import initializer as osprofiler_initializer
|
||||
from osprofiler import opts as osprofiler_opts
|
||||
from vitrage import keystone_client
|
||||
from vitrage import messaging
|
||||
from vitrage import opts
|
||||
from vitrage.opts import register_opts
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@ -27,6 +30,7 @@ def prepare_service(args=None, conf=None, config_files=None):
|
||||
conf = cfg.ConfigOpts()
|
||||
log.register_options(conf)
|
||||
policy_opts.set_defaults(conf)
|
||||
osprofiler_opts.set_defaults(conf)
|
||||
|
||||
for group, options in opts.list_opts():
|
||||
conf.register_opts(list(options),
|
||||
@ -35,6 +39,14 @@ def prepare_service(args=None, conf=None, config_files=None):
|
||||
conf(args, project='vitrage', validate_default_values=True,
|
||||
default_config_files=config_files)
|
||||
|
||||
if conf.profiler.enabled:
|
||||
osprofiler_initializer.init_from_conf(
|
||||
conf=conf,
|
||||
context=None,
|
||||
project="vitrage",
|
||||
service="api",
|
||||
host=conf.api.host)
|
||||
|
||||
for datasource in conf.datasources.types:
|
||||
register_opts(conf, datasource, conf.datasources.path)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user