Граф коммитов

10 Коммитов

Автор SHA1 Сообщение Дата
Amarjeet Anand 3ad2709a84 internal/log: add log level support
This change introduces minimum log level support.
GO_DISCOVERY_LOG_LEVEL config can be used to set the log level.

When set, no logs below GO_DISCOVERY_LOG_LEVEL will be printed.
Possible log levels are debug, info, error, fatal.

Log severity sequence is debug < info < error < fatal.
In case of invalid/empty log level, it print all logs.

Fixes golang/go#40339

Change-Id: I66116e6778eb6386bf1e8df6947078a78fece691
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245797
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-06 13:27:19 +00:00
Jonathan Amsterdam d1b4cbad38 internal/{log,worker}: label fetch log messages with module@version
- Make it possible to add a label to a context, so it appears in all log messages.
- Add the module and version as a label when fetching.

This will make it easy to find all log messages related to the fetch
of a single module.

Change-Id: I6c564b6aa58a494180d61168e739ef62dd67a64c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/760101
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-06-04 00:01:50 +00:00
Julie Qiu 19794c8aeb all: rename module to golang.org/x/pkgsite
golang.org/x/discovery is renamed to golang.org/x/pkgsite.

When the repository is open sourced, it will be hosted at
go.googlesource.com/pkgsite.

Change-Id: Ifc3b45b771a385b99179e785447f2a87afcacf87
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/724273
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-23 16:18:43 +00:00
Jonathan Amsterdam 83419ea86b internal/log: log active experiments
Change-Id: I677a3dec9de6f56ec0efc87fd169308ad89ecb72
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720366
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-16 22:57:31 +00:00
Jonathan Amsterdam cfcdc5826a internal/config: make more stateless
As per the bug listed below, we are trying to remove the global cfg
variable from the config package. This CL brings us close to that
goal. There are still two uses of the global that are harder to remove.

Updates b/145301722.

Change-Id: Ia6c350ef5d817ff7fb3125cd207343d10911d64f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672580
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 193997f5c7 internal/{log,middleware}: add trace ID to context, use in logging
- The requestlog middleware gets the trace ID from the request and
  adds it to the request's context.

- The internal/log package retrieves the traceID and adds it to log
  messages. It also creates two logs instead of one, a "parent" log
  used in requestlog, and a "child" log used for all other logging.
  Together, these two changes will cause the Stackdriver log viewer to
  group all log messages for a request with the request start and end
  log messages.

- These changes require that all log functions take a context, so I
  plumbed one through everywhere. In a handful of cases it didn't seem
  worth doing the plumbing. I used context.TODO() for those so we can
  easily find and re-evalaute them.

Change-Id: I663588463520187d0549a8f802ba9cb44a893592
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/622940
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:50 -04:00
Rob Findley c9e31268d9 internal/config,internal/log: minor cleanup related to resource types
A few things are cleaned up related to our use of resource types:
 + clarify why we use the gae_app resource type instead of gae_instance for
   logging.  which has been abandoned, tried
   to switch to gae_instance
 + set 'zone' instead of the incorrect 'zone_id' in our gae_app
   monitored resources
 + don't set a monitored resource in the RequestLog middleware: it
   should fall back on the common resource

Fixes b/145293043

Change-Id: I395a7046ef6bcbfbc7e5e02c767eb715b830c198
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/613500
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:49 -04:00
Jonathan Amsterdam 0cef6f3f99 internal/log: convert errors to strings
If we don't do this, then

   log.Error(err)

could log as the empty JSON object, because the logging client will
try to serialize the value as JSON, and errors arising from
errors.New, fmt.Errorf, etc. have no exported fields.

Change-Id: If5a7c9da728ce23fbf279e15520371c4ae6e83db
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/558530
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:44 -04:00
Jonathan Amsterdam d787f45c48 internal/etl: convert to new logger
Use the new logger everywhere.

Also remove the Printf alias; it is easy enough to change all call sites.

Change-Id: I4f46c306e22f132cd505518a8d46b1a989f6bd1d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556722
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:43 -04:00
Jonathan Amsterdam 8017c52c28 internal/log: a logging package
It is intended as a drop-in replacement for the standard log
package, but also supports levels (just three for now)
and structured logging.

Also, converted etl/main.go as an example, to show usage.

If this is approved I'll convert everything else.

Change-Id: I8ee8855be05aafdd31cbf9b550aae76cb2240abe
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556096
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:43 -04:00