MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / __call__

Method __call__

openlibrary/utils/sentry.py:175–199  ·  view source on GitHub ↗
(self, handler)

Source from the content-addressed store, hash-verified

173 return handler or "<other>"
174
175 def __call__(self, handler):
176 route_name = self.find_route_name()
177 hub = sentry_sdk.Hub.current
178 with sentry_sdk.Hub(hub) as hub:
179 with hub.configure_scope() as scope:
180 scope.clear_breadcrumbs()
181 scope.add_event_processor(add_web_ctx_to_event)
182
183 environ = dict(web.ctx.env)
184 # Don't forward cookies to Sentry
185 environ.pop("HTTP_COOKIE", None)
186
187 transaction = Transaction.continue_from_environ(
188 environ,
189 op="http.server",
190 name=route_name,
191 source=TransactionSource.ROUTE,
192 )
193
194 with hub.start_transaction(transaction):
195 web.ctx.sentry_route_name = route_name
196 try:
197 return handler()
198 finally:
199 transaction.set_http_status(int(web.ctx.status.split()[0]))
200
201
202class InfogamiSentryProcessor(WebPySentryProcessor):

Callers

nothing calls this directly

Calls 1

find_route_nameMethod · 0.95

Tested by

no test coverage detected