Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
18
plugins/processors/starlark/testdata/json.star
vendored
Normal file
18
plugins/processors/starlark/testdata/json.star
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Example of parsing json out of a field and modifying the metric with it.
|
||||
# this is great to use in conjunction with the value parser.
|
||||
#
|
||||
# Example Input:
|
||||
# json value="{\"label\": \"hero\", \"count\": 14}" 1465839830100400201
|
||||
#
|
||||
# Example Output:
|
||||
# json,label=hero count=14i 1465839830100400201
|
||||
|
||||
load("json.star", "json")
|
||||
# loads json.encode(), json.decode(), json.indent()
|
||||
|
||||
def apply(metric):
|
||||
j = json.decode(metric.fields.get('value'))
|
||||
metric.fields.pop('value')
|
||||
metric.tags["label"] = j["label"]
|
||||
metric.fields["count"] = j["count"]
|
||||
return metric
|
Loading…
Add table
Add a link
Reference in a new issue