amzn / smoke-framework

A light-weight server-side service framework written in the Swift programming language.
Apache License 2.0
1.44k stars 41 forks source link

Distributed tracing improvements. #125

Closed tachyonics closed 1 year ago

tachyonics commented 1 year ago

Issue #, if available:

Description of changes: Make a number of improvements to how distributed tracing is used-

  1. Create an internal tracing span for the operation selected. This makes it clearer what operation has been used. In a future fully-structured-concurrency architecture, the two spans can be started at the appropriate times during request handling but for now they are started and completed together.
  2. Ensure that logs emitted by the framework (request start, request end, report request metrics) will contain metadata for the span (span-id, trace-id), allowing for these logs to be associated with the span/trace. This was tested under the following scenarios- failure due to missing input, failure due to input decoding failure, failure due to operation returning a validation failure, failure due to operation returning a modelled service error and a successful operation response.
  3. Addressed an issue where the ResponseExecutor selection of GenericJSONPayloadHTTP1OperationDelegate was not honoured in some situations (when the operation returned an error).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.