This usually happens if the custom span is created outside the context of the auto-instrumented span, so it doesn't inherit the parent trace context. To ensure your custom span is a child, you must create it within the active context of the auto-instrumented span鈥攐therwise, it will start a new trace (<https://github.com/Arize-ai/phoenix/blob/main/docs/tracing/how-to-tracing/custom-spans.md|custom-spans.md>, <https://docs.arize.com/phoenix/tracing/how-to-tracing/manual-instrumentation/custom-spans#P7alvl1dWN6l|manual instrumentation guide>).
If you need to explicitly set the parent, use the current context when starting your span. For example, in Python:
```
from opentelemetry import trace
from opentelemetry.trace import set_span_in_context
parent_span = trace.get_current_span()
parent_context = set_span_in_context(parent_span)
with tracer.start_as_current_span("custom-span", context=parent_context) as span:
# custom logic
pass
```
Would you like more detail or troubleshooting steps?
Sources:
- <https://github.com/Arize-ai/phoenix/blob/main/docs/tracing/how-to-tracing/custom-spans.md|custom-spans.md>