Adding support to use grafana templating

Change-Id: I63302965cabb1deb0a1a74ca62f3e56bd04309b7
Story: 2002175
Task: 20041
This commit is contained in:
Martin Chacon Piza 2018-06-07 14:32:24 +02:00
parent 999bfa2a05
commit c5f514815c
2 changed files with 10 additions and 0 deletions

View File

@ -194,3 +194,9 @@ def metrics_measurement_list(request, **kwargs):
def metrics_stat_list(request, **kwargs): def metrics_stat_list(request, **kwargs):
result = client.monascaclient(request).metrics.list_statistics(**kwargs) result = client.monascaclient(request).metrics.list_statistics(**kwargs)
return result['elements'] if type(result) is dict else result return result['elements'] if type(result) is dict else result
@profiler.trace
def metrics_dimension_value_list(request, **kwargs):
result = client.monascaclient(request).metrics.list_dimension_values(**kwargs)
return result['elements'] if type(result) is dict else result

View File

@ -316,6 +316,10 @@ class MonascaProxyView(TemplateView):
results = {'elements': api.monitor. results = {'elements': api.monitor.
metrics_measurement_list(request, metrics_measurement_list(request,
**req_kwargs)} **req_kwargs)}
elif "dimensions" == parts[1]:
results = {'elements': api.monitor.
metrics_dimension_value_list(request,
**req_kwargs)}
if not results: if not results:
LOG.warning("There was a request made for the path %s that" LOG.warning("There was a request made for the path %s that"
" is not supported." % restpath) " is not supported." % restpath)