You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As is common with all instrumentations upstream, AWS Lambda instrumentation testing involves using TestBase. TestBase has a default implementation of super().setUpClass() which initializes OTel Python with a TracerProvider.
This is a problem because we want the tests to test the otel-instrument command which ALSO sets the TracerProvider. But setting the TracerProvider a 2nd time is not allowed so the effects of otel-instrument are ignored. What's more, otel-instrument runs as a subshell as of #164 so we'll have to be more clever as to how we propagate its changes to the parent process while also making sure we do NOT prematurely init OTel's TracerProvider with the TestBase default methods.
One solution is to call the upstream opentelemetry-instrumentation auto initialization script ourselves in the test.
The text was updated successfully, but these errors were encountered:
I guess the actual test business logic would best be in the subprocess (currently we just print os.environ but that could be any logic, like a test file including and calling the lambda handler) - having a runner that spawns the function in a subprocess nicely models the lambda execution itself better. Test failure reporting may not be as nice because of the subprocess but these are more like integration tests anyways.
Description
As is common with all instrumentations upstream, AWS Lambda instrumentation testing involves using
TestBase
.TestBase
has a default implementation ofsuper().setUpClass()
which initializes OTel Python with a TracerProvider.This is a problem because we want the tests to test the
otel-instrument
command which ALSO sets theTracerProvider
. But setting theTracerProvider
a 2nd time is not allowed so the effects ofotel-instrument
are ignored. What's more,otel-instrument
runs as a subshell as of #164 so we'll have to be more clever as to how we propagate its changes to the parent process while also making sure we do NOT prematurely init OTel'sTracerProvider
with theTestBase
default methods.One solution is to call the upstream
opentelemetry-instrumentation
auto initialization script ourselves in the test.The text was updated successfully, but these errors were encountered: