When a request is made with the header Content-Type: application/json then the server will assume that values are being passed in as a JSON object in the body of the request, rather than as URL parameters. For example, posting the following
{
"query": "describe all",
"profile": true
}
{
"query": "select cpu.percent from -40m to now where host match 'mqe'"
}
The main useful addition is that you can use JSON to describe extra constraints to be placed on the query results (a programmatic where clause):
{
"query": "select cpu.percent from -40m to now where host match 'mqe'",
"where": {
all: [
{"key_match": {"key": "app", "regex": "foo|qu?x\\("}},
{"key_in": {"key": "host", "values": ["host5", "host17", "host29"]}}
]
}
}
These predicates mirror the built-in predicates in the where clause. If your query also contains a where clause, then they both must be satisfied for a timeseries to be included.
JSON API for
/query
pathWhen a request is made with the header
Content-Type: application/json
then the server will assume that values are being passed in as a JSON object in the body of the request, rather than as URL parameters. For example, posting the followingThe main useful addition is that you can use JSON to describe extra constraints to be placed on the query results (a programmatic
where
clause):These predicates mirror the built-in predicates in the
where
clause. If your query also contains awhere
clause, then they both must be satisfied for a timeseries to be included.The full specification for predicates follows:
A predicate is one of the following:
JSON Tag-Based Ingestion API through
/ingest
pathIn addition, a JSON API is available that allows you to ingest a metrics of the form
posted to the body of the request (with
Content-Type: application/json
).TODO: add configuration to enable/disable this
Misc Changes
In order to make this change smoother, some other things were moved around (
predicate
now gets its own package insidequery
, for example).Note: the profiling JSON response now consists of timestamp strings instead of millisecond epochs.
@drcapulet @achow @syamp