Merge "Add sentry integrations in services"

This commit is contained in:
Zuul 2020-08-29 00:32:02 +00:00 committed by Gerrit Code Review
commit 46df016dbf
17 changed files with 113 additions and 18 deletions

View File

@ -1,4 +1,3 @@
#!/usr/local/bin/python
# Copyright (c) 2020 VEXXHOST, Inc.
#
@ -18,13 +17,17 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from barbican.api.app import get_api_wsgi_script
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("barbican").version
sentry_sdk.init(release="barbican@%s" % VERSION)
sentry_sdk.init(
release="barbican@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = get_api_wsgi_script()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -19,12 +19,16 @@ import re
import sys
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from cinder.cmd.scheduler import main
VERSION = pkg_resources.get_distribution("cinder").version
sentry_sdk.init(release="cinder@%s" % VERSION)
sentry_sdk.init(
release="cinder@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View File

@ -19,12 +19,16 @@ import re
import sys
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from cinder.cmd.volume import main
VERSION = pkg_resources.get_distribution("cinder").version
sentry_sdk.init(release="cinder@%s" % VERSION)
sentry_sdk.init(
release="cinder@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View File

@ -17,13 +17,17 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from cinder.wsgi.wsgi import initialize_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("cinder").version
sentry_sdk.init(release="cinder@%s" % VERSION)
sentry_sdk.init(
release="cinder@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = initialize_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -17,13 +17,17 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from glance.common.wsgi_app import init_app
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("glance").version
sentry_sdk.init(release="glance@%s" % VERSION)
sentry_sdk.init(
release="glance@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = init_app()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -18,12 +18,16 @@ import pkg_resources
import re
import sys
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from heat.cmd.engine import main
VERSION = pkg_resources.get_distribution("openstack-heat").version
sentry_sdk.init(release="openstack-heat@%s" % VERSION)
sentry_sdk.init(
release="heat@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View File

@ -17,13 +17,17 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from heat.httpd.heat_api import init_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("openstack-heat").version
sentry_sdk.init(release="openstack-heat@%s" % VERSION)
sentry_sdk.init(
release="heat@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = init_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -17,13 +17,17 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from heat.httpd.heat_api_cfn import init_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("openstack-heat").version
sentry_sdk.init(release="openstack-heat@%s" % VERSION)
sentry_sdk.init(
release="heat@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = init_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -26,10 +26,14 @@ import sentry_sdk
from django.core.wsgi import get_wsgi_application
from sentry_sdk.integrations import wsgi
from sentry_sdk.integrations.django import DjangoIntegration
VERSION = pkg_resources.get_distribution("horizon").version
sentry_sdk.init(release="horizon@%s" % VERSION)
sentry_sdk.init(
release="horizon@%s" % VERSION,
integrations=[DjangoIntegration()]
)
# Add this file path to sys.path in order to import settings
sys.path.insert(0, os.path.normpath(os.path.join(

View File

@ -17,13 +17,18 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from keystone.server.wsgi import initialize_public_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("keystone").version
sentry_sdk.init(release="keystone@%s" % VERSION)
sentry_sdk.init(
release="keystone@%s" % VERSION,
integrations=[FlaskIntegration(), SqlalchemyIntegration()]
)
application = initialize_public_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -2,4 +2,4 @@ uWSGI
keystone
PyMySQL
python-memcached
sentry-sdk
sentry-sdk[flask]

View File

@ -22,4 +22,5 @@ ENV UWSGI_HTTP_SOCKET=:9511 UWSGI_WSGI_FILE=/usr/local/bin/magnum-api-wsgi
CMD ["/usr/local/bin/uwsgi","--ini","/etc/uwsgi/uwsgi.ini"]
FROM vexxhost/python-base AS magnum-conductor
COPY magnum-conductor /usr/local/bin/magnum-conductor
CMD ["/usr/local/bin/magnum-conductor"]

View File

@ -17,6 +17,7 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from magnum.api.app import build_wsgi_app
from sentry_sdk.integrations import wsgi
@ -24,7 +25,10 @@ from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("magnum").version
sentry_sdk.init(release="magnum@%s" % VERSION)
sentry_sdk.init(
release="magnum@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = build_wsgi_app()
application = wsgi.SentryWsgiMiddleware(application)

34
images/magnum/magnum-conductor Executable file
View File

@ -0,0 +1,34 @@
#!/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 re
import sys
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from magnum.cmd.conductor import main
VERSION = pkg_resources.get_distribution("magnum").version
sentry_sdk.init(
release="magnum@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View File

@ -17,12 +17,17 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from neutron.server import get_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("neutron").version
sentry_sdk.init(release="neutron@%s" % VERSION)
sentry_sdk.init(
release="neutron@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
application = get_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -19,11 +19,16 @@ import re
import sys
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from neutron.cmd.eventlet.server import main_rpc_eventlet
VERSION = pkg_resources.get_distribution("neutron").version
sentry_sdk.init(release="neutron@%s" % VERSION)
sentry_sdk.init(
release="neutron@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main_rpc_eventlet())

View File

@ -17,12 +17,18 @@
import pkg_resources
import sentry_sdk
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from placement.wsgi import init_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("openstack-placement").version
sentry_sdk.init(
release="placement@%s" % VERSION,
integrations=[SqlalchemyIntegration()]
)
sentry_sdk.init(release="placement@%s" % VERSION)
application = init_application()