Skip to content

Commit

Permalink
Add automaxprocs (#2724)
Browse files Browse the repository at this point in the history
  • Loading branch information
anyasabo authored Mar 21, 2020
1 parent 0404e80 commit 25e5387
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ issues:
- stylecheck
text: 'ST1016: methods on the same type should have the same receiver name .*'
- path: cmd/manager/main\.go
text: 'cyclomatic complexity 31 of func `execute` is high (> 30)'
text: 'cyclomatic complexity \d+ of func `execute` is high'
- path: pkg/controller/apmserver/config/reconcile\.go
text: 'G101: Potential hardcoded credentials'
- path: pkg/controller/common/settings/canonical_config\.go
Expand Down
40 changes: 34 additions & 6 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,34 @@ Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasti
limitations under the License.


--------------------------------------------------------------------------------
Module : go.uber.org/automaxprocs
Version : v1.3.0
Time : 2020-01-23T19:41:49Z
Licence : MIT

Contents of probable licence file $GOMODCACHE/go.uber.org/[email protected]/LICENSE:

Copyright (c) 2017 Uber Technologies, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

--------------------------------------------------------------------------------
Module : go.uber.org/zap
Version : v1.12.0
Expand Down Expand Up @@ -26433,11 +26461,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Module : golang.org/x/lint
Version : v0.0.0-20190930215403-16217165b5de
Time : 2019-09-30T21:54:03Z
Version : v0.0.0-20191125180803-fdd1cda4f05f
Time : 2019-11-25T18:08:03Z
Licence : BSD-3-Clause

Contents of probable licence file $GOMODCACHE/golang.org/x/[email protected]20190930215403-16217165b5de/LICENSE:
Contents of probable licence file $GOMODCACHE/golang.org/x/[email protected]20191125180803-fdd1cda4f05f/LICENSE:

Copyright (c) 2013 The Go Authors. All rights reserved.

Expand Down Expand Up @@ -26766,11 +26794,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Module : golang.org/x/tools
Version : v0.0.0-20191029190741-b9c20aec41a5
Time : 2019-10-29T19:07:41Z
Version : v0.0.0-20191125144606-a911d9008d1f
Time : 2019-11-25T14:46:06Z
Licence : BSD-3-Clause

Contents of probable licence file $GOMODCACHE/golang.org/x/[email protected]20191029190741-b9c20aec41a5/LICENSE:
Contents of probable licence file $GOMODCACHE/golang.org/x/[email protected]20191125144606-a911d9008d1f/LICENSE:

Copyright (c) 2009 The Go Authors. All rights reserved.

Expand Down
8 changes: 8 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
licensing "github.com/elastic/cloud-on-k8s/pkg/license"
"github.com/elastic/cloud-on-k8s/pkg/utils/net"
"github.com/elastic/cloud-on-k8s/pkg/utils/rbac"
"go.uber.org/automaxprocs/maxprocs"
"k8s.io/apimachinery/pkg/util/wait"
)

Expand Down Expand Up @@ -180,6 +181,13 @@ func init() {
}

