#I'm finding adding custom opentel spans

1 messages · Page 1 of 1 (latest)

olive frost
#

With respect to 1:

Method description for get_tracer from open tel SDK says the following:

        Args:
            instrumenting_module_name: The uniquely identifiable name for instrumentation
                scope, such as instrumentation library, package, module or class name.
                ``__name__`` should be avoided as this can result in
                different tracer names if the tracers are in different files.
                It is better to use a fixed string that can be imported where
                needed and used consistently as the name of the tracer.

                This should *not* be the name of the module that is
                instrumented but the name of the module doing the instrumentation.
                E.g., instead of ``"requests"``, use
                ``"opentelemetry.instrumentation.requests"``.

but ancedotally seems like custom spans work more reliably when I create the tracer using __name__ as the instrumenting module name from inside the file that defines the main module object 🤷‍♂️

brazen root
olive frost
#

Thanks Vito, let me take a look

olive frost
#

Maddeningly having a really hard time getting consistent behaviour here. Sometimes it works great, sometimes all custom spans are missing, sometimes most of them are missing 🤷‍♂️

olive frost
#

Just add this diff:

diff --git a/daggerflows/dbt-service/src/dbt_service/main.py b/daggerflows/dbt-service/src/dbt_service/main.py
index baecde5..b63ea03 100644
--- a/daggerflows/dbt-service/src/dbt_service/main.py
+++ b/daggerflows/dbt-service/src/dbt_service/main.py
@@ -74,6 +74,7 @@ class DbtService(
 
     @tracer.start_as_current_span("Build image")
     def __post_init__(self):
+        (lambda x: x)(5)
         try:
             self.base_container = self.build()

And some of the custom spans immediately worked again.

dagger.json has the "disableDefaultFunctionCaching": true. At a loss on how to explain this

brazen root
#

try adding a sleep(1) before the program exits? i wonder if something isn't flushing before exiting