Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration to scrape repository metrics #381

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Selector labels
{{- define "repository.selectorLabels" -}}
app.kubernetes.io/name: {{ include "repository.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
repository: "true"
{{- end }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.prometheusEnable }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: repository-monitor
namespace: {{ .Release.Namespace }}
labels:
release: {{ .Release.Name }}
spec:
jobLabel: repository
selector:
matchLabels:
app.kubernetes.io/name: repository
endpoints:
- port: http
path: /metrics
targetLabels:
- repository
{{- end }}
3 changes: 3 additions & 0 deletions repository/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

ALLOWED_HOSTS = []

# allow connections from any internal host
ALLOWED_CIDR_NETS = ["10.0.0.0/8"]
Tansito marked this conversation as resolved.
Show resolved Hide resolved

# Application definition

Expand All @@ -44,6 +46,7 @@
]

MIDDLEWARE = [
"allow_cidr.middleware.AllowCIDRMiddleware",
"django_prometheus.middleware.PrometheusBeforeMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down
1 change: 1 addition & 0 deletions repository/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
asgiref>=3.6.0
Django>=4.1.7
django-allow-cidr>=0.6
django-filter>=22.1
django_prometheus>=2.2
djangorestframework>=3.14.0
Expand Down