json_exporter icon indicating copy to clipboard operation
json_exporter copied to clipboard

length() is not working at all

Open a0s opened this issue 4 years ago • 2 comments

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!

a0s avatar Aug 25 '21 21:08 a0s

Same thing for the sum() operator

davinkevin avatar Mar 09 '22 20:03 davinkevin

+1

abhisheksurve45 avatar Jul 11 '23 09:07 abhisheksurve45