Skip to content

Commit

Permalink
Move pyramid otel instrumentation to BaseplateConfigurator
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.
  • Loading branch information
Trevor Riles committed Jul 24, 2024
1 parent 3423a65 commit 88c2e76
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 88c2e76

Please sign in to comment.