When texd is used by multiple client applications, it would be nice to see some application-specific metrics.
To accomplish this, I suggest analysing an optional X-Application header within the HTTP handler, and manipulate a corresponding metric counter:
// package metrics
var ProcessedByApplication = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "texd_client_applications",
Help: "Number of jobs created, by client application"
}, []string{"name"})
// package service
func (svc *service) HandleRender(res http.ResponseWriter, req *http.Request) {
if app := req.Header.Get("X-Application"); app != "" {
metrics.ProcessedByApplication.WithLabelValues(app).Inc()
}
// ...
}
(This might need some safety guards, like limiting the header value length, and protection against non-ASCII characters.)
Alternatively, we could add extend the existing metrics.ProcessedX counters, but then why stop there and not also extend metrics.XSize?
Additionally, the Ruby client shall automatically set the header value to something like Rails.application.class.name.split("::").first.downcase (but make it configurable, as this can only be a heuristic).
When texd is used by multiple client applications, it would be nice to see some application-specific metrics.
To accomplish this, I suggest analysing an optional
X-Applicationheader within the HTTP handler, and manipulate a corresponding metric counter:(This might need some safety guards, like limiting the header value length, and protection against non-ASCII characters.)
Alternatively, we could add extend the existing
metrics.ProcessedXcounters, but then why stop there and not also extendmetrics.XSize?Additionally, the Ruby client shall automatically set the header value to something like
Rails.application.class.name.split("::").first.downcase(but make it configurable, as this can only be a heuristic).