json_exporter
json_exporter copied to clipboard
length() is not working at all
I want to return length of symbol as metric's value
Source json:
{"symbol":["SLQD","SOLN","SHSP","SPAQ"]}
What i tried:
- name: data_loader_symbol_count
type: object
path: "{$.symbol[]}"
help: Count of symbols
values:
value: "{$.length()}"
Result: msg="Failed to extract value for metric" path={$.length()} err="length() is not found" metric="Desc{fqName: \"data_loader_symbol_count_value\", help: \"Count of symbols\", constLabels: {}, variableLabels: []}"
- name: data_loader_symbol_count
type: object
path: "{$}"
help: Count of symbols
values:
value: "{$.symbol.length()}"
Result: msg="Failed to extract value for metric" path={$.symbol.length()} err="length() is not found" metric="Desc{fqName: \"data_loader_symbol_count_value\", help: \"Count of symbols\", constLabels: {}, variableLabels: []}"
- name: data_loader_symbol_count
type: object
path: "{$.symbol.length()}"
help: Count of symbols
Result: nothing and no error
- name: data_loader_symbol_count
type: object
path: "{$.symbol.length()}"
help: Count of symbols
values:
value: "{$}"
Result: msg="Failed to extract json objects for metric" err="length() is not found" metric="Desc{fqName: \"data_loader_symbol_count_value\", help: \"Count of symbols\", constLabels: {}, variableLabels: []}"
Any help is very welcome!
Same thing for the sum() operator
+1