internal/worker: only init observer if possible

s.observer is now only initialized if both ProjectID and ServiceID are
set.

This makes it possible run the worker server and view the index page,
without connecting to GCP.

Change-Id: I553034683c00eee7c4f962e59c726eda82c7ea04
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/465220
Reviewed-by: Julie Qiu <julieqiu@google.com>
Auto-Submit: Julie Qiu <julieqiu@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Julie Qiu <julieqiu@google.com>
2 files changed
tree: c119097cdb162c788498656353c8ea7b60894494
  1. cmd/
  2. devtools/
  3. internal/
  4. static/
  5. all_test.go
  6. checks.bash
  7. CONTRIBUTING.md
  8. go.mod
  9. go.sum
  10. LICENSE
  11. PATENTS
  12. README.md
  13. tools_test.go
README.md

pkgsite-metrics

This repository contains code that serves pkg.go.dev/metrics.

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/pkgsite-metrics:” in the subject line, so it is easy to find.