Browse Source

Merge "Add Shipyard profiler"

changes/80/608380/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
0593989f00
  1. 8
      charts/shipyard/templates/deployment-shipyard.yaml
  2. 1
      charts/shipyard/values.yaml
  3. 9
      src/bin/shipyard_airflow/etc/shipyard/shipyard.conf.sample
  4. 3
      src/bin/shipyard_airflow/requirements.txt
  5. 6
      src/bin/shipyard_airflow/shipyard_airflow/conf/config.py
  6. 13
      src/bin/shipyard_airflow/shipyard_airflow/control/start_shipyard.py

8
charts/shipyard/templates/deployment-shipyard.yaml

@ -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

1
charts/shipyard/values.yaml

@ -388,6 +388,7 @@ conf:
shipyard:
base:
web_server:
profiler: false
shipyard:
service_type: shipyard
deckhand:

9
src/bin/shipyard_airflow/etc/shipyard/shipyard.conf.sample

@ -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]

3
src/bin/shipyard_airflow/requirements.txt

@ -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

6
src/bin/shipyard_airflow/shipyard_airflow/conf/config.py

@ -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(

13
src/bin/shipyard_airflow/shipyard_airflow/control/start_shipyard.py

@ -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…
Cancel
Save