App engine cookie based traffic splitting - google-app-engine

Is there a way to use app engine traffic splitting to present a specific version to a selected set of pilot users ? As per the doc below , it seems it provides capability but does not provide how to find what cookie value corresponds to what version
https://cloud.google.com/appengine/docs/standard/java/splitting-traffic

UPDATE : Got the answer from google groups and forums .Consider traffic is spilt based on cookie with version A to receive 40% and version B to receive remaining 60% . So GOOGAPUID cookie values less than 400 will route the traffic to version A , cookie values of 400-999 will route the traffic to version B

Related

App Engine traffic splitting is not persisting

When splitting traffic by cookies, we're observing the following behavior:
GOOGAPPUID cookie does not receive a number between 0-999, but rather a string which resembles this form: xCgsIARD8AiDF1PjnBQ
Even though the client has the cookie he is not always sent to the same version, every few minutes the version the client is directed to is switched.
How do we remedy this?
So apparently it's a bug from 2015 (Google issue tracker) that has not been fixed yet.
We've implemented a partial solution though:
If you have versions A and B, split 30%/70% then if you set the GOOGAPPUID cookie manually to values between 0-299 you'll get to version A, or to values between 300-999 you'll get to version B, consistently, across requests.
Knowing that, on the relevant handlers of our app (you might need to do it for all handlers of your app), we check if the incoming request already has a GOOGAPPUID cookie AND that it's a number. If it is a number, we leave it as is.
If it's not present or not a number it means that we have not set it before. So we check on which version we are (because the App Engine traffic splitting works well, it's only the persistence cookie mechanism is broken), and if we're on version A, we set the cookie to a value between 0-299, if we're on version B we set the cookie to value of 300-999.
This patch will fill the gap of Google's issue with GOOGAPPUID cookies and will give your user a persistent experience across requests.

Can I use StackDriver Trace PHP application in GKE?

I want to check latencies of RPC every day about CakePHP Application each endpoints running in GKE cluster. I found it is possible using php google client or zipkin server by reading documents , but I don't know how easy to introduce to our app though both seem tough for me.
In addition, I'm concerned about GKE cluster configuration has StackDriver Trace option though our cluster it sets disabled.Can we trace span if it sets enable?
Could you give some advices?
I succeeded to send gcp's trace api in php client via REST. It can see trace set by php client parameters , but my endpoint for trace api has stopped though I don't know why.Maybe ,it is not still supported well because the document have many ambiguous expression so, I realized watching server response by BigQuery with fluentd and DataStudio and it seem best solution because auto span can be set by table name with yyyymmdd and we can watch arbitrary metrics with custom query or calculation field.

How to use generated clientid with Google cloud endpoints for authenticating 3rd party users without redeploying app

In my case we work with other companies which would consume our APIs along with our internal javascript client. I think we need to create a web client id for javascript client. But when exposing APIs externally, is it correct to generate new web client id per company? If so do we have to update clientid each time and redeploy application?
I'm following this documentation and in their example client ids are hardcoded, if I need to give access to new 3rd party users, then I need to generate new client id for them but I'd expect to not redeploy application.
Update: I've created a feature request as per #Alex's suggestion below.
Unfortunately the docs at https://cloud.google.com/appengine/docs/python/endpoints/auth very specifically say, and I quote,
Because the allowed_client_ids must be specified at build time, you
must rebuild and redeploy your API backend after adding or changing
any client IDs in the authorized list of allowed_client_ids or
audiences
so it appears that your perfectly-reasonable use case is very explicitly not covered at this time.
I recommend you visit said page and enter a feature request via the "Write Feedback" link (around the upper right corner of the page) as well as entering a feature request on the Endpoints component of the App Engine feature tracker, https://code.google.com/p/googleappengine/issues/list?can=2&q=component=Endpoints&colspec=ID%20Type%20Component%20Status%20Stars%20Summary%20Language%20Priority%20Owner%20Log -- we monitor both, but with different processes, so trying both is best.
Sorry to be a bearer of bad news. For now, it seems the only workaround is to distribute to the other companies one of a bunch of client ids generated in advance (you can only change the valid bunch when you re-deploy, sigh) and perhaps add some extra, app-layer authorization check of your own -- exactly the kind of work endpoints should be doing on your behalf:-(.
You can use an asterisk as the client ID, that will allow any client to call it without redeploying your API backend. Not sure if this is a documented feature or not, but it works (at least) with both Python and Java.
#Api(name = "myapi",
version = "v1",
scopes = {"https://www.googleapis.com/auth/userinfo.email"},
description = "My flashy API",
clientIds = {"*"})
public class MyAPI { ... }

"Over quota" when using GCS json-api from App Engine

I am using Go on App Engine. In most cases, I use the file api to access GCS, which works great, except that deletes don't work so to delete files I use the JSON-API (specifically, the google-go-api-client). To authenticate, I use app engine service accounts. We are sometimes seeing an error come back of "Over quota:" with nothing after the colon. Since we are a paid app, what quota could this be? Is there a burst limit (e.g. no more than X requests in a single minute)? Is there any places where any such applicable quotas are documented?
The caching mechanism is broken for goauth2 and serviceaccount tokens. You can see the issue I created here for more detail: https://code.google.com/p/goauth2/issues/detail?id=28
I came across a "over quota" issue myself when requesting more than 60 service accounts a minute. I opened a ticket with AppEngine support (I pay for the silver package) and got this undocumented information out of them.
You can apply the patch yourself in your $GOPATH/src/code.google.com/p/goauth2/appengine/serviceaccount/cache.go file. This fixed the issue you described for my team.
Even i had found same problem and found two reasons:-
1.Daily budget
2.Logs retention
Solution:
for problem 1 increase the daily budget
for problem 2 increase the retention from 1 to higher GB
![enter image description here][1]

Google Plus Button counter acts differently with URL's that includes https

As you can discover from http://www.google.com/webmasters/+1/button/
Google+ has different counters for;
http://plus.google.com/-pageid- or https://plus.google.com/-pageid-
In my case URL without https displays 18 +1's while url with https displays 2 +1's.
The problem is 18 +1's did not displayed on Google Plus page so i can't interact with these users.
Meanwhile, other Google tools such as badges counts url with https.
Is there any way to merge these users?
Google+ still has different counters in SSL and Non-SSL mode.
SSL and Non-SSL version of the Google Plus seems working independently so i could not found any way to count +1 of the same URL in the SSL and non-SSL area.

Resources