1717import static com .google .common .base .Preconditions .checkArgument ;
1818import static com .google .common .base .Preconditions .checkState ;
1919import static com .google .common .collect .ImmutableList .toImmutableList ;
20+ import static google .registry .config .RegistryConfig .CANARY_HEADER ;
2021import static java .util .concurrent .TimeUnit .SECONDS ;
2122
2223import com .google .api .gax .rpc .ApiException ;
@@ -190,6 +191,9 @@ protected Task createTask(
190191 requestBuilder .setOidcToken (oidcTokenBuilder .build ());
191192 String totalPath = String .format ("%s%s" , service .getServiceUrl (), path );
192193 requestBuilder .setUrl (totalPath );
194+ if (RegistryEnvironment .isCanary ()) {
195+ requestBuilder .putHeaders (CANARY_HEADER , "true" );
196+ }
193197 return Task .newBuilder ().setHttpRequest (requestBuilder .build ()).build ();
194198 }
195199
@@ -200,7 +204,7 @@ protected Task createTask(
200204 * default service account as the principal. That account must have permission to submit tasks to
201205 * Cloud Tasks.
202206 *
203- * <p>Prefer this overload over the one where the path and service are explicit defined, as this
207+ * <p>Prefer this overload over the one where the path and service are explicitly defined, as this
204208 * class will automatically determine the service to use based on the action and the runtime.
205209 *
206210 * @param actionClazz the action class to run, must be annotated with {@link Action}.
@@ -269,7 +273,7 @@ public Task createTaskWithJitter(
269273 /**
270274 * Create a {@link Task} to be enqueued with a random delay up to {@code jitterSeconds}.
271275 *
272- * <p>Prefer this overload over the one where the path and service are explicit defined, as this
276+ * <p>Prefer this overload over the one where the path and service are explicitly defined, as this
273277 * class will automatically determine the service to use based on the action and the runtime.
274278 *
275279 * @param actionClazz the action class to run, must be annotated with {@link Action}.
@@ -306,7 +310,7 @@ public Task createTaskWithJitter(
306310 * @param service the GAE/GKE service to route the request to.
307311 * @param params a multimap of URL query parameters. Duplicate keys are saved as is, and it is up
308312 * to the server to process the duplicate keys.
309- * @param delay the amount of time that a task needs to delayed for.
313+ * @param delay the amount of time that a task needs to be delayed for.
310314 * @return the enqueued task.
311315 * @see <a
312316 * href=ttps://cloud.google.com/appengine/docs/standard/java/taskqueue/push/creating-tasks#target>Specifyinig
@@ -330,14 +334,14 @@ private Task createTaskWithDelay(
330334 /**
331335 * Create a {@link Task} to be enqueued with delay of {@code duration}.
332336 *
333- * <p>Prefer this overload over the one where the path and service are explicit defined, as this
337+ * <p>Prefer this overload over the one where the path and service are explicitly defined, as this
334338 * class will automatically determine the service to use based on the action and the runtime.
335339 *
336340 * @param actionClazz the action class to run, must be annotated with {@link Action}.
337341 * @param method the HTTP method to be used for the request.
338342 * @param params a multimap of URL query parameters. Duplicate keys are saved as is, and it is up
339343 * to the server to process the duplicate keys.
340- * @param delay the amount of time that a task needs to delayed for.
344+ * @param delay the amount of time that a task needs to be delayed for.
341345 * @return the enqueued task.
342346 * @see <a
343347 * href=ttps://cloud.google.com/appengine/docs/standard/java/taskqueue/push/creating-tasks#target>Specifyinig
0 commit comments