Skip to content

Commit

Permalink
Fixing logging interceptor for customer service requests. (#29)
Browse files Browse the repository at this point in the history
* Fixing logging interceptor for customer service requests.

Change-Id: I5e7af6abbb2dfeb0bd9c7a7bbe3214cc326c8187

* Make looking up customer id safer so we aren't going to throw an error if the request format isn't what we expect.

Change-Id: I9b9a9c492581979f1ade0777aebd96046acdad9e
  • Loading branch information
mcloonan authored Mar 5, 2019
1 parent 5facb3f commit 8e0de3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.8.1:
- Fix to logging interceptor for customer service requests.

0.8.0:
- Adding support for Google Ads API v0_7.

Expand Down
8 changes: 7 additions & 1 deletion lib/google/ads/google_ads/logging_interceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ def initialize(logger)
end

def request_response(request:, call:, method:, metadata: {})
customer_id = "N/A"
customer_id = request.customer_id if request.respond_to?(:customer_id)
# CustomerService get requests have a different format.
if request.respond_to?(:resource_name)
customer_id = request.resource_name.split('/').last
end
summary_message =
sprintf("CID: %s, Host: %s, Method: %s",
request.customer_id,
customer_id,
call.instance_variable_get('@wrapped').peer,
method
)
Expand Down
2 changes: 1 addition & 1 deletion lib/google/ads/google_ads/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
module Google
module Ads
module GoogleAds
CLIENT_LIB_VERSION = '0.8.0'.freeze
CLIENT_LIB_VERSION = '0.8.1'.freeze
end
end
end

0 comments on commit 8e0de3e

Please sign in to comment.