diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index d2bd2d20..f25c3cf5 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -22,6 +22,10 @@ spec: image: vexxhost/openstack-operator:latest command: ["/usr/local/bin/kopf"] env: +{{- with .Values.sentryDSN }} + - name: SENTRY_DSN + value: {{ .Values.sentryDSN }} +{{- end }} - name: OPERATOR_NAMESPACE valueFrom: fieldRef: diff --git a/openstack_operator/operator.py b/openstack_operator/operator.py index a99c2066..981a361c 100644 --- a/openstack_operator/operator.py +++ b/openstack_operator/operator.py @@ -21,6 +21,8 @@ the appropriate deployments, an instance of Keystone, Heat and Horizon import os import kopf +import sentry_sdk +from sentry_sdk.integrations import aiohttp from openstack_operator import ceilometer from openstack_operator import chronyd @@ -35,6 +37,11 @@ from openstack_operator import utils OPERATOR_CONFIGMAP = "operator-config" +sentry_sdk.init( + integrations=[aiohttp.AioHttpIntegration()], + traces_sample_rate=1.0 +) + def operator_configmap(namespace, name, **_): """Filter on the operator's ConfigMap.""" diff --git a/requirements.txt b/requirements.txt index bc612753..f52fe204 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ kopf==0.27rc6 Jinja2 +sentry-sdk==0.16.3 openstacksdk