#I'm finding adding custom opentel spans
1 messages · Page 1 of 1 (latest)
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 🤷♂️
Here's how we create custom spans in our tests for it: https://github.com/dagger/dagger/blob/cd5de74a4f31604aca48e106897af53fd5c8792f/dagql/idtui/viztest/python/src/main/__init__.py#L21-L22
Sorry it's been such a pain, we plan to add APIs so you don't have to touch otel directly, but it's taking time to figure out what those APIs should be, between other priorities
Thanks Vito, let me take a look
Example above seems to use the same pattern when instantiating the Tracer:
tracer = trace.get_tracer(__name__)
so will go with this for now
Automation engine to build, test and ship any codebase. Runs locally, in CI, or directly in the cloud - dagger/dagger
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 🤷♂️
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
try adding a sleep(1) before the program exits? i wonder if something isn't flushing before exiting