Comments (4)
btw for asyncio I found I could do it by serializing the parent span in the base process via:
dd_span = tracer.get_call_context().get_current_span()
attrs = {'name', 'service', 'resource', 'span_type', 'trace_id', 'span_id', 'parent_id', 'start'}
dd_span_info = {n: getattr(dd_span, n) for n in attrs} if dd_span else None
then smashing it in in the child process:
try:
if dd_span_info:
dd_ctx = tracer.get_call_context()
parent_span = Span(tracer, **dd_span_info, context=dd_ctx)
dd_ctx._current_span = parent_span
task = asyncio.Task.current_task(loop=self._loop)
set_call_context(task, dd_ctx)
finally:
if dd_span_info:
set_call_context(task, None)
This works because the tracer only needs a few key pieces of information. If we could formalize a process for this it would be awesome!
from dd-trace-py.
hmm, reading http://pypi.datadoghq.com/trace/docs/#distributed-tracing it seems like perhaps the asyncio patchers should support parent trace/span IDs
from dd-trace-py.
ok, I think I've implemented something acceptable in my PR: #248 It adds optional kwargs that follows the aiohttp style for distributed spans...however if there was a way to officially tell the context what the parent was it would be better I think.
from dd-trace-py.
Related to #247 that has been solved. Closing this one too.
from dd-trace-py.
Related Issues (20)
- RuntimeWarnings in IPython when asyncio integration is active HOT 1
- ddtrace.patch breaks serializing loguru logger HOT 1
- DD Agent GlusterFS check returns python errors HOT 4
- DD_KAFKA_PROPAGATION_ENABLED detached traces HOT 4
- ddtrace 2.8.0 crashes with langchain HOT 2
- High CPU usage on startup HOT 13
- Unexpected TypeError while exporting events
- aiopg integration is broken HOT 2
- Datadog tracer SqlAlchemy integration exception
- ddtrace.readthedocs.io is stale HOT 4
- DDTraceDeprecationWarning: The 'span' keyword argument on ExecutionContext methods is deprecated HOT 1
- Set service name for boto3/botocore from env var HOT 1
- dd-trace auto-instrumentation not capturing error and stack trace details for HTTP Exception errors in FastAPI HOT 4
- Sample rate feature is not working (at all) HOT 1
- Asynchronous context manager crash with langchain-openai >= 0.1.2 HOT 3
- Upgrading from v2.4.0 to v2.8.1 changes tracking from `trace.django.request` to `trace.django.middleware` HOT 3
- ddtrace breaks Bedrock Cohere Command R models
- grpc integration causes exception with grpc.aio streaming HOT 1
- ModuleWatchdog is installed unconditionally when ddtrace is imported HOT 1
- Elastic Search Quantization not always effective and does not match Datadog agent's
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dd-trace-py.