Skip to content

Commit

Permalink
Merge pull request #29 from profefe/feature/poc-opentelemetry
Browse files Browse the repository at this point in the history
feat: OpenTelemetry intrumentation
Signed-off-by: Gianluca Arbezzano <gianarb92@gmail.com>
  • Loading branch information
gianarb authored and Gianluca Arbezzano committed Mar 11, 2020
2 parents 407ccce + 0f01b32 commit ac94cb7
Show file tree
Hide file tree
Showing 6 changed files with 420 additions and 95 deletions.
20 changes: 19 additions & 1 deletion cmd/kprofefe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (
_ "net/http/pprof"

"github.com/gianarb/kube-profefe/pkg/cmd"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/exporters/trace/stdout"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.uber.org/zap"
"k8s.io/cli-runtime/pkg/genericclioptions"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
Expand All @@ -18,12 +21,27 @@ func main() {
log.Println(http.ListenAndServe(":6060", nil))
}()

exporter, err := stdout.NewExporter(stdout.Options{PrettyPrint: true})
if err != nil {
log.Fatal(err)
}
tp, err := sdktrace.NewProvider(sdktrace.WithConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()}),
sdktrace.WithSyncer(exporter))
if err != nil {
log.Fatal(err)
}
global.SetTraceProvider(tp)

logger, _ := zap.NewDevelopment()

rootCmd := cmd.NewKProfefeCmd(logger, genericclioptions.IOStreams{
In: os.Stdin,
Out: os.Stdout,
ErrOut: os.Stderr,
})

rootCmd.Execute()
err = rootCmd.Execute()
if err != nil {
panic(err)
}
}
50 changes: 26 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,45 @@ module github.com/gianarb/kube-profefe
go 1.13

require (
github.com/cenkalti/backoff/v3 v3.1.1
github.com/docker/go-units v0.4.0 // indirect
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/elazarl/goproxy v0.0.0-20190410145444-c548f45dcf1d // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190410145444-c548f45dcf1d // indirect
github.com/emicklei/go-restful v2.8.0+incompatible // indirect
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/jsonpointer v0.17.2 // indirect
github.com/go-openapi/jsonreference v0.17.2 // indirect
github.com/go-openapi/spec v0.18.0 // indirect
github.com/go-openapi/swag v0.17.2 // indirect
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/protobuf v1.3.1 // indirect
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/go-openapi/spec v0.19.2 // indirect
github.com/go-openapi/swag v0.19.4 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/pprof v0.0.0-20191105193234-27840fff0d09
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/googleapis/gnostic v0.3.0 // indirect
github.com/gorilla/mux v1.7.3 // indirect
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect
github.com/onsi/ginkgo v1.10.1 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/testcontainers/testcontainers-go v0.0.10
go.opentelemetry.io/otel v0.2.4-0.20200307183859-3bf3927eb55d
go.opentelemetry.io/otel/exporters/trace/jaeger v0.2.4-0.20200307183859-3bf3927eb55d
go.uber.org/zap v1.13.0
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 // indirect
google.golang.org/appengine v1.5.0 // indirect
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 // indirect
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 // indirect
golang.org/x/sys v0.0.0-20191010194322-b09406accb47 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/appengine v1.6.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
k8s.io/api v0.0.0-20190813020757-36bff7324fb7
k8s.io/apimachinery v0.0.0-20190809020650-423f5d784010
k8s.io/cli-runtime v0.0.0-20190409023024-d644b00f3b79
k8s.io/client-go v11.0.0+incompatible
k8s.io/klog v0.3.0 // indirect
k8s.io/kube-openapi v0.0.0-20190401085232-94e1e7b7574c // indirect
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 // indirect
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog v0.4.0 // indirect
k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6 // indirect
k8s.io/utils v0.0.0-20190809000727-6c36bc71fc4a // indirect
sigs.k8s.io/kustomize v2.0.3+incompatible // indirect
sigs.k8s.io/yaml v1.1.0 // indirect
)
Loading

0 comments on commit ac94cb7

Please sign in to comment.