Skip to content

Commit

Permalink
[Model Monitoring] Implement default model monitoring DB values (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyal-Danieli authored Aug 21, 2023
1 parent 3ce52a0 commit eb59456
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 25 deletions.
2 changes: 1 addition & 1 deletion charts/mlrun-ce/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
version: 0.6.2
version: 0.6.3-rc1
name: mlrun-ce
description: MLRUn Open Source Stack
home: https://iguazio.com
Expand Down
13 changes: 13 additions & 0 deletions charts/mlrun-ce/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,16 @@ Pipelines labels
{{ include "mlrun-ce.pipelines.selectorLabels" . }}
{{- end -}}

{{/*
Model monitoring DSN
*/}}
{{- define "mlrun-ce.mlrun.modelMonitoring.DSN" -}}
{{- if .Values.mlrun.modelMonitoring.dsn -}}
{{ .Values.mlrun.modelMonitoring.dsn }}
{{- else -}}
{{- if eq "mysql" .Values.mlrun.httpDB.dbType -}}
{{ .Values.mlrun.httpDB.dsn }}_model_monitoring
{{- end -}}
{{- end -}}
{{- end -}}

2 changes: 2 additions & 0 deletions charts/mlrun-ce/templates/config/mlrun-env-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ data:
MLRUN_DEFAULT_TENSORBOARD_LOGS_PATH: /home/jovyan/data/tensorboard/{{ `{{project}} `}}
MLRUN_FEATURE_STORE__DEFAULT_TARGETS: parquet
MLRUN_MODEL_ENDPOINT_MONITORING__STORE_TYPE: sql
MLRUN_MODEL_ENDPOINT_MONITORING__ENDPOINT_STORE_CONNECTION: {{ template "mlrun-ce.mlrun.modelMonitoring.DSN" .}}

18 changes: 9 additions & 9 deletions charts/mlrun-ce/templates/config/model-monitoring-details.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT uid,model,function_uri,model_class,metrics->\"$.generic.predictions_per_second\",metrics->\"$.generic.latency_avg_1h\",first_request,last_request FROM mlrun.model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"rawSql": "SELECT uid,model,function_uri,model_class,metrics->\"$.generic.predictions_per_second\",metrics->\"$.generic.latency_avg_1h\",first_request,last_request FROM model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -428,7 +428,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT drift_measures->\"$.tvd_sum\" as \"TVD (sum)\", drift_measures->\"$.tvd_mean\" as \"TVD (mean)\", drift_measures->\"$.hellinger_sum\" as \"Hellinger (sum)\", drift_measures->\"$.hellinger_mean\" as \"Hellinger (mean)\", drift_measures->\"$.kld_sum\" as \"KLD (sum)\", drift_measures->\"$.kld_mean\" as \"KLD (mean)\" FROM mlrun.model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"rawSql": "SELECT drift_measures->\"$.tvd_sum\" as \"TVD (sum)\", drift_measures->\"$.tvd_mean\" as \"TVD (mean)\", drift_measures->\"$.hellinger_sum\" as \"Hellinger (sum)\", drift_measures->\"$.hellinger_mean\" as \"Hellinger (mean)\", drift_measures->\"$.kld_sum\" as \"KLD (sum)\", drift_measures->\"$.kld_mean\" as \"KLD (mean)\" FROM model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -605,7 +605,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT feature_stats FROM mlrun.model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"rawSql": "SELECT feature_stats FROM model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -637,7 +637,7 @@ data:
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "SELECT current_stats FROM mlrun.model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"rawSql": "SELECT current_stats FROM model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"refId": "B",
"sql": {
"columns": [
Expand All @@ -663,7 +663,7 @@ data:
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "SELECT drift_measures FROM mlrun.model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"rawSql": "SELECT drift_measures FROM model_endpoints where project='$PROJECT' and uid='$MODELENDPOINT'",
"refId": "C",
"sql": {
"columns": [
Expand Down Expand Up @@ -1027,14 +1027,14 @@ data:
{
"current": {},
"datasource": "iguazio",
"definition": "SELECT DISTINCT project FROM mlrun.model_endpoints",
"definition": "SELECT DISTINCT project FROM = model_endpoints",
"hide": 0,
"includeAll": false,
"label": "Project",
"multi": false,
"name": "PROJECT",
"options": [],
"query": "SELECT DISTINCT project FROM mlrun.model_endpoints",
"query": "SELECT DISTINCT project FROM model_endpoints",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -1047,14 +1047,14 @@ data:
{
"current": {},
"datasource": "iguazio",
"definition": "SELECT uid FROM mlrun.model_endpoints where project='$PROJECT';",
"definition": "SELECT uid FROM model_endpoints where project='$PROJECT';",
"hide": 0,
"includeAll": false,
"label": "Model Endpoint",
"multi": false,
"name": "MODELENDPOINT",
"options": [],
"query": "SELECT uid FROM mlrun.model_endpoints where project='$PROJECT';",
"query": "SELECT uid FROM model_endpoints where project='$PROJECT';",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
14 changes: 7 additions & 7 deletions charts/mlrun-ce/templates/config/model-monitoring-overview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT COUNT(uid) FROM mlrun.model_endpoints where project='$PROJECT' and active=True",
"rawSql": "SELECT COUNT(uid) FROM model_endpoints where project='$PROJECT' and active=True",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -190,7 +190,7 @@ data:
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "SELECT avg(metrics->\"$.generic.predictions_per_second\") FROM mlrun.model_endpoints where project ='$PROJECT' and endpoint_type != \"2\" and active=True",
"rawSql": "SELECT avg(metrics->\"$.generic.predictions_per_second\") FROM model_endpoints where project ='$PROJECT' and endpoint_type != \"2\" and active=True",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -267,7 +267,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT avg(metrics->\"$.generic.latency_avg_1h\") FROM mlrun.model_endpoints where project ='$PROJECT' and endpoint_type != \"2\" and active=True",
"rawSql": "SELECT avg(metrics->\"$.generic.latency_avg_1h\") FROM model_endpoints where project ='$PROJECT' and endpoint_type != \"2\" and active=True",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -343,7 +343,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT sum(error_count) FROM mlrun.model_endpoints where project='$PROJECT' and active=True",
"rawSql": "SELECT sum(error_count) FROM model_endpoints where project='$PROJECT' and active=True",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -651,7 +651,7 @@ data:
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT uid, function_uri, model, model_class, first_request, last_request, error_count, drift_status FROM mlrun.model_endpoints where project='$PROJECT'",
"rawSql": "SELECT uid, function_uri, model, model_class, first_request, last_request, error_count, drift_status FROM model_endpoints where project='$PROJECT'",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -1024,14 +1024,14 @@ data:
{
"current": {},
"datasource": "iguazio",
"definition": "SELECT DISTINCT project FROM mlrun.model_endpoints",
"definition": "SELECT DISTINCT project FROM model_endpoints",
"hide": 0,
"includeAll": false,
"label": "Project",
"multi": false,
"name": "PROJECT",
"options": [],
"query": "SELECT DISTINCT project FROM mlrun.model_endpoints",
"query": "SELECT DISTINCT project FROM model_endpoints",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,14 @@ data:
{
"current": {},
"datasource": "iguazio",
"definition": "SELECT DISTINCT project FROM mlrun.model_endpoints",
"definition": "SELECT DISTINCT project FROM model_endpoints",
"hide": 0,
"includeAll": false,
"label": "Project",
"multi": false,
"name": "PROJECT",
"options": [],
"query": "SELECT DISTINCT project FROM mlrun.model_endpoints",
"query": "SELECT DISTINCT project FROM model_endpoints",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -559,14 +559,14 @@ data:
{
"current": {},
"datasource": "iguazio",
"definition": "SELECT uid FROM mlrun.model_endpoints where project='$PROJECT';",
"definition": "SELECT uid FROM model_endpoints where project='$PROJECT';",
"hide": 0,
"includeAll": false,
"label": "Model Endpoint",
"multi": false,
"name": "MODELENDPOINT",
"options": [],
"query": "SELECT uid FROM mlrun.model_endpoints where project='$PROJECT';",
"query": "SELECT uid FROM model_endpoints where project='$PROJECT';",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
11 changes: 7 additions & 4 deletions charts/mlrun-ce/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ mlrun:
dirPath: "/mlrun/db"
dsn: mysql+pymysql://root@mlrun-db:3306/mlrun
oldDsn: sqlite:////mlrun/db/mlrun.db?check_same_thread=false

modelMonitoring:
# If no dsn has been provided, will initiate monitoring database under mlrun-db service:
# mysql+pymysql://root@mlrun-db:3306/mlrun_model_monitoring
dsn:
ce:
mode: full

Expand Down Expand Up @@ -334,10 +337,10 @@ kube-prometheus-stack:
additionalDataSources:
- name: iguazio
type: mysql
url:
user:
url: mlrun-db:3306
user: root
password:
database:
database: mlrun_model_monitoring
editable: true
maxOpenConns: 100
maxIdleConns: 100
Expand Down

0 comments on commit eb59456

Please sign in to comment.