Commit Graph

28 Commits

Author SHA1 Message Date
Scott Nichols 298f22bea6 update boilerplate to use 2020 (#979) 2020-01-07 16:04:51 -08:00
coryrc d3841ea2c3 Remove ugly constant string being printed in every log. (#878)
In every log we get the ugly string printed:
2019-11-13T08:44:42.421-0800    info    logging/config.go:50
Successfully created the logger.    {"knative.dev/jsonconfig": "{\n\t
\"level\": \"debug\",\n\t  \"encoding\": \"console\",\n\t
\"outputPaths\": [\"stdout\"],\n\t  \"errorOutputPaths\":
[\"stderr\"],\n\t  \"encoderConfig\": {\n\t    \"timeKey\":
\"ts\",\n\t    \"messageKey\": \"message\",\n\t    \"levelKey\":
\"level\",\n\t    \"nameKey\": \"logger\",\n\t    \"callerKey\":
\"caller\",\n\t    \"messageKey\": \"msg\",\n\t    \"stacktraceKey\":
\"stacktrace\",\n\t    \"lineEnding\": \"\",\n\t    \"levelEncoder\":
\"\",\n\t    \"timeEncoder\": \"iso8601\",\n\t    \"durationEncoder\":
\"\",\n\t    \"callerEncoder\": \"\"\n\t  }\n\t}"}

It's all a constant (see test/logging/logging.go:newLogger), except
"level", which is then printed immediately afterward. So just remove
printing this string.
2019-11-13 19:30:28 -08:00
Markus Thömmes 56c2594e4f Assorted linting fixes. (#840)
* Remove unused code.

* Remove unneeded loops.

* Remove unneeded Printf calls.

* Use time.Since instead of time.Now().Sub.

* Remove unused values.

* Rename error variable according to conventions.

* Return error last.

* Simplify array allocations.

* Remove leaky ticker.

* Remove Yoda conditions.

* Remove deprecated function to talk to GKE.

* Remove dot import.

* Remove empty critical section and replace with a channel operation.

* Add linter directives to explicitly state wanted weirdness.

* Update deps.

* Fix broken line.
2019-11-01 12:49:12 -07:00
Antoine Cotten ec5f5148b8 Do not override log level if component is undefined in logging config (#780)
* Do not override log level if component undefined

* review(vagababov): Remove empty line
2019-10-20 14:14:22 -07:00
Tara Gu 06918f4c69 Remove caching in test logger setup (#661)
* Remove caching in test logger setup

* Revert "Remove caching in test logger setup"

This reverts commit e3c5349e3c.

* Don't create new logger in SetupFakeContextWithCancel

* Revert "Don't create new logger in SetupFakeContextWithCancel"

This reverts commit 2d57ccf028.

* Remove test logger cache, and leave an empty shell for ClearAll()
2019-09-20 10:42:06 -07:00
Markus Thömmes 7b725e1ae6 Use a nil map instead of an empty map for the same effect. (#695) 2019-09-19 13:00:00 -07:00
mattmoor-sockpuppet a07e7def0a golang format tools (#659)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
/assign mattmoor
2019-09-11 07:12:29 -07:00
Ignacio Cano c56cedc7e7 Serializing/Deserializing Logging and Metrics configs (#656)
* source stats reporter... should be used by well-behaved sources

* public fields

* moving serialization/deserialization of metrics and logging maps to pkg

* nits

* adding UT

* same order

* updates

* sock-puppet

* unregistration problem?

* removing base64 encoding

* removing TODO

* comments after review

* removing the other constants
2019-09-10 12:36:29 -07:00
Andrea Frittoli 554d86c2d5 Reducing the log level for github commit to info (#506)
The logger by default attempts to fetch the commit id from kodata.
When that fails log a message with info rather than warning, to
avoid creating spurious warning message when starting applications.

Fixes #505

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
2019-08-28 12:58:41 -07:00
Matt Moore 222dd25986 Migrate pkg to use the knative.dev/pkg import path (#489)
* Manual changes.

* scripted changes.
2019-06-26 13:02:06 -07:00
mattmoor-sockpuppet 17ec1ed50d golang format tools (#437)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-05-31 11:11:32 -07:00
Adam Harwayne 67d95db076 Logging config parses all components, rather than just a list passed in. (#436)
* Logging config pares all components, rather than just a list passed in.

* Simplify the prefix checking logic.

* PR comment - ignore empty string.

* Unit test.
2019-05-30 15:23:31 -07:00
Adriano Cunha c0132d9dde Update OWNERS to use OWNERS_ALIASES (#422) 2019-05-29 20:04:33 -07:00
Matt Moore 2923ca42d9 Share the configmap name logic for Logging and Metrics. (#425)
This also adds a way to fetch the metrics "domain" following a similar pattern to `system.Namespace()`.
2019-05-27 18:41:29 -07:00
leo james 7b196cff46 add trace id (#405)
* add trace id

* using with list

* add comment
2019-05-16 07:14:22 -07:00
Matt Moore 281cda84ce Move Condition stuff to apis, add a v1beta1 Status. (#361)
This moves the common Condition stuff to apis, and creates a v1beta1 form of Status that uses the Condition it defines (changing this in v1alpha1 is too breaking).

There aren't really any meaningful changes in this PR, mostly reorganization.  Enumerating what I did:
1. Copied `condition_set*.go` to `apis/`,
1. Copied the `Condition` portions of `conditions_types.go` to `apis/`,
1. Copied the balance of `conditions_types.go` to `apis/duck/v1beta1/status_types.go`,
1. Changed the parts of the above to reference things in the appropriate new places,
1. Removed the reflection-based `ConditionsAccessor` stuff, implementing it instead on `duckv1beta1.Status`.
1. Incorporate: https://github.com/knative/pkg/pull/358
2019-04-02 09:51:55 -07:00
Victor Agababov c100323403 Fix the sugared logger usage (#300)
* Fix the sugared logger usage

Without `w` the logged messages are quite useless and annoying.

* some more magic
2019-02-28 18:17:38 -08:00
Victor Agababov 5db4e8e38e Clean test loggers (#266)
* fix very annoying logging in the integration tests

* Add clean test loggers method.

This would help us run the tests over-and-over again.
Currently the test hogs `t` and that object is not reusable.
2019-02-10 08:13:42 -08:00
Matt Moore 77b7b13190 Move the defaulting for ConfigMap into our logging library. (#258)
Progress towards: https://github.com/knative/serving/issues/2668
2019-01-30 21:59:37 -08:00
Yanwei Guo 088e3f7faf Add the commit ID key as constant for log label (#158)
* add the commit id constant

* add changeset lib

* add doc.go with explanation
2018-11-06 14:59:36 -08:00
Dave Protasowski 2b6bdaba3b Use zaptest logger for our TestLogger (#89)
* Bump go.uber.org/zap to 67bc79

* Use the zaptest logger which uses testing.T.Log methods
2018-09-25 21:40:20 -07:00
Dave Protasowski 0122abd983 The test logger will now log the correct caller (#63)
Previous, since we weren't skipping, the logged caller
would be 'logging.go'
2018-09-06 14:16:14 -07:00
Matt Moore 3ca427071d Add a logkey for the reconcile key. (#49)
This adds a logkey.Key for attaching the key being reconciled to a logger we embed into the context passed to Reconcile.  The point of this is to enable us to eliminate [this](928d580756/pkg/reconciler/v1alpha1/service/service.go (L101-L104)) boilerplate from each of the Reconcilers.

These aren't identical, this has the form:
  knative.dev/key: foo/bar

What it's replacing has the form:
  knative.dev/namespace: foo
  serving.knative.dev/service: bar

However, the type information present in the latter is redundant with the controller type that [should already be embedded](928d580756/pkg/reconciler/reconciler.go (L80)) in the logger.
2018-08-23 09:48:59 -07:00
Shashwathi bba99e266c Use fallback named logger (#30) 2018-07-31 14:19:37 -07:00
Shashwathi 9a6f5abda8 Use more verbose error msg (#31) 2018-07-31 09:38:37 -07:00
Yanwei Guo 94bc05ad25 Add yanweiguo as owner of logging directory (#29) 2018-07-30 21:34:37 -07:00
Matt Moore 9d1975b29f Drop the fixed list of `knative/serving` components from logging. (#22) 2018-07-27 10:14:36 -07:00
Matt Moore 8b7b2d7cfb Move the logging packages from serving into pkg. (#21) 2018-07-27 09:53:35 -07:00