diff --git a/apimanager/metrics/static/metrics/js/lastEndpointMetric.js b/apimanager/metrics/static/metrics/js/lastEndpointMetric.js index e22ceaac..82c11f88 100644 --- a/apimanager/metrics/static/metrics/js/lastEndpointMetric.js +++ b/apimanager/metrics/static/metrics/js/lastEndpointMetric.js @@ -4,12 +4,13 @@ $(document).ready(function($) { function getMetricLastEndpoint(){ $.ajax({url: "/metrics/api/last-endpoint", success: function(result){ - var content = "Last call: " - +result['app_name']+" " + var content = "" + +result['implemented_by_partial_function']+" took " + +result['duration']+"ms at " + +result['date']+" " +result['verb']+" " - + result['implemented_by_partial_function'] - +" costed " - +result['duration'] + + result['url'] + +" ms."; $("#last_endpoint").text(content); setTimeout(function(){getMetricLastEndpoint();}, 5000); // will call function to update time every 5 seconds diff --git a/apimanager/metrics/templates/metrics/api.html b/apimanager/metrics/templates/metrics/api.html index e8b174c1..99184780 100644 --- a/apimanager/metrics/templates/metrics/api.html +++ b/apimanager/metrics/templates/metrics/api.html @@ -14,7 +14,7 @@ {{ form.media }} {# Form required JS and CSS #} {% endblock %}

{% trans "API Metrics" %}

-
Last call: API Manager getMetrics costed 294 ms
+
getBanks took 43ms at 2023-12-06T11:00:49Z GET /obp/v4.0.0/banks ms.

{% trans "Filter" %}

diff --git a/apimanager/metrics/views.py b/apimanager/metrics/views.py index a40c33d0..cdacee80 100644 --- a/apimanager/metrics/views.py +++ b/apimanager/metrics/views.py @@ -209,10 +209,11 @@ def get_metric_last_endpoint(request): try: metric = api.get(urlpath)['metrics'][0] last_endpoint_metric={ - 'app_name':metric['app_name'], - 'verb': metric['verb'], - 'implemented_by_partial_function': metric['implemented_by_partial_function'], - 'duration': metric['duration'] + 'implemented_by_partial_function':metric['implemented_by_partial_function'], + 'duration': metric['duration'], + 'date': metric['date'], + 'verb': metric['verb'], + 'url': metric['url'] } except Exception as err: LOGGER.exception('error_once_only - Error Message: {}'.format(err))