File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
lib/active_storage/service Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change
1
+ * Remove unnecessary calls to the GCP metadata server.
2
+
3
+ Calling Google::Auth.get_application_default triggers an explicit call to
4
+ the metadata server - given it was being called for significant number of
5
+ file operations, it can lead to considerable tail latencies and even metadata
6
+ server overloads. Instead, it's preferable (and significantly more efficient)
7
+ that applications use:
8
+
9
+ ``` ruby
10
+ Google ::Apis ::RequestOptions .default.authorization = Google ::Auth .get_application_default(...)
11
+ ```
12
+
13
+ In the cases applications do not set that, the GCP libraries automatically determine credentials.
14
+
15
+ This also enables using credentials other than those of the associated GCP
16
+ service account like when using impersonation.
17
+
18
+ * Alex Coomans *
19
+
1
20
* Direct upload progress accounts for server processing time.
2
21
3
22
* Jeremy Daer *
Original file line number Diff line number Diff line change @@ -213,8 +213,16 @@ def signer
213
213
lambda do |string_to_sign |
214
214
iam_client = Google ::Apis ::IamcredentialsV1 ::IAMCredentialsService . new
215
215
216
- scopes = [ "https://www.googleapis.com/auth/iam" ]
217
- iam_client . authorization = Google ::Auth . get_application_default ( scopes )
216
+ # We explicitly do not set iam_client.authorization so that it uses the
217
+ # credentials set by the application at Google::Apis::RequestOptions.default.authorization.
218
+ # If the application does not set it, the GCP libraries will automatically
219
+ # determine it on each call. This code previously explicitly set the
220
+ # authorization to Google::Auth.get_application_default which triggers
221
+ # an explicit call to the metadata server - given this lambda is called
222
+ # for a significant number of file operations, it can lead to considerable
223
+ # tail latencies and even metadata server overloads. Additionally, that
224
+ # prevented applications from being able to configure the credentials
225
+ # used to perform the signature operation.
218
226
219
227
request = Google ::Apis ::IamcredentialsV1 ::SignBlobRequest . new (
220
228
payload : string_to_sign
You can’t perform that action at this time.
0 commit comments