open-telemetry / open-telemetry/opentelemetry-python-contrib
Migration from Jaeger client to Opentelemetry only shows base level traces
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
Python version = 3.10.8
Platform version:
NAME="Ubuntu"
VERSION="14.04.6 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.6 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
Dependencies versions
connexion[flask]==2.14.1
flask==2.2.2
flask-opentracing==1.1.0
opentelemetry-api==1.15.0
opentelemetry-exporter-jaeger==1.15.0
opentelemetry-exporter-jaeger-proto-grpc==1.15.0
opentelemetry-exporter-jaeger-thrift==1.15.0
opentelemetry-instrumentation==0.36b0
opentelemetry-instrumentation-flask==0.36b0
opentelemetry-instrumentation-wsgi==0.36b0
opentelemetry-opentracing-shim==0.36b0
opentelemetry-sdk==1.15.0
opentelemetry-semantic-conventions==0.36b0
opentelemetry-util-http==0.36b0
opentracing==2.4.0
Steps to reproduce
Originally in Python 3.6, we created a tracer object using jaeger_client library's Config object, then we pass that tracer object into flask_opentracing libraries FlaskTracer along with Jaeger configuration and app object. This worked and from the Jaeger UI we were able to see the full stack call traces. However we have to upgrade services to 3.10 which Jaeger is no longer supporting.
We then looked at the opentelemetry migration which has a similar process of turning the Jaeger tracer into an Opentelemtry shim using JaegerExporter passed into a BatchSpanProcessor
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.shim.opentracing_shim import create_tracer
DEFAULT_JAEGER_AGENT_HOST = 'localhost'
DEFAULT_JAEGER_AGENT_PORT = 6831
jaeger_exporter = JaegerExporter(
agent_host_name=DEFAULT_JAEGER_AGENT_HOST,
agent_port=DEFAULT_JAEGER_AGENT_PORT
)
def create_opentelemetry_tracer(span_processor, service_name):
trace.set_tracer_provider(
TracerProvider(resource=Resource.create({SERVICE_NAME: service_name}))
)
trace.get_tracer_provider().add_span_processor(span_processor)
shim = create_tracer(trace.get_tracer_provider())
return shim
span_processor = BatchSpanProcessor(jaeger_exporter)
tracer = create_opentelemetry_tracer(span_processor, service_name)
flask_tracer = FlaskTracer(
tracer, config.trace_all_requests,
app, config.traced_attributes
)
return flask_tracer
Then I launch the Jaeger UI client as a docker container:
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-e COLLECTOR_OTLP_ENABLED=true \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 14250:14250 \
-p 14268:14268 \
-p 14269:14269 \
-p 9411:9411 \
jaegertracing/all-in-one:1.41
Go to localhost:16686 to see the Jaeger UI, run some API calls in the service to validate that the service full stack trace call shows up.
What is the expected behavior?
Expect to see the full stack trace of the API call including connecting API and DB calls.
What is the actual behavior?
Only the base level stack of the service and what seems to only be limited to 1 span.

Additional context
This is running through a package manager called microcosm and using connexion
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is identified. Reproduce the issue with the listed Python, Flask, instrumentation, and Jaeger versions, using the shown FlaskTracer and JaegerExporter setup, then inspect the OpenTelemetry shim and Flask instrumentation path. Done means API requests show the expected nested API and database spans in the Jaeger UI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, flask, python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100