mirror of
				https://github.com/matrix-org/synapse.git
				synced 2025-10-31 00:01:33 +01:00 
			
		
		
		
	logging and debug for http pusher
This commit is contained in:
		
							parent
							
								
									2c8526cac7
								
							
						
					
					
						commit
						93efd7eb04
					
				| @ -13,21 +13,30 @@ | |||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
| # See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||||
| # limitations under the License. | # limitations under the License. | ||||||
| 
 | import logging | ||||||
| from synapse.push import PusherConfigException |  | ||||||
| 
 | 
 | ||||||
| from twisted.internet import defer, reactor | from twisted.internet import defer, reactor | ||||||
| from twisted.internet.error import AlreadyCalled, AlreadyCancelled | from twisted.internet.error import AlreadyCalled, AlreadyCancelled | ||||||
| 
 | 
 | ||||||
| import logging |  | ||||||
| import push_rule_evaluator | import push_rule_evaluator | ||||||
| import push_tools | import push_tools | ||||||
| 
 | import synapse | ||||||
|  | from synapse.push import PusherConfigException | ||||||
| from synapse.util.logcontext import LoggingContext | from synapse.util.logcontext import LoggingContext | ||||||
| from synapse.util.metrics import Measure | from synapse.util.metrics import Measure | ||||||
| 
 | 
 | ||||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||||
| 
 | 
 | ||||||
|  | metrics = synapse.metrics.get_metrics_for(__name__) | ||||||
|  | 
 | ||||||
|  | http_push_processed_counter = metrics.register_counter( | ||||||
|  |     "http_pushes_processed", | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | http_push_failed_counter = metrics.register_counter( | ||||||
|  |     "http_pushes_failed", | ||||||
|  | ) | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class HttpPusher(object): | class HttpPusher(object): | ||||||
|     INITIAL_BACKOFF_SEC = 1  # in seconds because that's what Twisted takes |     INITIAL_BACKOFF_SEC = 1  # in seconds because that's what Twisted takes | ||||||
| @ -152,9 +161,15 @@ class HttpPusher(object): | |||||||
|             self.user_id, self.last_stream_ordering, self.max_stream_ordering |             self.user_id, self.last_stream_ordering, self.max_stream_ordering | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|  |         logger.info( | ||||||
|  |             "Processing %i unprocessed push actions starting at stream_ordering %i", | ||||||
|  |             len(unprocessed), self.last_stream_ordering, | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|         for push_action in unprocessed: |         for push_action in unprocessed: | ||||||
|             processed = yield self._process_one(push_action) |             processed = yield self._process_one(push_action) | ||||||
|             if processed: |             if processed: | ||||||
|  |                 http_push_processed_counter.inc() | ||||||
|                 self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC |                 self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC | ||||||
|                 self.last_stream_ordering = push_action['stream_ordering'] |                 self.last_stream_ordering = push_action['stream_ordering'] | ||||||
|                 yield self.store.update_pusher_last_stream_ordering_and_success( |                 yield self.store.update_pusher_last_stream_ordering_and_success( | ||||||
| @ -169,6 +184,7 @@ class HttpPusher(object): | |||||||
|                         self.failing_since |                         self.failing_since | ||||||
|                     ) |                     ) | ||||||
|             else: |             else: | ||||||
|  |                 http_push_failed_counter.inc() | ||||||
|                 if not self.failing_since: |                 if not self.failing_since: | ||||||
|                     self.failing_since = self.clock.time_msec() |                     self.failing_since = self.clock.time_msec() | ||||||
|                     yield self.store.update_pusher_failing_since( |                     yield self.store.update_pusher_failing_since( | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user