Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVL-961 Add trace context propagation in CommandClient.trackCommandsUnbounded #9821

Closed
wants to merge 1 commit into from

Conversation

hubert-da
Copy link
Collaborator

CHANGELOG_BEGIN

  • [Ledger API Client] Introduce implicit telemetry context for tracing
    CHANGELOG_END

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

CHANGELOG_BEGIN
 - [Ledger API Client] Introduce implicit telemetry context for tracing
CHANGELOG_END
@@ -113,7 +120,8 @@ final class CommandClient(
* @param parties Commands that have a submitting party which is not part of this collection will fail the stream.
*/
def trackCommandsUnbounded[Context](parties: Seq[String], token: Option[String] = None)(implicit
ec: ExecutionContext
ec: ExecutionContext,
telemetryContext: TelemetryContext,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the way you have here will not work. we don't want to provide the telemetry context at the moment of calling trackCommandsUnbounded. We want to have a different one for each Ctx[Context, SubmitRequest] passed into the Flow, that's why it makes more sense to have it as part of the Ctx object

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could change Ctx to be like this

final case class Ctx[+Context, +Value](context: Context, value: Value, telemetryContext: TelemetryContext = NoOpTelemetryContext)

This won't break existing code and will allow passing the context around. The only missing thing would be to actually propagate that context further at the appropriate places

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danilofaria I dropped another draft PR with the changes you suggested. There are a few drawbacks of this approach, though:

  • it doesn't break the existing code only partially, at least the pattern matches have to be modified
  • I cannot use the TelemetryContext, as the Akka Streams' Outlet requires the Ctx to be serializable. The TelemetryContext is not, as it contains the Tracer, for example
  • I prefer to avoid default arguments, which is minor

Please let me know if we cannot use the changes from here for sure, as each gRPC call will be traced anyway (the client interceptor will create sub-spans).

There is also one more thing to tackle. I did not touch the CommandCompletionService. I assume you'd like to trace it, too.

cc @miklos-da @lucb-da

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i confirm the changes from this PR are not usable since we need a new context per submission and we want to provide one from the parent context. i will look at your other PR. i dont think think you need to trace the CommandCompletionService since that doesnt touch the context we're passing to the flow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, rejecting this one then.

@hubert-da hubert-da closed this May 28, 2021
@remyhaemmerle-da remyhaemmerle-da deleted the hubert-da/command-client-tracing branch February 8, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants