yurishkuro / opentracing-tutorial

A collection of tutorials for the OpenTracing API
Apache License 2.0
1.57k stars 404 forks source link

Don't know how to upload spans when Yaeger is on remote host #49

Closed veterr closed 5 years ago

veterr commented 5 years ago

Probably this is not the problem of tutorial, but rather the situation I am facing. I don't know how to connect to Jaeger that is launched via openshift on remote host. I followed steps from https://github.com/jaegertracing/jaeger-openshift to start jaeger in openshift. I successfully installed it, and was able to see Jaeger ui on host - http://jaeger-query-adc-jaeger.apps.test-ose.ca.sbrf.ru . My testing app is executed outside openshift. I try lesson 1 from tutorial, with adding steps to set jaeger host and port. No matter what I try, I don't see my spans on the UI. I tried following lines of code to insert in main method before the tutorial code: System.setProperty("JAEGER_ENDPOINT", "http://jaeger-query-adc-jaeger.apps.test-ose.ca.sbrf.ru"); Also tried following: System.setProperty("JAEGER_AGENT_HOST", "jaeger-query-adc-jaeger.apps.test-ose.ca.sbrf.ru"); System.setProperty("JAEGER_AGENT_PORT", "14267");

Then I created routing for jaeger-collector with command - oc create route edge --service=jaeger-collector --port 14267 --insecure-policy=Allow

And oc get route jaeger-collector outputs - NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD jaeger-collector jaeger-collector-adc-jaeger.apps.test-ose.ca.sbrf.ru jaeger-collector 14267 edge/Allow None

So I also tried - System.setProperty("JAEGER_ENDPOINT", "https://jaeger-collector-adc-jaeger.apps.test-ose.ca.sbrf.ru:14267/api/traces"); But no result.

How should I configure system variables to be able to connect to Jaeger, that is executed remotely in Openshift?

jpkrohling commented 5 years ago

(I'm assuming you are using the Jaeger Java Client)

Are you able to run the following command?

curl https://jaeger-collector-adc-jaeger.apps.test-ose.ca.sbrf.ru:14268/api/traces

Note that the collector's port for the traces API is 14268.

You specified https as the protocol. Your JVM should then contain the server SSL certificate in its trust store. This is OK for a production setup, but for troubleshooting, it's better to disable SSL.

About the agent: it is supposed to run close to your application. In your case, it would be outside of OpenShift.

veterr commented 5 years ago

![Uploading route_edit.png…]()

No, I can't. I disabled the security of the route, I attach screenshot with the route settings. When I run "curl http://jaeger-collector-adc-jaeger.apps.test-ose.ca.sbrf.ru:14268/api/traces" I get Failed to connect, timeout. What this can be related to? Do I probably need to start the agent to execute this command successfully? Also, I have questions about the agent. Can it be executed without docker? Do I steel need the jaeger agent in case if I don't want to start additional applications on localhost?

jpkrohling commented 5 years ago

What this can be related to?

This is something related to your networking and is beyond what I can help you with, sorry.

Do I probably need to start the agent to execute this command successfully?

No, this is the where the collector should be. If you can't curl to this endpoint, your application can't connect to it as well when setting the env var JAEGER_ENDPOINT.

Can it be executed without docker?

Yes.

Do I steel need the jaeger agent in case if I don't want to start additional applications on localhost?

The agent should be close to whatever application you want to trace. If you don't have an application to trace on a given host, you don't need an agent there.

veterr commented 5 years ago

How can I start the agent without docker? I couldn't find information about it here https://www.jaegertracing.io/docs/1.9/deployment/

jpkrohling commented 5 years ago

https://www.jaegertracing.io/docs/1.9/getting-started/

You can follow the same logic as the all-in-one standalone mentioned there:

Or run the jaeger-all-in-one(.exe) executable from the binary distribution archives: $ jaeger-all-in-one --collector.zipkin.http-port=9411

veterr commented 5 years ago

Thank you!

veterr commented 5 years ago

I finally found what was my mistake. I should NOT specify port 14268 in JAEGER_ENDPOINT variable, as the openshift routing mapped internal port 14268 to external 80. So now my code is -

System.setProperty("JAEGER_ENDPOINT", "http://jaeger-collector-adc-jaeger.apps.test-ose.ca.sbrf.ru/api/traces"); try (JaegerTracer tracer = Tracing.init("hello-worlddd")) { new Hello(tracer).sayHello(helloTo); } And it works! Also I didn't have to launch jaeger-agent on localhost, following instructions from https://github.com/jaegertracing/jaeger-openshift was enough for me. The one additional thing that I did was that I removed security from jaeger-collector routing, using openshift UI.