Skip to content

Commit d6c2fbf

Browse files
committed
Merge branch 'CH-193-CH-Django-add-Prometheus-custom-metrics' of github.com:MetaCell/cloud-harness into develop
2 parents 26c2872 + 06f60e8 commit d6c2fbf

3 files changed

Lines changed: 26 additions & 9 deletions

File tree

infrastructure/common-images/cloudharness-django/libraries/cloudharness-django/cloudharness_django/settings.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@
1515
[]) + ['admin_extra_buttons', ]
1616

1717
# add the local apps
18-
INSTALLED_APPS += ['cloudharness_django', ]
18+
INSTALLED_APPS += ['cloudharness_django', 'django_prometheus']
1919

2020
# add the CloudHarness Django auto login middleware
21-
MIDDLEWARE = getattr(
22-
settings,
23-
'MIDDLEWARE',
24-
[]
25-
) + [
26-
'cloudharness_django.middleware.BearerTokenMiddleware',
27-
]
21+
MIDDLEWARE = \
22+
['django_prometheus.middleware.PrometheusBeforeMiddleware'] + \
23+
getattr(
24+
settings,
25+
'MIDDLEWARE',
26+
[]
27+
) + \
28+
[
29+
'cloudharness_django.middleware.BearerTokenMiddleware',
30+
'django_prometheus.middleware.PrometheusAfterMiddleware'
31+
]
2832

2933
USER_CHANGE_ENABLED = False
3034

@@ -92,3 +96,7 @@
9296
},
9397
},
9498
}
99+
100+
if settings.ROOT_URLCONF:
101+
APP_URLCONF = settings.ROOT_URLCONF
102+
ROOT_URLCONF = "cloudharness_django.urls"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django.conf import settings
2+
from django.urls import include, path
3+
4+
5+
urlpatterns = []
6+
7+
urlpatterns.append(path('prometheus/', include('django_prometheus.urls')))
8+
urlpatterns.append(path('', include(settings.APP_URLCONF)))

infrastructure/common-images/cloudharness-django/libraries/cloudharness-django/setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = BSD-3-Clause
99
classifiers =
1010
Environment :: Web Environment
1111
Framework :: Django
12-
Framework :: Django :: 3.2
12+
Framework :: Django :: 3.0.7
1313
Intended Audience :: Developers
1414
License :: OSI Approved :: BSD License
1515
Operating System :: OS Independent
@@ -34,3 +34,4 @@ install_requires =
3434
psycopg2-binary>=2.9.3
3535
Pillow>=9.2.0
3636
python-keycloak
37+
django-prometheus

0 commit comments

Comments
 (0)