Skip to content

Commit

Permalink
Merge pull request #115 from ropable/master
Browse files Browse the repository at this point in the history
Added Sentry SDK to project, update Poetry version
  • Loading branch information
ropable authored Dec 12, 2023
2 parents 4198895 + 4388e98 commit 40e2568
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
id: setup-python
with:
python-version: '3.9'
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update -y \
# Install Python libs using Poetry.
FROM builder_base_ibms as python_libs_ibms
WORKDIR /app
ARG POETRY_VERSION=1.6.1
ARG POETRY_VERSION=1.7.1
RUN pip install poetry=="${POETRY_VERSION}"
COPY poetry.lock pyproject.toml ./
RUN poetry config virtualenvs.create false \
Expand Down
1 change: 0 additions & 1 deletion ibms_project/ibms/forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django import forms
#from django.db.utils import ProgrammingError
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, HTML, Div
from ibms.models import (
Expand Down
16 changes: 16 additions & 0 deletions ibms_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,19 @@
# django-crispy-forms config
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap5'
CRISPY_TEMPLATE_PACK = 'bootstrap5'

# Sentry settings
SENTRY_DSN = env('SENTRY_DSN', None)
SENTRY_SAMPLE_RATE = env('SENTRY_SAMPLE_RATE', 1.0) # Error sampling rate
SENTRY_TRANSACTION_SAMPLE_RATE = env('SENTRY_TRANSACTION_SAMPLE_RATE', 0.0) # Transaction sampling
SENTRY_ENVIRONMENT = env('SENTRY_ENVIRONMENT', None)
if SENTRY_DSN and SENTRY_ENVIRONMENT:
import sentry_sdk

sentry_sdk.init(
dsn=SENTRY_DSN,
sample_rate=SENTRY_SAMPLE_RATE,
traces_sample_rate=SENTRY_TRANSACTION_SAMPLE_RATE,
environment=SENTRY_ENVIRONMENT,
release=APPLICATION_VERSION_NO,
)
14 changes: 0 additions & 14 deletions ibms_project/sfm/fields.py

This file was deleted.

18 changes: 15 additions & 3 deletions ibms_project/sfm/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@

from ibms.forms import HelperForm
from sfm.models import Quarter, CostCentre, SFMMetric, FinancialYear, MeasurementValue, REGION_CHOICES
from sfm.fields import (
QtrModelChoiceField, SFMMetricModelChoiceField, SFMCostCentreModelChoiceField,
)


class QtrModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.description


class SFMMetricModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.metricID


class SFMCostCentreModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return str(obj)


class OutputEntryForm(HelperForm):
Expand Down
1 change: 1 addition & 0 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ spec:
- ALL
readOnlyRootFilesystem: false
restartPolicy: Always
terminationGracePeriodSeconds: 180
17 changes: 17 additions & 0 deletions kustomize/overlays/prod/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,20 @@ spec:
secretKeyRef:
name: ibms-env-prod
key: SECRET_KEY
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: ibms-env-prod
key: SENTRY_DSN
- name: SENTRY_SAMPLE_RATE
valueFrom:
secretKeyRef:
name: ibms-env-prod
key: SENTRY_SAMPLE_RATE
- name: SENTRY_TRANSACTION_SAMPLE_RATE
valueFrom:
secretKeyRef:
name: ibms-env-prod
key: SENTRY_TRANSACTION_SAMPLE_RATE
- name: SENTRY_ENVIRONMENT
value: "prod"
2 changes: 1 addition & 1 deletion kustomize/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ labels:
variant: prod
images:
- name: ghcr.io/dbca-wa/ibms
newTag: 2.8.2
newTag: 2.8.3
patches:
- path: deployment_patch.yaml
- path: service_patch.yaml
17 changes: 17 additions & 0 deletions kustomize/overlays/uat/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,20 @@ spec:
secretKeyRef:
name: ibms-env-uat
key: SECRET_KEY
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: ibms-env-uat
key: SENTRY_DSN
- name: SENTRY_SAMPLE_RATE
valueFrom:
secretKeyRef:
name: ibms-env-uat
key: SENTRY_SAMPLE_RATE
- name: SENTRY_TRANSACTION_SAMPLE_RATE
valueFrom:
secretKeyRef:
name: ibms-env-uat
key: SENTRY_TRANSACTION_SAMPLE_RATE
- name: SENTRY_ENVIRONMENT
value: "uat"
93 changes: 70 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ibms"
version = "2.8.2"
version = "2.8.3"
description = "Integrated Business Management System corporate application"
authors = ["Ashley Felton <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -12,18 +12,19 @@ psycopg2 = "2.9.9"
dbca-utils = "1.1.6"
django-extensions = "3.2.3"
python-dotenv = "1.0.0"
dj-database-url = "1.0.0"
dj-database-url = "2.1.0"
gunicorn = "21.2.0"
django-crispy-forms = "2.0"
crispy-bootstrap5 = "0.7"
xlrd = "2.0.1"
xlutils = "2.0.0"
xlwt = "1.3.0"
xlrd = "2.0.1" # TODO: deprecate
xlutils = "2.0.0" # TODO: deprecate
xlwt = "1.3.0" # TODO: deprecate
openpyxl = "3.1.2"
webtemplate-dbca = "1.6.0"
whitenoise = {version = "6.6.0", extras = ["brotli"]}
mixer = "7.2.2"
tomli = "2.0.1"
sentry-sdk = {version = "1.38.0", extras = ["django"]}

[tool.poetry.group.dev.dependencies]
ipython = "^8.10.0"
Expand Down

0 comments on commit 40e2568

Please sign in to comment.