Skip to content

Commit

Permalink
move scaling metric to a separate file for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
kondratyevd committed Feb 7, 2025
1 parent 057c529 commit be05178
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion helm/supersonic/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SuperSONIC chart successfully installed!

Scaling metric:{{ if not ( eq .Values.prometheus.serverLoadMetric "" ) }} {{ .Values.prometheus.serverLoadMetric }}{{ else }}{{ include "supersonic.defaultMetric" . | nindent 4 }}{{ end }}

Scaling threshold: {{ .Values.prometheus.serverLoadThreshold }}{{"\n"}}
Scaling threshold: {{ include "supersonic.serverLoadThreshold" . }}{{"\n"}}

{{- if or (and .Values.grafana.enabled (eq (include "supersonic.grafanaExists" .) "true")) (eq (include "supersonic.prometheusExists" .) "true") .Values.prometheus.external }}
┌-----------------------------------------------------------------------------┐
Expand Down
14 changes: 0 additions & 14 deletions helm/supersonic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ Get Envoy name
{{- printf "%s-envoy" (include "supersonic.name" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "supersonic.defaultMetric" -}}
{{- if not ( eq .Values.prometheus.serverLoadMetric "" ) }}
{{- printf "%s" .Values.prometheus.serverLoadMetric -}}
{{- else }}
sum by (release) (
rate(nv_inference_queue_duration_us{release=~"{{ include "supersonic.name" . }}"}[15s])
)
/
sum by (release) (
(rate(nv_inference_exec_count{release=~"{{ include "supersonic.name" . }}"}[15s]) * 1000) + 0.001
)
{{- end }}
{{- end }}

{{/*
Get gRPC endpoint
*/}}
Expand Down
23 changes: 23 additions & 0 deletions helm/supersonic/templates/_scaling-metric.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{/*
Get default scaling metric
*/}}
{{- define "supersonic.defaultMetric" -}}
{{- if not ( eq .Values.prometheus.serverLoadMetric "" ) }}
{{- printf "%s" .Values.prometheus.serverLoadMetric -}}
{{- else }}
sum by (release) (
rate(nv_inference_queue_duration_us{release=~"{{ include "supersonic.name" . }}"}[15s])
)
/
sum by (release) (
(rate(nv_inference_exec_count{release=~"{{ include "supersonic.name" . }}"}[15s]) * 1000) + 0.001
)
{{- end }}
{{- end }}

{{/*
Get server load threshold (defaults to 100 if not set)
*/}}
{{- define "supersonic.serverLoadThreshold" -}}
{{- default 100 .Values.prometheus.serverLoadThreshold -}}
{{- end -}}

0 comments on commit be05178

Please sign in to comment.