Commit b2de7e46 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'mk/image-scaler-max-procs-metric' into 'master'

Add a metric that tracks max image scaler processes

See merge request gitlab-org/gitlab-workhorse!640
parents ab67b34d 01922f89
...@@ -85,9 +85,10 @@ func newUpstreamWithCableConfig(authBackend string, cableBackend string) *config ...@@ -85,9 +85,10 @@ func newUpstreamWithCableConfig(authBackend string, cableBackend string) *config
} }
return &config.Config{ return &config.Config{
Version: "123", Version: "123",
DocumentRoot: testDocumentRoot, DocumentRoot: testDocumentRoot,
Backend: helper.URLMustParse(authBackend), Backend: helper.URLMustParse(authBackend),
CableBackend: cableBackendURL, CableBackend: cableBackendURL,
ImageResizerConfig: config.DefaultImageResizerConfig,
} }
} }
---
title: Add max_processes Prometheus metric for image scaling
merge_request: 640
author:
type: other
...@@ -92,7 +92,15 @@ var ( ...@@ -92,7 +92,15 @@ var (
Namespace: namespace, Namespace: namespace,
Subsystem: subsystem, Subsystem: subsystem,
Name: "processes", Name: "processes",
Help: "Amount of image resizing scaler processes working now", Help: "Amount of image scaler processes working now",
},
)
imageResizeMaxProcesses = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "max_processes",
Help: "The maximum amount of image scaler processes allowed to run concurrently",
}, },
) )
imageResizeRequests = prometheus.NewCounterVec( imageResizeRequests = prometheus.NewCounterVec(
...@@ -126,11 +134,14 @@ var ( ...@@ -126,11 +134,14 @@ var (
func init() { func init() {
prometheus.MustRegister(imageResizeConcurrencyLimitExceeds) prometheus.MustRegister(imageResizeConcurrencyLimitExceeds)
prometheus.MustRegister(imageResizeProcesses) prometheus.MustRegister(imageResizeProcesses)
prometheus.MustRegister(imageResizeMaxProcesses)
prometheus.MustRegister(imageResizeRequests) prometheus.MustRegister(imageResizeRequests)
prometheus.MustRegister(imageResizeDurations) prometheus.MustRegister(imageResizeDurations)
} }
func NewResizer(cfg config.Config) *Resizer { func NewResizer(cfg config.Config) *Resizer {
imageResizeMaxProcesses.Set(float64(cfg.ImageResizerConfig.MaxScalerProcs))
return &Resizer{Config: cfg, Prefix: "send-scaled-img:"} return &Resizer{Config: cfg, Prefix: "send-scaled-img:"}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment