From 73e0f747b7e4d6319a73548da76d415a1bda2b86 Mon Sep 17 00:00:00 2001 From: Benjamin Kreuscher Date: Tue, 23 Nov 2021 11:47:57 +0000 Subject: [PATCH] Prometheus Collector adjusted replace / by _ because Prometheus does not like / in the "metric-name" --- src/zamp_converter/zcl_amp_conv_prom_keyvalue.clas.abap | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zamp_converter/zcl_amp_conv_prom_keyvalue.clas.abap b/src/zamp_converter/zcl_amp_conv_prom_keyvalue.clas.abap index 58ff7dd..073e497 100644 --- a/src/zamp_converter/zcl_amp_conv_prom_keyvalue.clas.abap +++ b/src/zamp_converter/zcl_amp_conv_prom_keyvalue.clas.abap @@ -19,8 +19,12 @@ CLASS zcl_amp_conv_prom_keyvalue IMPLEMENTATION. LOOP AT metric_store ASSIGNING FIELD-SYMBOL(). + "replace / by _ because Prometheus does not like / in the "metric-name" + DATA(conv_metric_key) = -metric_key. + REPLACE ALL OCCURRENCES OF '/' IN conv_metric_key WITH '_'. + converted_metrics = converted_metrics && - |{ sy-sysid }_{ sy-mandt }_{ -metric_scenario }_{ -metric_group }_{ -metric_key } { -metric_value }| && + |{ sy-sysid }_{ sy-mandt }_{ -metric_scenario }_{ -metric_group }_{ conv_metric_key } { -metric_value }| && cl_abap_char_utilities=>newline. ENDLOOP.