Add sentry to magnum

Change-Id: I8555fd7a98bf77b73c89d5ca01ee80cd19f78ce6
This commit is contained in:
okozachenko 2020-08-07 21:41:06 +03:00
parent e8559e01c4
commit c7e64a04ae
4 changed files with 39 additions and 0 deletions

View File

@ -16,6 +16,7 @@
FROM vexxhost/python-builder AS builder
FROM vexxhost/python-base AS magnum-api
COPY magnum-api-wsgi /usr/local/bin/magnum-api-wsgi
EXPOSE 9511
ENV UWSGI_HTTP_SOCKET=:9511 UWSGI_WSGI_FILE=/usr/local/bin/magnum-api-wsgi
CMD ["/usr/local/bin/uwsgi","--ini","/etc/uwsgi/uwsgi.ini"]

33
images/magnum/magnum-api-wsgi Executable file
View File

@ -0,0 +1,33 @@
#!/usr/local/bin/python
# Copyright (c) 2020 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pkg_resources
import sentry_sdk
from magnum.api.app import build_wsgi_app
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("magnum").version
sentry_sdk.init(
release="magnum@%s" % VERSION,
traces_sample_rate=0.1
)
application = build_wsgi_app()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -1,4 +1,5 @@
uWSGI
python-memcached
PyMySQL
sentry-sdk
git+https://opendev.org/openstack/magnum@stable/ussuri

View File

@ -54,6 +54,10 @@ spec:
imagePullPolicy: Always
{% if env is defined and env|length %}
env:
{% if 'sentryDSN' in spec %}
- name: SENTRY_DSN
value: {{ spec.sentryDSN }}
{% endif %}
{% for v in env %}
- name: "{{ v.name }}"
value: "{{ v.value }}"