Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can also define the query to search in a given context across all values of one or more tags provided in the context by specifying * as a value for a tag. See the examples below for its use.

Note: An earlier version of this API (introduced in CDAP 2.8.0) has been deprecated, and should be replaced, as it will be removed in a later version of CDAP:

Code Block
POST /v3/metrics/search?target=childContext[&context=<context>]

Parameter

Description

context [Optional]

Metrics context to search within. If not provided, the search is provided across all contexts. Consists of a collection of tags.

...

Code Block
POST /v3/metrics/search?target=metric&tag=<context>
context

Parameter

Description

Metrics context to search within. Consists of a collection of tags.

Note: An earlier version of this API (introduced in CDAP 2.8.0) has been deprecated, and should be replaced, as it will be removed in a later version of CDAP:

...

Metrics context to search within. Consists of a collection of tags.

Example

HTTP Method

POST /v3/metrics/search?target=metric&tag=namespace:default&tag=app:PurchaseHistory

Returns

["system.process.events.in","system.process.events.processed","system.process.instance", "system.process.tuples.attempt.read","system.process.tuples.read"]

Description

Returns all metrics in the context of the application PurchaseHistory of the default namespace; in this case, returns a list of system and (possibly) user-defined metrics.

 

 

HTTP Method

POST /v3/metrics/search?target=metric&tag=namespace:default&tag=app:SportResults&tag=service:UploadService

Returns

["system.dataset.store.ops","system.dataset.store.reads","system.requests.count", "system.response.successful.count", "user.uploads.completed"]

Description

Returns all metrics in the context of the service UploadService of the application SportResults of the default namespace; in this case, returns a list of system and user-defined metrics.

...

Parameter

Description

context

Metrics context to search within, a collection of tags

metric

Metric(s) being queried, a collection of metric names

time-range

A time range or aggregate=true for all since the application was deployed

tags (optional)

Tag list by which to group results (optional)

...

)

...

Query Examples

HTTP Method

POST /v3/metrics/query?tag=namespace:default&tag=app:HelloWorld& &metric=system.process.events.processed&aggregate=true

Returns

{"startTime":0,"endTime":1429327964,"series":[{"metricName":"system.process.events.processed","grouping":{},"data":[{"time":0,"value":1}]}]}

Description

Using a System metric, system.process.events.processed

 

 

HTTP Method

POST /v3/metrics/query?tag=namespace:default&tag=app:HelloWorld& &tag=run:13ac3a50-a435-49c8-a752-83b3c1e1b9a8&metric=user.names.bytes&aggregate=true

Returns

{"startTime":0,"endTime":1429328212,"series":[{"metricName":"user.names.bytes","grouping":{},"data":[{"time":0,"value":8}]}]}

Description

Querying the User-defined metric names.bytes by its run-ID

 

 

HTTP Method

POST /v3/metrics/query?tag=namespace:default&tag=app:HelloWorld&metric=user.names.bytes

Returns

{"startTime":0,"endTime":1429475995,"series":[]}

Description

Using a User-defined metric, names.bytes in a service's Handler, called before any data entered, returning an empty series

 

 

HTTP Method

POST /v3/metrics/query?tag=namespace:default&tag=app:HelloWorld&&metric=user.names.bytes

Returns

{"startTime":0,"endTime":1429477901,"series":[{"metricName":"user.names.bytes","grouping":{},"data":[{"time":0,"value":44}]}]}

Description

Using a User-defined metric, names.bytes in a service's Handler

...