Steeltoe icon indicating copy to clipboard operation
Steeltoe copied to clipboard

Enhancement/#1312 add in distributed tracing

Open thompson-tomo opened this issue 1 year ago • 6 comments

Description

To improve traceability activities are now being created so that external requests can be traced

Closes #1312

Quality checklist

  • [x] Your code complies with our Coding Style.
  • [x] You've updated documentation for your change, where applicable. If your change affects other repositories, such as Documentation, Samples and/or MainSite, add linked PRs here.
  • [x] There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

thompson-tomo avatar Jun 08 '24 04:06 thompson-tomo

I don't see the point of adding this, am I missing something? ASP.NET already provides built-in tracing for HttpClient usage.

bart-vmware avatar Jun 10 '24 12:06 bart-vmware

Without this change the log messages being generated by steeltoe do not have the tracing properties (trace, transaction & span) hence I was ending up with alot of messages missing the tracing properties.

Note most of the changes are whitespace due to introduction of the using statements.

thompson-tomo avatar Jun 11 '24 12:06 thompson-tomo

How are tracing properties useful on these items?

These interactions are typically called in the background rather than as a part of any distributed interaction.

TimHess avatar Jun 11 '24 21:06 TimHess

So what i was noticing is that for example the background requests to eureka server, i was not able to correlate the logs being generated prior to the http requests with the server processing of the request and at the same time was not able to connect the processing of the response to the original request.

thompson-tomo avatar Jun 11 '24 22:06 thompson-tomo

I don't understand why a periodic background request to eureka should be correlated to an incoming request. There's no relationship between those execution flows. For example:

18:43:01 Incoming HTTP request at /api/shoppingbasket, correlation ID matching click in UI 18:43:05 Incoming HTTP request at /api/shoppingbasket, correlation ID matching click in UI 18:43:08 Incoming HTTP request at /api/shoppingbasket, correlation ID matching click in UI 18:43:09 Outgoing eureka request, no correlation 18:43:12 Incoming HTTP request at /api/shoppingbasket, correlation ID matching click in UI

bart-vmware avatar Jun 13 '24 16:06 bart-vmware

The reason for me is so that the logs generated prior to the transmission ie

18:43:09 Outgoing eureka request

Can be correlated through the logs as the request traverses the environment ie via a reverse proxy/load balancer & then ideally your eureka/consul server etc. At the same time there was some endpoints which weren't generating activities.

thompson-tomo avatar Jun 14 '24 02:06 thompson-tomo

I just tested this on Steeltoe v4 with OpenTelemetry configured to instrument HttpClient, and all outbound requests are recorded. It does not appear to make a difference when viewing the traces in Zipkin whether or not Steeltoe wraps these interactions in another Activity. If we missed something, please let us know, but I don't currently see a benefit in taking these changes

TimHess avatar Jan 06 '25 17:01 TimHess