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
When introspecting metric definition the Python client returns metric type of (in json) counter, gauge or string (single noun). If I want to build dynamic query to fetch metric data based on the returned definition I would have convert the returned type gauge into MetricType.Gauge whose string representation is gauges (plural). It would be convenient to pass the same returned type to query_metric(type, metric_id).
The text was updated successfully, but these errors were encountered:
from hawkular.metrics import HawkularMetricsClient, MetricType
host = 'hawkular-services-openshift-infra.origin.cloud1.hawkular.org'
path = 'hawkular/metrics'
port = '443'
token = 'paste_real_token_here'
tenant_id='promgen'
if __name__ == "__main__":
client = HawkularMetricsClient(token=token, tenant_id=tenant_id, scheme='https', host=host, path=path, port=port)
definition = client.query_metric_definitions(custom_metric='true')
# print metric id and type.
# fetch actual data from the first counter metric
for item in definition:
metric_type = item['type']
metric_id = item['id']
print "id: {}, item: {}".format(metric_id, metric_type)
if metric_type == 'counter':
# it would be nice if we can pass metric_type directly to query_metric()
# data = client.query_metric(metric_type, metric_id);
data = client.query_metric(MetricType.Counter, metric_id);
print data
break
When introspecting metric definition the Python client returns metric type of (in json)
counter
,gauge
orstring
(single noun). If I want to build dynamic query to fetch metric data based on the returned definition I would have convert the returned typegauge
intoMetricType.Gauge
whose string representation isgauges
(plural). It would be convenient to pass the same returned type toquery_metric(type, metric_id)
.The text was updated successfully, but these errors were encountered: