prometheus-community / json_exporter

A prometheus exporter which scrapes remote JSON by JSONPath
Apache License 2.0
629 stars 191 forks source link

Simple jsonpath issue #95

Open JoeSpiral opened 3 years ago

JoeSpiral commented 3 years ago

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:

I get no errors and no return.

Thanks

qmonitoring commented 3 years ago

Perhaps this will work

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