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

Tracking bug for client OptionsSpan #8164

Closed
8 tasks done
devbww opened this issue Jan 29, 2022 · 1 comment
Closed
8 tasks done

Tracking bug for client OptionsSpan #8164

devbww opened this issue Jan 29, 2022 · 1 comment
Labels
type: cleanup An internal cleanup or hygiene concern.

Comments

@devbww
Copy link
Contributor

devbww commented Jan 29, 2022

Instructions

Client operation functions should create local internal::OptionsSpan objects, with at least the default options for the service, so that our internal libraries can use internal::CurrentOptions() to obtain information about the call that is otherwise difficult to plumb through the various layers.

In general, the ServiceConnectionImpl and ServiceClient constructors, and the Service::Operation() function should look like:

ServiceConnectionImpl::ServiceConnectionImpl(..., Options options)
    : ...,
      options_(internal::MergeOptions(std::move(options),
                                      service_internal::ServiceDefaultOptions(ServiceConnection::options()))) {}

ServiceClient::ServiceClient(std::shared_ptr<ServiceConnection> connection, Options options)
    : connection_(std::move(connection)),
      options_(internal::MergeOptions(std::move(options), 
                                      service_internal::ServiceDefaultOptions(connection_->options()))) {}

ReturnType
ServiceClient::Operation(..., Options options) {
  internal::OptionsSpan span(internal::MergeOptions(std::move(options), options_));
    :
  return connection_->Operation(...);
}

This is already true for the generated libraries, but we need to ensure that the hand-written libraries follow the same pattern.

Some libraries may not yet have connection-, client-, or operation-specific Options, so you'll have to work with what you have, but the minimal operation function should be:

ReturnType
ServiceClient::Operation(...) {
  internal::OptionsSpan span(service_internal::ServiceDefaultOptions(Options{}));
    :
  return connection_->Operation(...);
}

Library List

@dbolduc
Copy link
Member

dbolduc commented Jun 19, 2022

We can close this, because the remaining tasks all have dedicated issues.

@dbolduc dbolduc closed this as completed Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

2 participants