Merge "Add Shipyard profiler"
This commit is contained in:
commit
0593989f00
@ -84,8 +84,16 @@ spec:
|
||||
subPath: policy.yaml
|
||||
mountPath: /etc/shipyard/policy.yaml
|
||||
readOnly: true
|
||||
{{ if .Values.conf.shipyard.base.profiler }}
|
||||
- name: tmp-profiles
|
||||
mountPath: /tmp/profiles
|
||||
{{ end }}
|
||||
{{ if $mounts_shipyard.volumeMounts }}{{ toYaml $mounts_shipyard.volumeMounts | indent 12 }}{{ end }}
|
||||
volumes:
|
||||
{{ if .Values.conf.shipyard.base.profiler }}
|
||||
- name: tmp-profiles
|
||||
emptyDir: {}
|
||||
{{ end }}
|
||||
- name: etc-shipyard
|
||||
emptyDir: {}
|
||||
- name: shipyard-etc
|
||||
|
@ -388,6 +388,7 @@ conf:
|
||||
shipyard:
|
||||
base:
|
||||
web_server:
|
||||
profiler: false
|
||||
shipyard:
|
||||
service_type: shipyard
|
||||
deckhand:
|
||||
|
@ -68,6 +68,9 @@
|
||||
# The directory containing the alembic.ini file (string value)
|
||||
#alembic_ini_path = /home/shipyard/shipyard
|
||||
|
||||
# Enable profiling of API requests. Do NOT use in production. (boolean value)
|
||||
#profiler = false
|
||||
|
||||
|
||||
[deckhand]
|
||||
|
||||
@ -315,6 +318,12 @@
|
||||
# Timeout value for http requests (integer value)
|
||||
#timeout = <None>
|
||||
|
||||
# Collect per-API call timing information. (boolean value)
|
||||
#collect_timing = false
|
||||
|
||||
# Log requests to multiple loggers. (boolean value)
|
||||
#split_loggers = false
|
||||
|
||||
|
||||
[logging]
|
||||
|
||||
|
@ -35,6 +35,9 @@ SQLAlchemy==1.2.12
|
||||
ulid==1.1
|
||||
uwsgi==2.0.17
|
||||
|
||||
# To support profiling in non-prod
|
||||
Werkzeug==0.14.1
|
||||
|
||||
# Dependencies for other UCP components
|
||||
git+https://git.openstack.org/openstack/airship-deckhand@0b5aa2e98a1ab5ab8a58c9dec3c1f88ef00d17a9#egg=deckhand
|
||||
git+https://git.openstack.org/openstack/airship-drydock.git@b1d24ad254c04cdbb4dc4e06f2bfe92c266aad70#egg=drydock_provisioner&subdirectory=python
|
||||
|
@ -91,6 +91,12 @@ SECTIONS = [
|
||||
default='/home/shipyard/shipyard',
|
||||
help='The directory containing the alembic.ini file'
|
||||
),
|
||||
cfg.BoolOpt(
|
||||
'profiler',
|
||||
default=False,
|
||||
help=('Enable profiling of API requests. Do NOT '
|
||||
'use in production.')
|
||||
),
|
||||
]
|
||||
),
|
||||
ConfigSection(
|
||||
|
@ -16,7 +16,10 @@
|
||||
Sets up the global configurations for the Shipyard service. Hands off
|
||||
to the api startup to handle the Falcon specific setup.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from oslo_config import cfg
|
||||
from werkzeug.contrib.profiler import ProfilerMiddleware
|
||||
|
||||
from shipyard_airflow.conf import config
|
||||
import shipyard_airflow.control.api as api
|
||||
@ -24,6 +27,7 @@ from shipyard_airflow.control.logging.logging_config import LoggingConfig
|
||||
from shipyard_airflow import policy
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_shipyard(default_config_files=None):
|
||||
@ -40,4 +44,11 @@ def start_shipyard(default_config_files=None):
|
||||
policy.policy_engine.register_policy()
|
||||
|
||||
# Start the API
|
||||
return api.start_api()
|
||||
if CONF.base.profiler:
|
||||
LOG.warning("Profiler ENABLED. Expect significant "
|
||||
"performance overhead.")
|
||||
return ProfilerMiddleware(
|
||||
api.start_api(),
|
||||
profile_dir="/tmp/profiles") # nosec
|
||||
else:
|
||||
return api.start_api()
|
||||
|
Loading…
x
Reference in New Issue
Block a user