Dynatrace / openkit-java

OpenKit Java Reference Implementation
Apache License 2.0
35 stars 34 forks source link

Openkit for Server Side Tracing #204

Open luckyabhishek opened 4 years ago

luckyabhishek commented 4 years ago

Hey,

Can this library be used to do the server side tracing. I know the tracer which exists is for outgoing web request equivalent, however if we extend the library we might be able to write an incoming web request tracer. The reason I ask is because oneagent SDK is not behaving well with vertx due to the way thread models work in vertx. The oneagent jumbles up the purepath.

Will we be able to extend this kit to construct the same by extending this SDK.

Abhishek

stefaneberl commented 4 years ago

Hi Abhishek,

thanks for the question. Unfortunately, OpenKit was not designed for this use case, to trace incoming web requests. It's also not trivial to get this in, as we would need to extend the protocol that is used.

The appropriate way would be the OneAgent SDK or the OneAgent itself. I will forward this ticket to the appropriate stakeholders. They will be able to give more details about Vert.X support.

Best regards Stefan

z1c0 commented 4 years ago

Hi,

I'm not familiar with Vert.X to be honest, but from the way it's described on the website (event driven, non-blocking) it is most likely not a good fit for the OneAgent SDK tracers and their thread-affinity.

from https://github.com/Dynatrace/OneAgent-SDK-for-java:

A Tracer instance can only be used from the thread on which it was created. See in process linking for tracing across thread boundaries.

You could ask on Dynatrace Answers about Vert.X and see if others have that requirement as well, though.

Best regards Wolfgang

luckyabhishek commented 4 years ago

Hi Wolfganf, Stefen

I understand tha One Agent SDK has some kind of thread-affinity, and hence wanted to fall back upon OpenKit. The challenge I have in my hand is that we have a microservices based application where all services are good and dynatrace abiding citizens. Because of the usage of vertx we are losing the end to end traces and people are contemplating to move to other options like Jaeger. We need to find a way out to ensure that we don't lose all our knowledhe and investments in dynatrace and start learning the new tool. I have 2 questions

1) What would it take if we were to extend openkit for incoming tracer. Is it a question of building new APIs in the server or a question of adapting the SDK. If it's about SDK then can you point to some helpful documentation on how one can go about it. 2) I understand that tracer instance can't be used cross thread. In vertx, we are using the instance in a single thread (A single thread runs multiple requests). My belief is that it gets messed up because One Agent SDK also assumes that the tracer which is opened last will close first. And hence we get warnings which speak about nodes and depth in the system log. Does One Agent SDK do a stack walk to maintain the states ?

I know One Agent has already mentioned that this is not even in the roadmap. Is there a way this can come in the roadmap ? vertx seems to be working well with Jaeger and hence there's a definite affinity of the team to switch "

SonjaChevre commented 4 years ago

Hi Abhishek,

can you share a very simple code snippet of how your web request looks like? We just took a very quick look at Vert.X sample codes:

Looking at those two examples, you should be able to use OneAgent SDK for tracing the incoming and outgoing web requests if the SDK tracer is started and ended into the handler methods.

You should also make sure that no other out-of-the-box sensor is already starting the outgoing web request. In that case, you would need to deactivate this out-of-the-box sensor.

Sonja

luckyabhishek commented 4 years ago

Hi Sonja.

I am off on vacation this week and next week in a workshop. However I am on this. Just give me some time to get the sample up for this thread.

Regards, Abhishek

On Fri, Oct 25, 2019 at 2:53 PM Sonja Chèvre notifications@github.com wrote:

Hi Abhishek,

can you share a very simple code snippet of how your web request looks like? We just took a very quick look at Vert.X sample codes:

-

https://github.com/vert-x3/vertx-examples/blob/master/core-examples/src/main/java/io/vertx/example/core/http/simple/Client.java

https://github.com/vert-x3/vertx-examples/blob/master/core-examples/src/main/java/io/vertx/example/core/http/simple/Server.java

Looking at those two examples, you should be able to use OneAgent SDK for tracing the incoming and outgoing web requests if the SDK tracer is started and ended into the handler methods.

You should also make sure that no other out-of-the-box sensor is already starting the outgoing web request. In that case, you would need to deactivate this out-of-the-box sensor.

Sonja

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Dynatrace/openkit-java/issues/204?email_source=notifications&email_token=ACKK3Z22ADR3RUM7LEH22IDQQK3KLA5CNFSM4JE66SUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECHYP6I#issuecomment-546277369, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACKK3Z7VMN3DGXK3VBVW6LLQQK3KLANCNFSM4JE66SUA .

luckyabhishek commented 4 years ago

Hi Sonja, I created a quick sample which reproduces the issue to some extent. The sample is now uploaded on https://github.com/luckyabhishek/vertx-sample And git checkout pathdrops to checkout the first repro.
If you build and deploy this sample on cloudfoundry and bind it to the dynatrace service. You would see the following message in the logs. info [native] PATH-DROPPING: 1 of 4 SubPath(s) have been dropped This basically means that path information is getting dropped. We then went on to create a http request tracer to do the custom logging using the oneagent sdk. I will do that next to show the jumbled purepaths.