Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Prometheus Converter: Replace "/" in metric-name #201

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/zamp_converter/zcl_amp_conv_prom_keyvalue.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ CLASS zcl_amp_conv_prom_keyvalue IMPLEMENTATION.

LOOP AT metric_store ASSIGNING FIELD-SYMBOL(<metric>).

"replace / by _ because Prometheus does not like / in the "metric-name"
DATA(conv_metric_key) = <metric>-metric_key.
REPLACE ALL OCCURRENCES OF '/' IN conv_metric_key WITH '_'.

converted_metrics = converted_metrics &&
|{ sy-sysid }_{ sy-mandt }_{ <metric>-metric_scenario }_{ <metric>-metric_group }_{ <metric>-metric_key } { <metric>-metric_value }| &&
|{ sy-sysid }_{ sy-mandt }_{ <metric>-metric_scenario }_{ <metric>-metric_group }_{ conv_metric_key } { <metric>-metric_value }| &&
cl_abap_char_utilities=>newline.

ENDLOOP.
Expand Down