File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,18 @@ modules:
60
60
active: 1 # static value
61
61
count: '{.count}' # dynamic value
62
62
boolean: '{.some_boolean}'
63
+
64
+ - name: example_convert
65
+ type: object
66
+ path: '{.values[0,1]}'
67
+ labels:
68
+ state: '{.state}'
69
+ values:
70
+ state: '{.state}'
71
+ valueconverter:
72
+ '{.state}': #convert value 'state' into a number
73
+ active: 1
74
+ inactive: 2
63
75
64
76
headers:
65
77
X-Dummy: my-test-header
@@ -70,6 +82,8 @@ Serving HTTP on 0.0.0.0 port 8000 ...
70
82
$ ./json_exporter --config.file examples/config.yml &
71
83
72
84
$ curl " http://localhost:7979/probe?module=default&target=http://localhost:8000/examples/data.json" | grep ^example
85
+ example_convert_state{state="ACTIVE"} 1
86
+ example_convert_state{state="INACTIVE"} 2
73
87
example_global_value{environment="beta",location="planet-mars"} 1234
74
88
example_value_active{environment="beta",id="id-A"} 1
75
89
example_value_active{environment="beta",id="id-C"} 1
Original file line number Diff line number Diff line change @@ -20,6 +20,19 @@ modules:
20
20
active : 1 # static value
21
21
count : ' {.count}' # dynamic value
22
22
boolean : ' {.some_boolean}'
23
+
24
+ - name : example_convert
25
+ type : object
26
+ path : ' {.values[0,1]}'
27
+ labels :
28
+ state : ' {.state}'
29
+ values :
30
+ state : ' {.state}'
31
+ valueconverter :
32
+ ' {.state} ' : # convert value 'state' in JSON into a number
33
+ active : 1
34
+ inactive : 2
35
+
23
36
headers :
24
37
X-Dummy : my-test-header
25
38
You can’t perform that action at this time.
0 commit comments