Skip to content

Commit

Permalink
Merge pull request #90 from dongxuny/master
Browse files Browse the repository at this point in the history
Bump up rk-entry version to v2.2.10 & swith path to filepath in codes
  • Loading branch information
dongxuny authored Nov 1, 2022
2 parents f64e551 + d9c1e67 commit 25309c2
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 42 deletions.
22 changes: 11 additions & 11 deletions boot/grpc_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import (
"net"
"net/http"
"net/http/pprof"
"path"
"path/filepath"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -588,16 +588,16 @@ func (entry *GrpcEntry) Bootstrap(ctx context.Context) {
// 15: pprof
if entry.IsPProfEnabled() {
entry.HttpMux.HandleFunc(entry.PProfEntry.Path, pprof.Index)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "cmdline"), pprof.Cmdline)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "profile"), pprof.Profile)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "symbol"), pprof.Symbol)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "trace"), pprof.Trace)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "allocs"), pprof.Handler("allocs").ServeHTTP)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "block"), pprof.Handler("block").ServeHTTP)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "goroutine"), pprof.Handler("goroutine").ServeHTTP)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "heap"), pprof.Handler("heap").ServeHTTP)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "mutex"), pprof.Handler("mutex").ServeHTTP)
entry.HttpMux.HandleFunc(path.Join(entry.PProfEntry.Path, "threadcreate"), pprof.Handler("threadcreate").ServeHTTP)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "cmdline"), pprof.Cmdline)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "profile"), pprof.Profile)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "symbol"), pprof.Symbol)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "trace"), pprof.Trace)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "allocs"), pprof.Handler("allocs").ServeHTTP)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "block"), pprof.Handler("block").ServeHTTP)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "goroutine"), pprof.Handler("goroutine").ServeHTTP)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "heap"), pprof.Handler("heap").ServeHTTP)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "mutex"), pprof.Handler("mutex").ServeHTTP)
entry.HttpMux.HandleFunc(filepath.Join(entry.PProfEntry.Path, "threadcreate"), pprof.Handler("threadcreate").ServeHTTP)
}

// 16: Create http server
Expand Down
9 changes: 0 additions & 9 deletions boot/grpc_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"google.golang.org/grpc"
"io/ioutil"
"math/big"
"net"
"net/http"
"os"
"path"
"strconv"
"testing"
"time"
Expand Down Expand Up @@ -442,9 +439,3 @@ func validateServerIsUp(t *testing.T, port uint64) {
assert.Nil(t, conn.Close())
}
}

func createFileAtTestTempDir(t *testing.T, content string) string {
tempDir := path.Join(t.TempDir(), "ut-boot.yaml")
assert.Nil(t, ioutil.WriteFile(tempDir, []byte(content), os.ModePerm))
return tempDir
}
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ go 1.17

require (
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3
github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0
github.com/improbable-eng/grpc-web v0.15.0
github.com/prometheus/client_golang v1.12.2
github.com/rookie-ninja/rk-entry/v2 v2.2.9
github.com/rookie-ninja/rk-entry/v2 v2.2.10
github.com/rookie-ninja/rk-logger v1.2.12
github.com/rookie-ninja/rk-query v1.2.14
github.com/soheilhy/cmux v0.1.5
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
go.uber.org/zap v1.21.0
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd
google.golang.org/grpc v1.46.2
google.golang.org/protobuf v1.28.0
golang.org/x/net v0.0.0-20220909164309-bea034e7d591
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -66,8 +66,8 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/ratelimit v0.2.0 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.8 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit 25309c2

Please sign in to comment.