Changeset View
Changeset View
Standalone View
Standalone View
swh/web/misc/urls.py
Show All 9 Lines | |||||
from django.conf.urls import url, include | from django.conf.urls import url, include | ||||
from django.contrib.staticfiles import finders | from django.contrib.staticfiles import finders | ||||
from django.http import HttpResponse | from django.http import HttpResponse | ||||
from django.shortcuts import render | from django.shortcuts import render | ||||
from swh.web.common import service | from swh.web.common import service | ||||
from swh.web.config import get_config | from swh.web.config import get_config | ||||
from swh.web.misc.metrics import prometheus_metrics | |||||
def _jslicenses(request): | def _jslicenses(request): | ||||
jslicenses_file = finders.find('jssources/jslicenses.json') | jslicenses_file = finders.find('jssources/jslicenses.json') | ||||
jslicenses_data = json.load(open(jslicenses_file)) | jslicenses_data = json.load(open(jslicenses_file)) | ||||
jslicenses_data = sorted(jslicenses_data.items(), | jslicenses_data = sorted(jslicenses_data.items(), | ||||
key=lambda item: item[0].split('/')[-1]) | key=lambda item: item[0].split('/')[-1]) | ||||
return render(request, "misc/jslicenses.html", | return render(request, "misc/jslicenses.html", | ||||
Show All 14 Lines | json_data = '{"stat_counters": %s, "stat_counters_history": %s}' % ( | ||||
json.dumps(stat), stat_counters_history) | json.dumps(stat), stat_counters_history) | ||||
return HttpResponse(json_data, content_type='application/json') | return HttpResponse(json_data, content_type='application/json') | ||||
urlpatterns = [ | urlpatterns = [ | ||||
url(r'^', include('swh.web.misc.coverage')), | url(r'^', include('swh.web.misc.coverage')), | ||||
url(r'^jslicenses/$', _jslicenses, name='jslicenses'), | url(r'^jslicenses/$', _jslicenses, name='jslicenses'), | ||||
url(r'^', include('swh.web.misc.origin_save')), | url(r'^', include('swh.web.misc.origin_save')), | ||||
url(r'^stat_counters', _stat_counters, name='stat-counters'), | url(r'^stat_counters/', _stat_counters, name='stat-counters'), | ||||
url(r'^', include('swh.web.misc.badges')), | url(r'^', include('swh.web.misc.badges')), | ||||
vlorentz: I think it should be `metrics/prometheus/`, in case we want to add other kinds of metrics in… | |||||
Done Inline Actionsack anlambert: ack | |||||
Not Done Inline ActionsI think it's missing a trailing slash now vlorentz: I think it's missing a trailing slash now | |||||
Done Inline Actionsright anlambert: right | |||||
url(r'^metrics/prometheus/$', prometheus_metrics, | |||||
name='metrics-prometheus'), | |||||
] | ] | ||||
# when running end to end tests trough cypress, declare some extra | # when running end to end tests trough cypress, declare some extra | ||||
# endpoints to provide input data for some of those tests | # endpoints to provide input data for some of those tests | ||||
if get_config()['e2e_tests_mode']: | if get_config()['e2e_tests_mode']: | ||||
from swh.web.tests.data import ( | from swh.web.tests.data import ( | ||||
get_content_code_data_by_ext, | get_content_code_data_by_ext, | ||||
Show All 23 Lines |
I think it should be metrics/prometheus/, in case we want to add other kinds of metrics in the future