Closed hitesh1907nayyar closed 2 years ago
It would help anyone else reading this if you formatted your code in a code block using triple backticks:
```
your code here
```
What are you using for your Jaeger Setup? By default, the Jaeger tracer will look for a Jaeger Agent process deployed on localhost, which wont work if, say, you are running a Jaeger Agent and Application in separate containers. Localhost from the point of view of the application container is not the same as localhost from your local machine, so it really depends entirely on what your Jaeger setup is.
Worth noting that, if you are running both the jaeger infastructure and the application on the same docker host (i.e. on your local machine), they should ideally be on the same virtual network and use the IP addresses of the containers. Easiest way to do that is to use a Docker Compose to let Docker handle the networking and IP address resolution
Hi All,
Request your help in solving my problem. I am new to jaeger.
I have a created a sample python flask application which sends traces to jaeger when i run manually(shown below) [python pythoncompleteflowdocker] with the name pythoncompleteflowdocker.py:
from flask import Flask from flask import request import requests
from opentracing_instrumentation.client_hooks import install_all_patches
from jaeger_client import Config from flask_opentracing import FlaskTracer import opentracing
def initialize_tracer(): config = Config( config={ 'sampler': {'type': 'const', 'param': 1} }, service_name='hello-worldnotworking') print("hitesh") return config.initialize_tracer() # also sets opentracing.tracer
app = Flask(name) flask_tracer= FlaskTracer(initialize_tracer, trace_all_requests=True, app=app)
install_all_patches()
@app.route('/') def pull_requests():
github_url = "https://api.github.com/repos/opentracing/opentracing-python/pulls"
parent_span = flask_tracer.get_span() with opentracing.tracer.start_span('github-api', child_of=parent_span) as span: span.set_tag("http.url",github_url) r = requests.get(github_url) span.set_tag("http.status_code", r.status_code)
with opentracing.tracer.start_span('parse-json', child_of=parent_span) as span: json = r.json() span.set_tag("pull_requests", len(json)) pull_request_titles = map(lambda item: item['title'], json)
return 'OpenTracing Pull Requests: ' + ', '.join(pull_request_titles)
if name == 'main': app.run(debug=True,host='0.0.0.0', port=5000)
When i create a docker file (below) and access the application through docker then no traces are coming up including the service name.
[ec2-user@ip-172-31-17-90 ~]$ cat Dockerfile FROM python:2.7.16
MAINTAINER UNP, https://unp.education
COPY ./flask_demo /usr/local/python/
COPY ./ /usr/local/python/ EXPOSE 5000 WORKDIR /usr/local/python/
RUN chown -R ec2-user:ec2:user /usr/local/hitesh
RUN pip install -r requirements.txt
RUN sudo service docker start
CMD python pythoncompleteflowdocker.py
Can someone please help me as what needs to be done to show the traces via docker ?