diff --git a/doc/source/configuring.rst b/doc/source/configuring.rst index 47fc39b8..9190e853 100644 --- a/doc/source/configuring.rst +++ b/doc/source/configuring.rst @@ -1583,7 +1583,27 @@ profiling feature for glance-api and glance-registry service. * ``enabled=`` -Optional. Default: ``True`` +Optional. Default: ``False`` + +There is one more configuration option that needs to be defined to enable +Glance services profiling. The config value ``hmac_keys`` is used for +encrypting context data for performance profiling. + +* ``hmac_keys=`` + +Optional. Default: ``SECRET_KEY`` + +**IMPORTANT NOTE**: in order to make profiling work as designed operator needs +to make those values of HMAC key be consistent for all services in their +deployment. Without HMAC key the profiling will not be triggered even profiling +feature is enabled. + +**IMPORTANT NOTE**: previously HMAC keys (as well as enabled parameter) were +placed at /etc/glance/api-paste.ini and /etc/glance/registry-paste.ini files +for Glance API and Glance Registry services respectively. Starting with +opsrofiler 0.3.1 release there is no need to set these arguments in the +*-paste.ini files. This functionality is still supported, although the +config values are having larger priority. The config value ``trace_sqlalchemy`` is used to determine whether fully enable sqlalchemy engine based SQL execution profiling feature for glance-api and @@ -1591,15 +1611,7 @@ glance-registry services. * ``trace_sqlalchemy=`` -Optional. Default: ``True`` - -**IMPORTANT NOTE**: The HMAC key which is used for encrypting context data for -performance profiling is configured in paste config file of glance-api and -glance-registry service separately, by default they place at -/etc/glance/api-paste.ini and /etc/glance/registry-paste.ini files, in order -to make profiling work as designed operator needs to make those values of HMAC -key be consistent for all services in your deployment. Without HMAC key the -profiling will not be triggered even profiling feature is enabled. +Optional. Default: ``False`` Configuring Glance public endpoint ---------------------------------- diff --git a/etc/glance-api-paste.ini b/etc/glance-api-paste.ini index 543c8ebb..d4e3e35e 100644 --- a/etc/glance-api-paste.ini +++ b/etc/glance-api-paste.ini @@ -82,8 +82,8 @@ paste.filter_factory = glance.api.middleware.gzip:GzipMiddleware.factory [filter:osprofiler] paste.filter_factory = osprofiler.web:WsgiMiddleware.factory -hmac_keys = SECRET_KEY -enabled = yes +hmac_keys = SECRET_KEY #DEPRECATED +enabled = yes #DEPRECATED [filter:cors] paste.filter_factory = oslo_middleware.cors:filter_factory diff --git a/etc/glance-registry-paste.ini b/etc/glance-registry-paste.ini index f65538a9..492dbc6f 100644 --- a/etc/glance-registry-paste.ini +++ b/etc/glance-registry-paste.ini @@ -31,5 +31,5 @@ paste.filter_factory = keystonemiddleware.auth_token:filter_factory [filter:osprofiler] paste.filter_factory = osprofiler.web:WsgiMiddleware.factory -hmac_keys = SECRET_KEY -enabled = yes +hmac_keys = SECRET_KEY #DEPRECATED +enabled = yes #DEPRECATED diff --git a/glance/cmd/api.py b/glance/cmd/api.py index 391ae1e7..543967f3 100755 --- a/glance/cmd/api.py +++ b/glance/cmd/api.py @@ -82,6 +82,7 @@ def main(): "glance", "api", cfg.CONF.bind_host) osprofiler.notifier.set(_notifier) + osprofiler.web.enable(cfg.CONF.profiler.hmac_keys) else: osprofiler.web.disable() diff --git a/glance/cmd/registry.py b/glance/cmd/registry.py index 4298bf67..d3f46913 100755 --- a/glance/cmd/registry.py +++ b/glance/cmd/registry.py @@ -67,7 +67,7 @@ def main(): "glance", "registry", cfg.CONF.bind_host) osprofiler.notifier.set(_notifier) - + osprofiler.web.enable(cfg.CONF.profiler.hmac_keys) else: osprofiler.web.disable() diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 1a26259a..7f3f328b 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -105,7 +105,10 @@ profiler_opts = [ cfg.BoolOpt("enabled", default=False, help=_('If False fully disable profiling feature.')), cfg.BoolOpt("trace_sqlalchemy", default=False, - help=_("If False doesn't trace SQL requests.")) + help=_("If False doesn't trace SQL requests.")), + cfg.StrOpt("hmac_keys", default="SECRET_KEY", + help=_("Secret key to use to sign Glance API and Glance " + "Registry services tracing messages.")), ] diff --git a/glance/opts.py b/glance/opts.py index a626a3bd..a18c0dd0 100644 --- a/glance/opts.py +++ b/glance/opts.py @@ -52,7 +52,6 @@ _api_opts = [ glance.common.wsgi.bind_opts, glance.common.wsgi.eventlet_opts, glance.common.wsgi.socket_opts, - glance.common.wsgi.profiler_opts, glance.image_cache.drivers.sqlite.sqlite_opts, glance.image_cache.image_cache_opts, glance.notifier.notifier_opts, @@ -67,6 +66,7 @@ _api_opts = [ glance.async.taskflow_executor.taskflow_executor_opts), ('store_type_location_strategy', glance.common.location_strategy.store_type.store_type_opts), + ('profiler', glance.common.wsgi.profiler_opts), ('paste_deploy', glance.common.config.paste_deploy_opts) ] _registry_opts = [ @@ -76,6 +76,7 @@ _registry_opts = [ glance.common.wsgi.bind_opts, glance.common.wsgi.socket_opts, glance.common.wsgi.eventlet_opts))), + ('profiler', glance.common.wsgi.profiler_opts), ('paste_deploy', glance.common.config.paste_deploy_opts) ] _scrubber_opts = [ diff --git a/releasenotes/notes/remove-osprofiler-paste-ini-options-c620dedc8f9728ff.yaml b/releasenotes/notes/remove-osprofiler-paste-ini-options-c620dedc8f9728ff.yaml new file mode 100644 index 00000000..3c7d6f5a --- /dev/null +++ b/releasenotes/notes/remove-osprofiler-paste-ini-options-c620dedc8f9728ff.yaml @@ -0,0 +1,13 @@ +--- +deprecations: + - OSprofiler support requires passing of trace information + between various OpenStack services. This information is + signed by one of HMAC keys, which we historically defined + in glance-api-paste.ini and glance-registry-paste.ini files + (together with enabled option, that in fact was duplicated in + the corresponding configuration files). + OSprofiler 0.3.1 and higher supports passing this information + via configuration files, therefore it's recommended to + modify the ``[filter:osprofiler]`` section in \*-paste.ini to look like + ``paste.filter_factor = osprofiler.web:WsgiMiddleware.factory`` + and set the ``hmac_keys`` option in the glance-\*.conf files.