mirror of
https://github.com/prometheus-community/json_exporter
synced 2025-02-04 13:51:47 +00:00
9ecc44b064
* Pick timestamp from metric based on #97 and #80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric When deserializing objects we need to take the key json path into account as well like we would do for all the values as well. This allows collections to be defined still with each entry having a separate timestamp (e.g. list of time-stamped log messages). Update examples for timestamp Update Readme about staleness for custom timestamps Signed-off-by: Jan Phillip Kretzschmar <janphkre@gmx.de> Signed-off-by: Ben Kochie <superq@gmail.com> Co-authored-by: Ben Kochie <superq@gmail.com>
53 lines
2.1 KiB
YAML
53 lines
2.1 KiB
YAML
---
|
|
modules:
|
|
default:
|
|
metrics:
|
|
- name: example_global_value
|
|
path: "{ .counter }"
|
|
help: Example of a top-level global value scrape in the json
|
|
labels:
|
|
environment: beta # static label
|
|
location: "planet-{.location}" # dynamic label
|
|
- name: example_timestamped_value
|
|
path: "{ .values[?(@.state == "INACTIVE")] }"
|
|
epochTimestamp: "{ .timestamp }"
|
|
help: Example of a timestamped value scrape in the json
|
|
labels:
|
|
environment: beta # static label
|
|
- name: example_value
|
|
type: object
|
|
help: Example of sub-level value scrapes from a json
|
|
path: '{.values[?(@.state == "ACTIVE")]}'
|
|
labels:
|
|
environment: beta # static label
|
|
id: '{.id}' # dynamic label
|
|
values:
|
|
active: 1 # static value
|
|
count: '{.count}' # dynamic value
|
|
boolean: '{.some_boolean}'
|
|
headers:
|
|
X-Dummy: my-test-header
|
|
|
|
# If 'body' is set, it will be sent by the exporter as the body content in the scrape request. The HTTP method will also be set as 'POST' in this case.
|
|
# body:
|
|
# content: |
|
|
# {"time_diff": "1m25s", "anotherVar": "some value"}
|
|
|
|
# The body content can also be a Go Template (https://golang.org/pkg/text/template), with all the functions from the Sprig library (https://masterminds.github.io/sprig/) available. All the query parameters sent by prometheus in the scrape query to the exporter, are available in the template.
|
|
# body:
|
|
# content: |
|
|
# {"time_diff": "{{ duration `95` }}","anotherVar": "{{ .myVal | first }}"}
|
|
# templatize: true
|
|
|
|
# For full http client config parameters, ref: https://pkg.go.dev/github.com/prometheus/common/config?tab=doc#HTTPClientConfig
|
|
#
|
|
# http_client_config:
|
|
# tls_config:
|
|
# insecure_skip_verify: true
|
|
# basic_auth:
|
|
# username: myuser
|
|
# #password: veryverysecret
|
|
# password_file: /tmp/mysecret.txt
|
|
|
|
# Accepted status codes for this probe. Defaults to 2xx.
|
|
# valid_status_codes: [ <int>, ... | default = 2xx ] |