json_exporter icon indicating copy to clipboard operation
json_exporter copied to clipboard

Simple jsonpath issue

Open JoeSpiral opened this issue 5 years ago • 1 comments

I'm sure this issue is mine but I can't seem to get past it. I have a simple json return that looks like this: { "git": { "local": { "branch": { "ahead": "0", "behind": "0" } }, "commit": { "id": { "describe-short": "xxx", "abbrev": "xxx", "full": "xxx", "describe": "xxx" }, "message": { "short": "xxx", "full": "xxx" }, "user": { "name": "dude", "email": "dude" }, "time": 1618526666000 }, "branch": "prod-1.3.1-hotfix", "build": { "time": 1618526990000, "version": "1.0-SNAPSHOT", "host": "abcdef", "user": { "name": "", "email": "" }, "number": "1061" } } }

I am trying to get the build number. In this case 1061.

Below is the config I'm using. If someone could guide me as to where I have gone wrong, I would appreciate it.

metrics:

  • name: actuator-build-version type: object help: Example of sub-level value scrapes from a json path: $[*] labels: branch: $.git.branch value: number: $.git.build.number

I get no errors and no return.

Thanks

JoeSpiral avatar Apr 17 '21 17:04 JoeSpiral

Perhaps this will work

number: "{ .git.build.number }"

qmonitoring avatar Apr 19 '21 06:04 qmonitoring