Skip to content

Latest commit

 

History

History
160 lines (124 loc) · 9.33 KB

QueryApi.md

File metadata and controls

160 lines (124 loc) · 9.33 KB

wavefront_api_client.QueryApi

All URIs are relative to https://YOUR_INSTANCE.wavefront.com

Method HTTP request Description
query_api GET /api/v2/chart/api Perform a charting query against Wavefront servers that returns the appropriate points in the specified time window and granularity
query_raw GET /api/v2/chart/raw Perform a raw data query against Wavefront servers that returns second granularity points grouped by tags

query_api

QueryResult query_api(q, s, g, n=n, query_type=query_type, e=e, p=p, i=i, auto_events=auto_events, summarization=summarization, list_mode=list_mode, strict=strict, view=view, include_obsolete_metrics=include_obsolete_metrics, sorted=sorted, cached=cached, dimension_tuples=dimension_tuples, use_raw_qk=use_raw_qk)

Perform a charting query against Wavefront servers that returns the appropriate points in the specified time window and granularity

Long time spans and small granularities can take a long time to calculate

Example

from __future__ import print_function
import time
import wavefront_api_client
from wavefront_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = wavefront_api_client.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'

# create an instance of the API class
api_instance = wavefront_api_client.QueryApi(wavefront_api_client.ApiClient(configuration))
q = 'q_example' # str | the query expression to execute
s = 's_example' # str | the start time of the query window in epoch milliseconds
g = 'g_example' # str | the granularity of the points returned
n = 'n_example' # str | name used to identify the query (optional)
query_type = 'HYBRID' # str | the query type of the query (optional) (default to HYBRID)
e = 'e_example' # str | the end time of the query window in epoch milliseconds (null to use now) (optional)
p = 'p_example' # str | the approximate maximum number of points to return (may not limit number of points exactly) (optional)
i = true # bool | whether series with only points that are outside of the query window will be returned (defaults to true) (optional)
auto_events = true # bool | whether events for sources included in the query will be automatically returned by the query (optional)
summarization = 'summarization_example' # str | summarization strategy to use when bucketing points together (optional)
list_mode = true # bool | retrieve events more optimally displayed for a list (optional)
strict = true # bool | do not return points outside the query window [s;e), defaults to false (optional)
view = 'METRIC' # str | view of the query result, metric or histogram, defaults to metric (optional) (default to METRIC)
include_obsolete_metrics = true # bool | include metrics that have not been reporting recently, defaults to false (optional)
sorted = false # bool | sorts the output so that returned series are in order, defaults to false (optional) (default to false)
cached = true # bool | whether the query cache is used, defaults to true (optional) (default to true)
dimension_tuples = ['dimension_tuples_example'] # list[str] |  (optional)
use_raw_qk = false # bool |  (optional) (default to false)

try:
    # Perform a charting query against Wavefront servers that returns the appropriate points in the specified time window and granularity
    api_response = api_instance.query_api(q, s, g, n=n, query_type=query_type, e=e, p=p, i=i, auto_events=auto_events, summarization=summarization, list_mode=list_mode, strict=strict, view=view, include_obsolete_metrics=include_obsolete_metrics, sorted=sorted, cached=cached, dimension_tuples=dimension_tuples, use_raw_qk=use_raw_qk)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling QueryApi->query_api: %s\n" % e)

Parameters

Name Type Description Notes
q str the query expression to execute
s str the start time of the query window in epoch milliseconds
g str the granularity of the points returned
n str name used to identify the query [optional]
query_type str the query type of the query [optional] [default to HYBRID]
e str the end time of the query window in epoch milliseconds (null to use now) [optional]
p str the approximate maximum number of points to return (may not limit number of points exactly) [optional]
i bool whether series with only points that are outside of the query window will be returned (defaults to true) [optional]
auto_events bool whether events for sources included in the query will be automatically returned by the query [optional]
summarization str summarization strategy to use when bucketing points together [optional]
list_mode bool retrieve events more optimally displayed for a list [optional]
strict bool do not return points outside the query window [s;e), defaults to false [optional]
view str view of the query result, metric or histogram, defaults to metric [optional] [default to METRIC]
include_obsolete_metrics bool include metrics that have not been reporting recently, defaults to false [optional]
sorted bool sorts the output so that returned series are in order, defaults to false [optional] [default to false]
cached bool whether the query cache is used, defaults to true [optional] [default to true]
dimension_tuples list[str] [optional]
use_raw_qk bool [optional] [default to false]

Return type

QueryResult

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-javascript; charset=UTF-8, application/javascript; charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

query_raw

list[RawTimeseries] query_raw(metric, host=host, source=source, start_time=start_time, end_time=end_time)

Perform a raw data query against Wavefront servers that returns second granularity points grouped by tags

An API to check if ingested points are as expected. Points ingested within a single second are averaged when returned.

Example

from __future__ import print_function
import time
import wavefront_api_client
from wavefront_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = wavefront_api_client.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'

# create an instance of the API class
api_instance = wavefront_api_client.QueryApi(wavefront_api_client.ApiClient(configuration))
metric = 'metric_example' # str | metric to query ingested points for (cannot contain wildcards)
host = 'host_example' # str | host to query ingested points for (cannot contain wildcards). host or source is equivalent, only one should be used. (optional)
source = 'source_example' # str | source to query ingested points for (cannot contain wildcards). host or source is equivalent, only one should be used. (optional)
start_time = 789 # int | start time in epoch milliseconds (cannot be more than a day in the past) null to use an hour before endTime (optional)
end_time = 789 # int | end time in epoch milliseconds (cannot be more than a day in the past) null to use now (optional)

try:
    # Perform a raw data query against Wavefront servers that returns second granularity points grouped by tags
    api_response = api_instance.query_raw(metric, host=host, source=source, start_time=start_time, end_time=end_time)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling QueryApi->query_raw: %s\n" % e)

Parameters

Name Type Description Notes
metric str metric to query ingested points for (cannot contain wildcards)
host str host to query ingested points for (cannot contain wildcards). host or source is equivalent, only one should be used. [optional]
source str source to query ingested points for (cannot contain wildcards). host or source is equivalent, only one should be used. [optional]
start_time int start time in epoch milliseconds (cannot be more than a day in the past) null to use an hour before endTime [optional]
end_time int end time in epoch milliseconds (cannot be more than a day in the past) null to use now [optional]

Return type

list[RawTimeseries]

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]