telemetry: in Start, run upload.Run at most once a day

This change will create a token file to acquire a token to limit
uploading to at most once a day: before upload is run, we'll check to
see if an upload token file already exists. If it doesn't, or it's
been a day since the existing file has been created, it's been a day
since the last upload.Run was attempted so we can run it again. If it
doesn't, we'll skip running upload.Run. We don't delete the token
files when we're done with the upload, but instead only delete them
when we want to acquire a new lock so that the existence of the file
and its modification time is a signal of the last time uploading was
run.

The token acquiring code is based on acquireLockFile in
x/tools/gopls/internal/server/prompt.go.

For golang/go#65500

Change-Id: Ie31c1f351e2d31a016fd2ad79b29784e6631c564
Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/567075
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
1 file changed
tree: 146efe030d8ba55798a0a20f078b3a29e6a91f8e
  1. cmd/
  2. config/
  3. counter/
  4. crashmonitor/
  5. godev/
  6. internal/
  7. upload/
  8. .dockerignore
  9. .eslintrc.json
  10. .gitattributes
  11. .gitignore
  12. .prettierrc.json
  13. .stylelintrc.json
  14. CONTRIBUTING.md
  15. doc.go
  16. go.mod
  17. go.sum
  18. LICENSE
  19. mode.go
  20. npm
  21. npx
  22. package-lock.json
  23. package.json
  24. PATENTS
  25. README.md
  26. start.go
  27. start_posix.go
  28. start_windows.go
  29. tsconfig.json
  30. types_alias.go
README.md

Go Telemetry

This repository holds the Go Telemetry server code and libraries.

Linting & Formatting

This repository uses eslint to format TS files, stylelint to format CSS files, and prettier to format TS, CSS, Markdown, and YAML files.

See the style guides:

It is encouraged that all TS and CSS code be run through formatters before submitting a change. However, it is not a strict requirement enforced by CI.

Installing npm Dependencies:

  1. Install docker
  2. Run ./npm install

Run ESLint, Stylelint, & Prettier

./npm run all

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the time repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/telemetry:” in the subject line, so it is easy to find.