-
Notifications
You must be signed in to change notification settings - Fork 367
feat(monitoring): set up initial GMP metrics & minimal test dashboard #5964
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
base: master
Are you sure you want to change the base?
Changes from all commits
def2976
1ff4d92
6cf7eb7
913c1a5
b693a37
b7a5422
ae72dad
afb0f4f
eb4b2b1
d3397a5
93332ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: grafana-dashboards-prov | ||
| labels: | ||
| app.kubernetes.io/name: grafana | ||
| app.kubernetes.io/part-of: osv-monitoring | ||
| data: | ||
| dashboards.yaml: | | ||
| apiVersion: 1 | ||
| providers: | ||
| - name: 'default' | ||
| orgId: 1 | ||
| folder: '' | ||
| type: file | ||
| disableDeletion: false | ||
| editable: false | ||
| options: | ||
| path: /etc/grafana/dashboards |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: grafana-datasources | ||
| labels: | ||
| app.kubernetes.io/name: grafana | ||
| app.kubernetes.io/part-of: osv-monitoring | ||
| data: | ||
| datasources.yaml: | | ||
| apiVersion: 1 | ||
| datasources: | ||
| - name: GMP (Prometheus) | ||
|
jess-lowe marked this conversation as resolved.
|
||
| uid: gmp | ||
| type: prometheus | ||
| access: proxy | ||
| url: http://127.0.0.1:9090 | ||
| isDefault: true | ||
| editable: false | ||
| jsonData: | ||
| httpMethod: POST | ||
| timeInterval: 15s | ||
| - name: Cloud Monitoring | ||
| uid: cloud-monitoring | ||
| type: googlecloud-monitoring-datasource | ||
| access: proxy | ||
| editable: false | ||
| jsonData: | ||
| authenticationType: gce | ||
| defaultProject: oss-vdb-test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| { | ||
| "annotations": { | ||
| "list": [ | ||
| { | ||
| "builtIn": 1, | ||
| "datasource": { | ||
| "type": "grafana", | ||
| "uid": "-- Grafana --" | ||
| }, | ||
| "enable": true, | ||
| "hide": true, | ||
| "name": "Annotations & Alerts", | ||
| "type": "dashboard" | ||
| } | ||
| ] | ||
| }, | ||
| "editable": false, | ||
| "fiscalYearStartMonth": 0, | ||
| "graphTooltip": 0, | ||
| "id": null, | ||
| "links": [], | ||
| "liveNow": false, | ||
| "panels": [ | ||
| { | ||
| "datasource": { | ||
| "type": "prometheus", | ||
| "uid": "gmp" | ||
| }, | ||
| "fieldConfig": { | ||
| "defaults": { | ||
| "color": { | ||
| "mode": "thresholds" | ||
| }, | ||
| "mappings": [], | ||
| "thresholds": { | ||
| "mode": "absolute", | ||
| "steps": [ | ||
| { | ||
| "color": "green", | ||
| "value": null | ||
| } | ||
| ] | ||
| }, | ||
| "unit": "none" | ||
| }, | ||
| "overrides": [] | ||
| }, | ||
| "gridPos": { | ||
| "h": 6, | ||
| "w": 8, | ||
| "x": 0, | ||
| "y": 0 | ||
| }, | ||
| "id": 1, | ||
| "options": { | ||
| "colorMode": "value", | ||
| "graphMode": "area", | ||
| "justifyMode": "auto", | ||
| "orientation": "auto", | ||
| "reduceOptions": { | ||
| "calcs": [ | ||
| "lastNotNull" | ||
| ], | ||
| "fields": "", | ||
| "values": false | ||
| }, | ||
| "textMode": "auto" | ||
| }, | ||
| "pluginVersion": "11.5.0", | ||
| "targets": [ | ||
| { | ||
| "datasource": { | ||
| "type": "prometheus", | ||
| "uid": "gmp" | ||
| }, | ||
| "editorMode": "code", | ||
| "expr": "sum(osv_worker_tasks_processed_total)", | ||
| "legendFormat": "Total Tasks", | ||
| "range": true, | ||
| "refId": "A" | ||
| } | ||
| ], | ||
| "title": "Total Tasks Processed", | ||
| "type": "stat" | ||
| }, | ||
| { | ||
| "datasource": { | ||
| "type": "prometheus", | ||
| "uid": "gmp" | ||
| }, | ||
| "fieldConfig": { | ||
| "defaults": { | ||
| "custom": { | ||
| "drawStyle": "line", | ||
| "lineInterpolation": "smooth", | ||
| "lineWidth": 2, | ||
| "showPoints": "auto", | ||
| "spanNulls": false, | ||
| "stacking": { | ||
| "group": "A", | ||
| "mode": "normal" | ||
| } | ||
| }, | ||
| "unit": "ops" | ||
| }, | ||
| "overrides": [] | ||
| }, | ||
| "gridPos": { | ||
| "h": 6, | ||
| "w": 16, | ||
| "x": 8, | ||
| "y": 0 | ||
| }, | ||
| "id": 2, | ||
| "options": { | ||
| "legend": { | ||
| "calcs": [ | ||
| "mean", | ||
| "lastNotNull" | ||
| ], | ||
| "displayMode": "table", | ||
| "placement": "bottom", | ||
| "showLegend": true | ||
| }, | ||
| "tooltip": { | ||
| "mode": "multi", | ||
| "sort": "desc" | ||
| } | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "datasource": { | ||
| "type": "prometheus", | ||
| "uid": "gmp" | ||
|
jess-lowe marked this conversation as resolved.
|
||
| }, | ||
| "editorMode": "code", | ||
| "expr": "sum(rate(osv_worker_tasks_processed_total[5m])) by (status)", | ||
| "legendFormat": "{{status}}", | ||
| "range": true, | ||
| "refId": "A" | ||
| } | ||
| ], | ||
| "title": "Worker Task Processing Rate", | ||
| "type": "timeseries" | ||
| } | ||
| ], | ||
| "refresh": "10s", | ||
| "schemaVersion": 39, | ||
| "tags": [ | ||
| "osv", | ||
| "gmp", | ||
| "worker" | ||
| ], | ||
| "templating": { | ||
| "list": [] | ||
| }, | ||
| "time": { | ||
| "from": "now-1h", | ||
| "to": "now" | ||
| }, | ||
| "timepicker": { | ||
| "refresh_intervals": [ | ||
| "5s", | ||
| "10s", | ||
| "30s", | ||
| "1m", | ||
| "5m" | ||
| ] | ||
| }, | ||
| "timezone": "utc", | ||
| "title": "OSV Worker - Test Dashboard", | ||
| "uid": "osv-worker-test", | ||
| "version": 1 | ||
| } | ||
|
jess-lowe marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: grafana | ||
| labels: | ||
| app.kubernetes.io/name: grafana | ||
| app.kubernetes.io/part-of: osv-monitoring | ||
| spec: | ||
| replicas: 1 | ||
| strategy: | ||
| type: Recreate | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: grafana | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/name: grafana | ||
| app.kubernetes.io/part-of: osv-monitoring | ||
| spec: | ||
| serviceAccountName: grafana-sa | ||
| containers: | ||
| - name: grafana | ||
| image: grafana/grafana:11.5.0@sha256:4a0808cf7ca4b2569e5d4cb05ef2222a27ffb2a0c6499318b76c8cb81a6c4b28 | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - name: http | ||
| containerPort: 3000 | ||
| env: | ||
| - name: GF_SECURITY_ALLOW_EMBEDDING | ||
| value: "true" | ||
| - name: GF_AUTH_ANONYMOUS_ENABLED | ||
| value: "false" | ||
| - name: GF_AUTH_BASIC_ENABLED | ||
| value: "false" | ||
| - name: GF_AUTH_DISABLE_LOGIN_FORM | ||
| value: "true" | ||
| - name: GF_AUTH_JWT_ENABLED | ||
| value: "true" | ||
| - name: GF_AUTH_JWT_HEADER_NAME | ||
| value: "X-Goog-IAP-JWT-Assertion" | ||
| - name: GF_AUTH_JWT_EMAIL_CLAIM | ||
| value: "email" | ||
| - name: GF_AUTH_JWT_USERNAME_CLAIM | ||
| value: "email" | ||
| - name: GF_AUTH_JWT_JWK_SET_URL | ||
| value: "https://www.gstatic.com/iap/verify/public_key-jwk" | ||
| - name: GF_AUTH_JWT_EXPECT_CLAIMS | ||
| value: '{"iss": "https://cloud.google.com/iap"}' | ||
| - name: GF_AUTH_JWT_AUTO_SIGN_UP | ||
| value: "true" | ||
| - name: GF_USERS_AUTO_ASSIGN_ORG | ||
| value: "true" | ||
|
Comment on lines
+30
to
+53
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is going to need more work to get working I believe. Apparently the Auth proxy header doesn't work with google. Try JWTs. You'll also need to look into how oauth and cloud IAM is setup and how it can be used to authenticate grafana. Also, we probably want to set: GF_USERS_AUTO_ASSIGN_ORG_ROLE to be admin, instead of the default viewer. We'll need to figure out persistent accounts later. Right now for testing allow anyone with the google cloud perms to have write access.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have done the oauth and iam service account. 👍🏻 |
||
| - name: GF_USERS_AUTO_ASSIGN_ORG_ROLE | ||
| value: "Admin" | ||
| - name: GF_SERVER_ROOT_URL | ||
| value: "https://monitoring.test.osv.dev" | ||
| resources: | ||
| requests: | ||
| cpu: 250m | ||
| memory: 512Mi | ||
| limits: | ||
| cpu: 1000m | ||
| memory: 1Gi | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /api/health | ||
| port: 3000 | ||
| initialDelaySeconds: 10 | ||
| periodSeconds: 10 | ||
| timeoutSeconds: 3 | ||
| failureThreshold: 3 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /api/health | ||
| port: 3000 | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 5 | ||
| timeoutSeconds: 3 | ||
| failureThreshold: 2 | ||
| volumeMounts: | ||
| - name: datasources | ||
| mountPath: /etc/grafana/provisioning/datasources | ||
| readOnly: true | ||
| - name: dashboards-prov | ||
| mountPath: /etc/grafana/provisioning/dashboards | ||
| readOnly: true | ||
| - name: dashboards | ||
| mountPath: /etc/grafana/dashboards | ||
| readOnly: true | ||
| - name: storage | ||
| mountPath: /var/lib/grafana | ||
| - name: gmp-frontend | ||
| image: gke.gcr.io/prometheus-engine/frontend:v0.18.2-gke.1@sha256:35ab356d969255dd7694ae371bf0991b97907451b4c7e1574b58a096d3be5977 | ||
| args: | ||
| - "--web.listen-address=127.0.0.1:9090" | ||
| - "--project-id=$(GOOGLE_CLOUD_PROJECT)" | ||
| env: | ||
| - name: GOOGLE_CLOUD_PROJECT | ||
| value: oss-vdb-test | ||
| ports: | ||
| - name: gmp-proxy | ||
| containerPort: 9090 | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| limits: | ||
| cpu: 500m | ||
| memory: 256Mi | ||
| volumes: | ||
| - name: datasources | ||
| configMap: | ||
| name: grafana-datasources | ||
| - name: dashboards-prov | ||
| configMap: | ||
| name: grafana-dashboards-prov | ||
| - name: dashboards | ||
| configMap: | ||
| name: grafana-dashboards | ||
| - name: storage | ||
| emptyDir: {} | ||
Uh oh!
There was an error while loading. Please reload this page.