Merge "Log time of the apply_func only if it took more than 0.1 second"
This commit is contained in:
@@ -18,9 +18,15 @@ NOTE: This module shall not be used by external projects. It will be moved
|
|||||||
import collections
|
import collections
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from neutron_lib.utils import helpers
|
from neutron_lib.utils import helpers
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# This dictionary will store methods for extending API resources.
|
# This dictionary will store methods for extending API resources.
|
||||||
# Extensions can add their own methods by invoking register_funcs().
|
# Extensions can add their own methods by invoking register_funcs().
|
||||||
_resource_extend_functions = {
|
_resource_extend_functions = {
|
||||||
@@ -70,7 +76,7 @@ def get_funcs(resource):
|
|||||||
return _resource_extend_functions.get(resource, [])
|
return _resource_extend_functions.get(resource, [])
|
||||||
|
|
||||||
|
|
||||||
@helpers.timecost
|
@timeutils.time_it(LOG, min_duration=0.1)
|
||||||
def apply_funcs(resource_type, response, db_object):
|
def apply_funcs(resource_type, response, db_object):
|
||||||
"""Appy registered functions for the said resource type.
|
"""Appy registered functions for the said resource type.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user