func execute() {
// update GOMAXPROCS to container cpu limit if necessary
_, err := maxprocs.Set(maxprocs.Logger(log.Info))
if err != nil {
log.Error(err, "Error setting GOMAXPROCS")
os.Exit(1)
}

if dev.Enabled {
// expose pprof if development mode is enabled
mux := http.NewServeMux()
Expand Down
5 changes: 3 additions & 2 deletions docs/reference/dependencies.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ This page lists the third-party dependencies used to build {n}.
| link:https://github.com/tsenart/vegeta[$$github.com/tsenart/vegeta$$] | v12.7.0+incompatible | MIT
| link:https://go.elastic.co/apm[$$go.elastic.co/apm$$] | v1.7.0 | Apache-2.0
| link:https://go.elastic.co/apm/module/apmelasticsearch[$$go.elastic.co/apm/module/apmelasticsearch$$] | v1.7.0 | Apache-2.0
| link:https://go.uber.org/automaxprocs[$$go.uber.org/automaxprocs$$] | v1.3.0 | MIT
| link:https://go.uber.org/zap[$$go.uber.org/zap$$] | v1.12.0 | MIT
| link:https://golang.org/x/crypto[$$golang.org/x/crypto$$] | v0.0.0-20191011191535-87dc89f01550 | BSD-3-Clause
| link:https://gopkg.in/yaml.v2[$$gopkg.in/yaml.v2$$] | v2.2.5 | Apache-2.0
Expand Down Expand Up @@ -257,7 +258,7 @@ This page lists the third-party dependencies used to build {n}.
| link:https://go.uber.org/tools[$$go.uber.org/tools$$] | v0.0.0-20190618225709-2cfd321de3ee | MIT
| link:https://golang.org/x/exp[$$golang.org/x/exp$$] | v0.0.0-20190312203227-4b39c73a6495 | BSD-3-Clause
| link:https://golang.org/x/image[$$golang.org/x/image$$] | v0.0.0-20190227222117-0694c2d4d067 | BSD-3-Clause
| link:https://golang.org/x/lint[$$golang.org/x/lint$$] | v0.0.0-20190930215403-16217165b5de | BSD-3-Clause
| link:https://golang.org/x/lint[$$golang.org/x/lint$$] | v0.0.0-20191125180803-fdd1cda4f05f | BSD-3-Clause
| link:https://golang.org/x/mobile[$$golang.org/x/mobile$$] | v0.0.0-20190312151609-d3739f865fa6 | BSD-3-Clause
| link:https://golang.org/x/mod[$$golang.org/x/mod$$] | v0.0.0-20190513183733-4bf6d317e70e | BSD-3-Clause
| link:https://golang.org/x/net[$$golang.org/x/net$$] | v0.0.0-20191011234655-491137f69257 | BSD-3-Clause
Expand All @@ -266,7 +267,7 @@ This page lists the third-party dependencies used to build {n}.
| link:https://golang.org/x/sys[$$golang.org/x/sys$$] | v0.0.0-20191204072324-ce4227a45e2e | BSD-3-Clause
| link:https://golang.org/x/text[$$golang.org/x/text$$] | v0.3.2 | BSD-3-Clause
| link:https://golang.org/x/time[$$golang.org/x/time$$] | v0.0.0-20190921001708-c4c64cad1fd0 | BSD-3-Clause
| link:https://golang.org/x/tools[$$golang.org/x/tools$$] | v0.0.0-20191029190741-b9c20aec41a5 | BSD-3-Clause
| link:https://golang.org/x/tools[$$golang.org/x/tools$$] | v0.0.0-20191125144606-a911d9008d1f | BSD-3-Clause
| link:https://golang.org/x/xerrors[$$golang.org/x/xerrors$$] | v0.0.0-20191011141410-1b5146add898 | BSD-3-Clause
| link:https://gomodules.xyz/jsonpatch/v2[$$gomodules.xyz/jsonpatch/v2$$] | v2.0.1 | Apache-2.0
| link:https://github.com/gonum/gonum[$$gonum.org/v1/gonum$$] | v0.0.0-20190331200053-3d26580ed485 | BSD-3-Clause
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ require (
github.com/tsenart/vegeta v12.7.0+incompatible
go.elastic.co/apm v1.7.0
go.elastic.co/apm/module/apmelasticsearch v1.7.0
go.uber.org/automaxprocs v1.3.0
go.uber.org/zap v1.12.0
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
golang.org/x/net v0.0.0-20191011234655-491137f69257 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/automaxprocs v1.3.0 h1:II28aZoGdaglS5vVNnspf28lnZpXScxtIozx1lAjdb0=
go.uber.org/automaxprocs v1.3.0/go.mod h1:9CWT6lKIep8U41DDaPiH6eFscnTyjfTANNQNx6LrIcA=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc=
Expand Down Expand Up @@ -524,6 +526,7 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -625,6 +628,7 @@ golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
Expand Down

0 comments on commit 25e5387

Please sign in to comment.