From c2b63ba363e56b3160623390a2c32c79616f2728 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 11 Aug 2020 17:22:20 +0000 Subject: [PATCH] cmd/microproxy: add a quick hack for some malformed variables. Signed-off-by: David Anderson --- cmd/microproxy/microproxy.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/microproxy/microproxy.go b/cmd/microproxy/microproxy.go index a3db41867..8f3c5650e 100644 --- a/cmd/microproxy/microproxy.go +++ b/cmd/microproxy/microproxy.go @@ -19,6 +19,7 @@ import ( "net/http/httputil" "net/url" "path/filepath" + "strings" "sync" "time" @@ -88,7 +89,16 @@ func promPrint(w io.Writer, prefix string, obj map[string]interface{}) { case map[string]interface{}: promPrint(w, k, v) case float64: - fmt.Fprintf(w, "%s %f\n", k, v) + const saveConfigReject = "control_save_config_rejected_" + const saveConfig = "control_save_config_" + switch { + case strings.HasPrefix(k, saveConfigReject): + fmt.Fprintf(w, "control_save_config_rejected{reason=%q} %f\n", k[len(saveConfigReject):], v) + case strings.HasPrefix(k, saveConfig): + fmt.Fprintf(w, "control_save_config{reason=%q} %f\n", k[len(saveConfig):], v) + default: + fmt.Fprintf(w, "%s %f\n", k, v) + } default: fmt.Fprintf(w, "# Skipping key %q, unhandled type %T\n", k, v) }