def get(offset, limit): set_transaction_name('rest.area.entity:get') inflection = engine() examples = [{'id': x, 'name': inflection.number_to_words(x)} for x in range(1, 51)] return examples[offset:offset + limit], len(examples)
def inner(*args, **kwargs): if group == "Python/napfs": set_transaction_name(txn_name) with FunctionTrace(name=txn_name, group=group): try: return f(*args, **kwargs) except Exception as e: if not isinstance(e, falcon.HTTPNotFound): notice_error(sys.exc_info()) raise
def get(return_format): set_transaction_name('rest.diagnostics.crossdomain:get') if return_format != ReturnFormat.Xml: raise Exception(404, 'Not found.') domains = [{'@domain': x.get('domain'), '@secure': 'true' if x.get('secure') else 'false'} for x in settings.crossdomains] output = {'cross-domain-policy': {'site-control': {'@permitted-cross-domain-policies': 'all'}, 'allow-access-from': domains}} return output, 0
def __getattribute__(self, name): """Overridden to set the New Relic transaction name if handler. """ if agent and '__mapped_names' not in name and name in self.__mapped_names: try: agent.set_transaction_name(name) except: # pylint: disable=all logging.warning('Could not set New Relic transaction name. ' 'Is it installed and configured?') return object.__getattribute__(self, name)
def inner(*args, **kwargs): if group == "Python/napfs": set_transaction_name(txn_name) with FunctionTrace( transaction=current_transaction(), name=txn_name, group=group ): try: return f(*args, **kwargs) except Exception as e: if not isinstance(e, falcon.HTTPNotFound): record_exception(*sys.exc_info()) raise
def execute_wrapper(wrapped, instance, args, kwargs): transaction = current_transaction() if transaction is None: return wrapped(*args, **kwargs) def _handler(handler, *args, **kwargs): return handler handler = _handler(*args, **kwargs) name = callable_name(handler) set_transaction_name(name) with FunctionTrace(transaction, name): return wrapped(*args, **kwargs)
def get(return_format): set_transaction_name('rest.diagnostic.healthcheck:get') status = _check_online_file() bugsnag = settings.enable_error_notification if return_format.format == ReturnFormat.Html: output = _build_response_html(settings.hostname, settings.hostip, _get_status_message(status), _get_bugsnag_message(bugsnag), settings.environment) else: output = [{ 'hostName': settings.hostname, 'hostIP': settings.hostip, 'environment': settings.environment, 'status': 'ONLINE' if status else 'OFFLINE', 'bugsnag': 'ENABLED' if bugsnag else 'DISABLED' }] return output, 0
def inner(request, resource_path): agent.set_transaction_name( get_transaction_name_path(resource_path), 'Python/WebFramework/Controller') return func(request, resource_path)
def inner(request, resource_path): agent.set_transaction_name( resource_path, 'Python/WebFramework/Controller' ) return func(request, resource_path)
def process_response(self, req, resp, resource, req_succeeded): newrelic_agent.set_transaction_name(self.get_transaction_name(req), priority=100)