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

FYI: google-cloud-logging update includes breaking changes #417

Open
dazuma opened this issue Jul 31, 2020 · 0 comments
Open

FYI: google-cloud-logging update includes breaking changes #417

dazuma opened this issue Jul 31, 2020 · 0 comments

Comments

@dazuma
Copy link
Member

dazuma commented Jul 31, 2020

This is an FYI for the maintenance team. This package uses the google-cloud-logging gem as the gRPC client library for the Cloud Logging service. Currently you have google-cloud-logging pinned to version 1.6.6. If/when you decide to upgrade this dependency to version 2.0.0 or later, please be aware that some breaking interface changes have been made, and you will need to modify your usage a bit. (There is, to my knowledge, no need to upgrade immediately. Also, the REST client is not affected.)

Some details for context. This plugin uses the "low-level" generated client interfaces for logging (e.g. Google::Cloud::Logging::V2::LoggingServiceV2Client). The client libraries team has changed code generators, and the new generator now produces different classes for this layer.

  • The class name and construction interface is different.

    # old:
    @client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new(
      credentials: GRPC::Core::Channel.new(
        "#{host}#{port}", channel_args, creds))
    
    # new:
    @client = Google::Cloud::Logging::V2::LoggingService::Client.new do |config|
      config.credentials = GRPC::Core::Channel.new(
        "#{host}#{port}", channel_args, creds)
    end
  • Positional arguments to RPC methods have changed to keyword arguments. (Arguments that were already keyword arguments remain keyword arguments.)

    # old:
    client.write_log_entries(
      entries,
      log_name: log_name,
      # ...
    )
    
    # new:
    client.write_log_entries(
      entries: entries
      log_name: log_name,
      # ...
    )
  • Proto classes have moved from Google::Logging:: to Google::Cloud::Logging::. There should no longer be anything in the Google::Logging namespace. You should be able to global search-replace this.

    # old:
    entry = Google::Logging::V2::LogEntry.new(
      # ...
    )
    
    # new:
    entry = Google::Cloud::Logging::V2::LogEntry.new(
      # ...
    )
  • The updated clients depend on later versions of certain dependencies (e.g. protobuf, grpc, common-protos libraries, etc.) so if you update the client, you'll need to update your pins of other dependencies as well.

  • [OPTIONAL] Consider depending on google-cloud-logging-v2 instead of google-cloud-logging. You are using the low-level client classes, and those are now defined in the former gem. The latter gem now implements just the high level interface and framework integration.

    This step is optional because the latter brings the former in as a transitive dependency. However, since you're not using any of the high level interfaces, you can drop that library and eliminate some unused code.

If you have any questions, feel free to contact me, @dazuma (either here or internally). Again, I'm not reporting any need to upgrade immediately, but just informing you of changes that will need to be made if/when you do upgrade.

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

No branches or pull requests

1 participant