# HG changeset patch # User RhodeCode Admin # Date 2023-03-24 21:16:36 # Node ID 176bb96a18e6ff8f721812dd9310ec64df0fb6ef # Parent 6a99d09b88d419d1bc94d5b85f4e80302d4f8f82 logging: skip certain very large args/kwargs reporting in logs of called methods diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -336,16 +336,26 @@ class HTTPApplication(object): # NOTE(marcink): trading complexity for slight performance if log.isEnabledFor(logging.DEBUG): - no_args_methods = [ - - ] - if method in no_args_methods: + # also we SKIP printing out any of those methods args since they maybe excessive + just_args_methods = { + 'commitctx': ('content', 'removed', 'updated') + } + if method in just_args_methods: + skip_args = just_args_methods[method] call_args = '' + call_kwargs = {} + for k in kwargs: + if k in skip_args: + # replace our skip key with dummy + call_kwargs[k] = f'RemovedParam({k})' + else: + call_kwargs[k] = kwargs[k] else: call_args = args[1:] + call_kwargs = kwargs log.debug('Method requested:`%s` with args:%s kwargs:%s context_uid: %s, repo_state_uid:%s', - method, call_args, kwargs, context_uid, repo_state_uid) + method, call_args, call_kwargs, context_uid, repo_state_uid) statsd = request.registry.statsd if statsd: @@ -418,7 +428,7 @@ class HTTPApplication(object): 'id': payload_id, 'result': resp } - + log.debug('Serving data for method %s', method) return resp def vcs_stream_view(self, request):