Skip to content

Commit

Permalink
Move pyramid otel instrumentation to BaseplateConfigurator (#952)
Browse files Browse the repository at this point in the history
This moves the instrumentation logic to the initialization of the BaseplateConfigurator class instead of being an import side-effect.

Co-authored-by: Trevor Riles <[email protected]>
  • Loading branch information
trevorriles and Trevor Riles authored Jul 24, 2024
1 parent 9f431e7 commit 6531fbe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions baseplate/frameworks/pyramid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

logger = logging.getLogger(__name__)

PyramidInstrumentor().instrument()


class SpanFinishingAppIterWrapper(Iterable):
"""Wrapper for Response.app_iter that finishes the span when the iterator is done.
Expand Down Expand Up @@ -354,6 +352,8 @@ def __init__(
self.edge_context_factory = edge_context_factory
self.header_trust_handler = header_trust_handler or StaticTrustHandler(trust_headers=False)

PyramidInstrumentor().instrument()

def _on_application_created(self, event: pyramid.events.ApplicationCreated) -> None:
# attach the baseplate object to the application the server gets
event.app.baseplate = self.baseplate
Expand Down

0 comments on commit 6531fbe

Please sign in to comment.