[server] Sample requests even if the parent trace is unsampled.

This affects only non-serverless code path (basically just GKE).

It seems Google Cloud Load Balancer adds X-Cloud-Trace-Context header
with "not sampled" flag to every request that doesn't have a trace
context yet. I'm not sure if this is a new behavior or it was always
like that.

Before this CL, we unconditionally followed the existing tracing
context sampling status (using our own sampler only if there were
no tracing context at all). As a result, most requests passing
GCLB were unsampled. Only requests that had a tracing header (with
sampling on) set *before* hitting GCLB were sampled, since GCLB
passed this header through. This header was set for requests done
by other LUCI services running on GAE.

Requests done by Cloud itself (Cloud Tasks, Cloud PubSub) never
have tracing context populated, so they were never sampled.

Now unsampled parent context is treated the same way as no context
at all: we'll use our local sampler to decide when to trace such
requests (resulting in 0.1qps of requests sampled with default
settings).

R=nqmtuan@google.com

Change-Id: Idb9314585e15e1eaa8f6d14c5f99e52a7ce416ff
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/5760710
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Tuan Nguyen <nqmtuan@google.com>
1 file changed
tree: a6eb40106474acd417463f1f91696aea69e7aa3b
  1. analysis/
  2. appengine/
  3. auth/
  4. auth_service/
  5. bisection/
  6. build/
  7. buildbucket/
  8. casviewer/
  9. cipd/
  10. cipkg/
  11. client/
  12. common/
  13. config/
  14. config_service/
  15. cv/
  16. deploy/
  17. examples/
  18. gae/
  19. gce/
  20. grpc/
  21. hardcoded/
  22. led/
  23. logdog/
  24. luci_notify/
  25. lucicfg/
  26. lucictx/
  27. luciexe/
  28. mailer/
  29. milo/
  30. mmutex/
  31. provenance/
  32. resultdb/
  33. scheduler/
  34. scripts/
  35. server/
  36. source_index/
  37. standalone/
  38. starlark/
  39. swarming/
  40. teams/
  41. third_party/
  42. tokenserver/
  43. tools/
  44. tree_status/
  45. vpython/
  46. web/
  47. .gitallowed
  48. .gitattributes
  49. .gitignore
  50. .go-lintable
  51. AUTHORS
  52. codereview.settings
  53. CONTRIBUTING.md
  54. CONTRIBUTORS
  55. go.mod
  56. go.sum
  57. LICENSE
  58. OWNERS
  59. PRESUBMIT.py
  60. README.md
  61. tools.go
  62. WATCHLISTS
README.md

luci-go: LUCI services and tools in Go

GoReference

Installing

LUCI Go code is meant to be worked on from an Chromium infra.git checkout, which enforces packages versions and Go toolchain version. First get fetch via depot_tools.git then run:

fetch infra
cd infra/go
eval `./env.py`
cd src/go.chromium.org/luci

It is now possible to directly install tools with go install:

go install go.chromium.org/luci/auth/client/cmd/...@latest
go install go.chromium.org/luci/buildbucket/cmd/...@latest
go install go.chromium.org/luci/cipd/client/cmd/...@latest
go install go.chromium.org/luci/client/cmd/...@latest
go install go.chromium.org/luci/cv/cmd/...@latest
go install go.chromium.org/luci/gce/cmd/...@latest
go install go.chromium.org/luci/grpc/cmd/...@latest
go install go.chromium.org/luci/logdog/client/cmd/...@latest
go install go.chromium.org/luci/luci_notify/cmd/...@latest
go install go.chromium.org/luci/lucicfg/cmd/...@latest
go install go.chromium.org/luci/luciexe/legacy/cmd/...@latest
go install go.chromium.org/luci/mailer/cmd/...@latest
go install go.chromium.org/luci/mmutex/cmd/...@latest
go install go.chromium.org/luci/resultdb/cmd/...@latest
go install go.chromium.org/luci/server/cmd/...@latest
go install go.chromium.org/luci/swarming/cmd/...@latest
go install go.chromium.org/luci/tokenserver/cmd/...@latest
go install go.chromium.org/luci/tools/cmd/...@latest

Contributing

Contributing uses the same flow as Chromium contributions.