-
Notifications
You must be signed in to change notification settings - Fork 205
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
Conversation
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 theCtx
to be serializable. TheTelemetryContext
is not, as it contains theTracer
, 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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
CHANGELOG_BEGIN
CHANGELOG_END
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.