File tree Expand file tree Collapse file tree 4 files changed +87
-0
lines changed
Expand file tree Collapse file tree 4 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 1+ runtime : python27
2+ api_version : 1
3+ threadsafe : yes
4+
5+ builtins :
6+ - appstats : on
7+
8+ handlers :
9+ - url : .*
10+ script : main.app
Original file line number Diff line number Diff line change 1+ # Copyright 2016 Google Inc.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+
16+ # The app engine runtime will call this function during instance startup.
17+ def webapp_add_wsgi_middleware (app ):
18+ from google .appengine .ext .appstats import recording
19+ app = recording .appstats_wsgi_middleware (app )
20+ return app
Original file line number Diff line number Diff line change 1+ # Copyright 2016 Google Inc.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ """
16+ Sample Google App Engine application that demonstrates using appstats.
17+
18+ For more information about App Engine, see README.md under /appengine.
19+ """
20+
21+ # [START all]
22+ from google .appengine .api import memcache
23+ import webapp2
24+
25+
26+ class MainPage (webapp2 .RequestHandler ):
27+ def get (self ):
28+ # Perform some RPCs so that appstats can capture them.
29+ memcache .set ('example_key' , 50 )
30+ value = memcache .get ('example_key' )
31+ self .response .write ('Value is: {}' .format (value ))
32+
33+ app = webapp2 .WSGIApplication ([
34+ ('/' , MainPage )
35+ ], debug = True )
36+ # [END all]
Original file line number Diff line number Diff line change 1+ # Copyright 2016 Google Inc. All rights reserved.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ import main
16+ import webtest
17+
18+
19+ def test_app (testbed ):
20+ app = webtest .TestApp (main .app )
21+ app .get ('/' )
You can’t perform that action at this time.
0 commit comments