You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment we don't have a way to get JSON object names using JSONPath syntax. But some programs send statistics as objects that contain other objects rather than arrays. For example, this is the NGINX Unit statistics output:
In this case we need to iterate over the applications object and get the name for each application object to use it as the metric label.
It seems that this problem should be solved by the exporter, not the application itself, because we can't control the output of each API. See also the case with another API in #250.
There is a practice to extend the JSONPath syntax to get the object names, parent elements, etc. For example, to get the name of an object, a tilde (~) is typically used. This syntax is used by the widely used JSONPath-Plus JS library and by the yaml-jsonpath Go library created by VMWare.
Using this syntax we could get the metrics for applications running by NGINX Unit like this:
I think we don't need to switch from the current library or send a syntax-extending patch to the upstream, we need to add it just for this exporter.
For now, anyone experiencing this issue will need to fork the project just to add this feature and maintain it themselves. Or this can also be solved by creating an exporter that uses JMESPath. But simply extending the existing syntax seems preferable.
The text was updated successfully, but these errors were encountered:
Hello community,
At the moment we don't have a way to get JSON object names using JSONPath syntax. But some programs send statistics as objects that contain other objects rather than arrays. For example, this is the NGINX Unit statistics output:
In this case we need to iterate over the
applications
object and get the name for each application object to use it as the metric label.It seems that this problem should be solved by the exporter, not the application itself, because we can't control the output of each API. See also the case with another API in #250.
There is a practice to extend the JSONPath syntax to get the object names, parent elements, etc. For example, to get the name of an object, a tilde (
~
) is typically used. This syntax is used by the widely usedJSONPath-Plus
JS library and by theyaml-jsonpath
Go library created by VMWare.Using this syntax we could get the metrics for applications running by NGINX Unit like this:
I think we don't need to switch from the current library or send a syntax-extending patch to the upstream, we need to add it just for this exporter.
For now, anyone experiencing this issue will need to fork the project just to add this feature and maintain it themselves. Or this can also be solved by creating an exporter that uses JMESPath. But simply extending the existing syntax seems preferable.
The text was updated successfully, but these errors were encountered: