New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include eventid in log lines when processing incoming federation transactions #3959

Merged
merged 6 commits into from Sep 27, 2018

Conversation

Projects
None yet
3 participants
@richvdh
Member

richvdh commented Sep 26, 2018

when processing incoming transactions, it can be hard to see what's going on, because we process a bunch of stuff in parallel, and because we may end up recursively working our way through a chain of three or four events.

This PR creates a way to use logcontexts to add the relevant event ids to the log lines.

richvdh added some commits Sep 25, 2018

implement and use nested_logcontext
when processing incoming transactions, it can be hard to see what's going on,
because we process a bunch of stuff in parallel, and because we may end up
recursively working our way through a chain of three or four events.

This commit creates a way to use logcontexts to add the relevant event ids to
the log lines.

@richvdh richvdh requested a review from matrix-org/synapse-core Sep 26, 2018

@hawkowl

This comment has been minimized.

Contributor

hawkowl commented Sep 26, 2018

@richvdh CI is sad :(

[FAIL]
Traceback (most recent call last):
  File "/home/travis/build/matrix-org/synapse/tests/test_federation.py", line 241, in test_cant_hide_past_history
    self.assertEqual(self.successResultOf(extrem)[0], "two:test.serv")
  File "/home/travis/build/matrix-org/synapse/.tox/py27/lib/python2.7/site-packages/twisted/trial/_synctest.py", line 432, in assertEqual
    super(_Assertions, self).assertEqual(first, second, msg)
  File "/opt/python/2.7.14/lib/python2.7/unittest/case.py", line 513, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/opt/python/2.7.14/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual
    raise self.failureException(msg)
twisted.trial.unittest.FailTest: 'one:test.serv' != 'two:test.serv'
tests.test_federation.MessageAcceptTests.test_cant_hide_past_history
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/home/travis/build/matrix-org/synapse/.tox/py27/lib/python2.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/travis/build/matrix-org/synapse/.tox/py27/lib/python2.7/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/travis/build/matrix-org/synapse/synapse/handlers/federation.py", line 268, in on_receive_pdu
    origin, pdu, prevs, min_depth
  File "/home/travis/build/matrix-org/synapse/.tox/py27/lib/python2.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/home/travis/build/matrix-org/synapse/synapse/handlers/federation.py", line 490, in _get_missing_events_for_pdu
    with logcontext.nested_logging_context(ev.event_id):
  File "/home/travis/build/matrix-org/synapse/synapse/util/logcontext.py", line 466, in nested_logging_context
    nested_context.request = parent_context.request + "-" + suffix
exceptions.AttributeError: 'Sentinel' object has no attribute 'request'
tests.test_federation.MessageAcceptTests.test_cant_hide_past_history
@hawkowl

CI failures :(

richvdh added some commits Sep 26, 2018

Make 'request' a kwarg for LoggingContext
this is a useful thing to be able to do

@richvdh richvdh requested a review from matrix-org/synapse-core Sep 26, 2018

@richvdh richvdh merged commit 4a15a3e into develop Sep 27, 2018

10 checks passed

ci/circleci: sytestpy2 Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgres Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3 Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgres Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@richvdh richvdh deleted the rav/nested_logcontext branch Sep 27, 2018

@ara4n

This comment has been minimized.

Member

ara4n commented Sep 27, 2018

(this is so cool)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment