[impl/cloud] request management and logging

Add a middleware-friendly function to manage scoped requests. This will
install request information into the Context on invocation and terminate
request handling on completion.

Add a finalizing log. After discussion with Stackdriver Logging UI,
it seems that there is nothing magical about the request log entry other
than the Trace ID association. Consqeuently, we now (when configured
properly) emit a custom top-level log (defualt "gae.request") with severity
and associated metadata to track the HTTP request and its lifecycle. This
can be used as an alternative to the "nginx" logs that are currently being
used for grouping.

In support of this, we introduce a scoped request wrapper, which sets up
a common request handling environment, executes a request handler, and
emits request-related monitoring information on completion. Usage of
this API is optional, but enables top-level aggregate severity logs and
other runtime metrics to be emitted as logs. Future iterations may also
expand on this to create/destroy request resources.

Configure the logger to tee to STDERR in addition to Stackdriver, in case the
Stackdriver client isn't working.

Add Insert ID generation (based off Trace ID) to log messages to prevent
duplicates on resend.

Change-Id: I7fe67394c18662ce257865599c812e022696f272
Reviewed-on: https://chromium-review.googlesource.com/805362
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
4 files changed
tree: 29ed7bfedf2ced29849ac107d4f9c33a22ca023d
  1. .travis.yml
  2. AUTHORS
  3. CONTRIBUTING.md
  4. CONTRIBUTORS
  5. LICENSE
  6. PRESUBMIT.py
  7. README.md
  8. codereview.settings
  9. doc.go
  10. docs/
  11. filter/
  12. impl/
  13. infra/
  14. pre-commit-go.yml
  15. service/
  16. symbols.go
  17. tools/
README.md

gae: A Google AppEngine SDK wrapper

designed for testing and extensibility

THIS PACKAGE HAS NO API COMPATIBILITY GUARANTEES. USE UNPINNED AT YOUR OWN PERIL.

(but generally it should be pretty stableish).

GoDoc Build Status Coverage Status

Installing

go get -u go.chromium.org/gae/...

Why/What/How

See the godocs.

Versioning

  • Branch master contains the latest code.

Contributing

  • Sign the Google CLA.
  • Make sure your user.email and user.name are configured in git config.
  • Install the pcg git hook: go get -u github.com/maruel/pre-commit-go/cmd/... && pcg

Run the following to setup the code review tool and create your first review:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $HOME/src/depot_tools
export PATH="$PATH:$HOME/src/depot_tools"
cd $GOROOT/github.com/luci/gae
git new-branch work
# or `git checkout -b work origin/master` if you like typing more.

# hack hack

git commit -a -m "This is awesome\nR=joe@example.com"
# This will ask for your Google Account credentials.
git cl upload -s
# Wait for LGTM over email.
# Check Commit Queue checkbox in Rietveld codereview site.
# See it tested and landed automatically.

Use git cl help and git cl help <cmd> for more details.