Add Sentry to Keystone

Change-Id: Ic24c0e6eefaf6a14062ddf65480d04c4ec670215
This commit is contained in:
Mohammed Naser 2020-08-07 12:00:37 -04:00
parent a3c3252b8f
commit ba4a978f92
4 changed files with 33 additions and 1 deletions

View File

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

View File

@ -0,0 +1,25 @@
#!/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 sentry_sdk
from keystone.server.wsgi import initialize_public_application
from sentry_sdk.integrations import wsgi
sentry_sdk.init(traces_sample_rate=0.1)
application = initialize_public_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -2,3 +2,4 @@ uWSGI
keystone
PyMySQL
python-memcached
sentry-sdk

View File

@ -98,6 +98,10 @@ spec:
image: vexxhost/keystone:latest
imagePullPolicy: Always
env:
{% if 'sentryDSN' in spec %}
- name: SENTRY_DSN
value: spec['sentryDSN']
{% endif %}
{% for v in env %}
- name: "{{ v.name }}"
value: "{{ v.value }}"
@ -155,4 +159,4 @@ spec:
{% if 'hostAliases' in spec %}
hostAliases:
{{ spec.hostAliases | to_yaml | indent(8) }}
{% endif %}
{% endif %}