Skip to content

Commit

Permalink
Fixup: callable_name import
Browse files Browse the repository at this point in the history
  • Loading branch information
hmstepanek committed Jan 5, 2024
1 parent e1e00b8 commit 374b77d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
20 changes: 10 additions & 10 deletions newrelic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import newrelic.api.generator_trace
import newrelic.api.import_hook
import newrelic.api.memcache_trace
import newrelic.common.object_wrapper
from newrelic.common.object_names import callable_name
import newrelic.api.profile_trace
import newrelic.api.settings
import newrelic.api.transaction_name
Expand Down Expand Up @@ -1345,7 +1345,7 @@ def _process_background_task_configuration():
group = _config_object.get(section, "group")

if name and name.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
name = eval(name, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register background-task %s", ((module, object_path, application, name, group),))
Expand Down Expand Up @@ -1395,7 +1395,7 @@ def _process_database_trace_configuration():
sql = _config_object.get(section, "sql")

if sql.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
sql = eval(sql, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register database-trace %s", ((module, object_path, sql),))
Expand Down Expand Up @@ -1450,11 +1450,11 @@ def _process_external_trace_configuration():
method = _config_object.get(section, "method")

if url.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
url = eval(url, callable_vars) # nosec, pylint: disable=W0123

if method and method.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
method = eval(method, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register external-trace %s", ((module, object_path, library, url, method),))
Expand Down Expand Up @@ -1522,7 +1522,7 @@ def _process_function_trace_configuration():
rollup = _config_object.get(section, "rollup")

if name and name.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
name = eval(name, callable_vars) # nosec, pylint: disable=W0123

_logger.debug(
Expand Down Expand Up @@ -1580,7 +1580,7 @@ def _process_generator_trace_configuration():
group = _config_object.get(section, "group")

if name and name.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
name = eval(name, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register generator-trace %s", ((module, object_path, name, group),))
Expand Down Expand Up @@ -1639,7 +1639,7 @@ def _process_profile_trace_configuration():
depth = _config_object.get(section, "depth")

if name and name.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
name = eval(name, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register profile-trace %s", ((module, object_path, name, group, depth),))
Expand Down Expand Up @@ -1689,7 +1689,7 @@ def _process_memcache_trace_configuration():
command = _config_object.get(section, "command")

if command.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
command = eval(command, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register memcache-trace %s", (module, object_path, command))
Expand Down Expand Up @@ -1749,7 +1749,7 @@ def _process_transaction_name_configuration():
priority = _config_object.getint(section, "priority")

if name and name.startswith("lambda "):
callable_vars = {"callable_name": newrelic.common.object_wrapper.callable_name}
callable_vars = {"callable_name": callable_name}
name = eval(name, callable_vars) # nosec, pylint: disable=W0123

_logger.debug("register transaction-name %s", ((module, object_path, name, group, priority),))
Expand Down
3 changes: 2 additions & 1 deletion newrelic/hooks/component_piston.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
import newrelic.api.transaction
import newrelic.api.function_trace
import newrelic.common.object_wrapper
from newrelic.common.object_names import callable_name
import newrelic.api.in_function


class MethodWrapper(object):

def __init__(self, wrapped, priority=None):
self._nr_name = newrelic.common.object_wrapper.callable_name(wrapped)
self._nr_name = callable_name(wrapped)
self._nr_wrapped = wrapped
self._nr_priority = priority

Expand Down
5 changes: 3 additions & 2 deletions newrelic/hooks/framework_pylons.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
import newrelic.api.function_trace
import newrelic.api.error_trace
import newrelic.common.object_wrapper
from newrelic.common.object_names import callable_name
import newrelic.api.import_hook

from newrelic.api.time_trace import notice_error

def name_controller(self, environ, start_response):
action = environ['pylons.routes_dict']['action']
return "%s.%s" % (newrelic.common.object_wrapper.callable_name(self), action)
return "%s.%s" % (callable_name(self), action)

class capture_error(object):
def __init__(self, wrapped):
Expand Down Expand Up @@ -69,7 +70,7 @@ def instrument(module):
module, 'WSGIController.__call__')

def name_WSGIController_perform_call(self, func, args):
return newrelic.common.object_wrapper.callable_name(func)
return callable_name(func)

newrelic.api.function_trace.wrap_function_trace(
module, 'WSGIController._perform_call',
Expand Down

0 comments on commit 374b77d

Please sign in to comment.