Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working cloud profiler export for skaffold #6066

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/skaffold/skaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,38 @@ package main
import (
"context"
"errors"
"log"
"os"

"cloud.google.com/go/profiler"
"github.com/sirupsen/logrus"

"github.com/GoogleContainerTools/skaffold/cmd/skaffold/app"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/instrumentation"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/version"
)

type ExitCoder interface {
ExitCode() int
}

func main() {
if _, ok := os.LookupEnv("SKAFFOLD_PROFILER"); ok {
err := profiler.Start(profiler.Config{
Service: os.Getenv("SKAFFOLD_PROFILER_SERVICE"),
NoHeapProfiling: true,
NoAllocProfiling: true,
NoGoroutineProfiling: true,
DebugLogging: true,
// ProjectID must be set if not running on GCP.
ProjectID: os.Getenv("SKAFFOLD_PROFILER_PROJECT"),
ServiceVersion: version.Get().Version,
})
if err != nil {
log.Fatalf("failed to start the profiler: %v", err)
}
}
var code int
if err := app.Run(os.Stdout, os.Stderr); err != nil {
if errors.Is(err, context.Canceled) {
Expand Down
22 changes: 10 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ replace (

require (
4d63.com/tz v1.1.0
cloud.google.com/go v0.72.0
cloud.google.com/go v0.84.0
cloud.google.com/go/storage v1.10.0
github.com/AlecAivazis/survey/v2 v2.2.7
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.20.0
Expand All @@ -36,8 +36,8 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/protobuf v1.4.3
github.com/google/go-cmp v0.5.5
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.6
github.com/google/go-containerregistry v0.5.1
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20210216200643-d81088d9983e // indirect
github.com/google/go-github v17.0.0+incompatible
Expand Down Expand Up @@ -77,16 +77,14 @@ require (
go.opentelemetry.io/otel/trace v0.20.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/mod v0.4.2
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210603125802-9665404d3644
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
google.golang.org/api v0.35.0
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201202151023-55d61f90c1ce
google.golang.org/grpc v1.33.2
google.golang.org/protobuf v1.25.0
google.golang.org/api v0.48.0
google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
honnef.co/go/tools v0.1.3 // indirect
Expand Down
Loading