Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
3c98c512
Commit
3c98c512
authored
Oct 11, 2016
by
Adam Reese
Committed by
GitHub
Oct 11, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1336 from adamreese/feat/grpc-tracing
feat(tiller): add optional grpc tracing
parents
cd4069dd
995f7569
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
8 deletions
+75
-8
tiller.go
cmd/tiller/tiller.go
+15
-8
trace.go
cmd/tiller/trace.go
+60
-0
No files found.
cmd/tiller/tiller.go
View file @
3c98c512
...
@@ -46,9 +46,11 @@ var rootServer = grpc.NewServer()
...
@@ -46,9 +46,11 @@ var rootServer = grpc.NewServer()
var
env
=
environment
.
New
()
var
env
=
environment
.
New
()
var
(
var
(
addr
=
":44134"
grpcAddr
=
":44134"
probe
=
":44135"
probeAddr
=
":44135"
store
=
storageConfigMap
traceAddr
=
":44136"
enableTracing
=
false
store
=
storageConfigMap
)
)
const
globalUsage
=
`The Kubernetes Helm server.
const
globalUsage
=
`The Kubernetes Helm server.
...
@@ -67,8 +69,9 @@ var rootCommand = &cobra.Command{
...
@@ -67,8 +69,9 @@ var rootCommand = &cobra.Command{
func
main
()
{
func
main
()
{
pf
:=
rootCommand
.
PersistentFlags
()
pf
:=
rootCommand
.
PersistentFlags
()
pf
.
StringVarP
(
&
a
ddr
,
"listen"
,
"l"
,
":44134"
,
"The address:port to listen on"
)
pf
.
StringVarP
(
&
grpcA
ddr
,
"listen"
,
"l"
,
":44134"
,
"The address:port to listen on"
)
pf
.
StringVar
(
&
store
,
"storage"
,
storageConfigMap
,
"The storage driver to use. One of 'configmap' or 'memory'"
)
pf
.
StringVar
(
&
store
,
"storage"
,
storageConfigMap
,
"The storage driver to use. One of 'configmap' or 'memory'"
)
pf
.
BoolVar
(
&
enableTracing
,
"trace"
,
false
,
"Enable rpc tracing"
)
rootCommand
.
Execute
()
rootCommand
.
Execute
()
}
}
...
@@ -84,16 +87,20 @@ func start(c *cobra.Command, args []string) {
...
@@ -84,16 +87,20 @@ func start(c *cobra.Command, args []string) {
env
.
Releases
=
storage
.
Init
(
driver
.
NewConfigMaps
(
c
.
ConfigMaps
(
environment
.
TillerNamespace
)))
env
.
Releases
=
storage
.
Init
(
driver
.
NewConfigMaps
(
c
.
ConfigMaps
(
environment
.
TillerNamespace
)))
}
}
lstn
,
err
:=
net
.
Listen
(
"tcp"
,
a
ddr
)
lstn
,
err
:=
net
.
Listen
(
"tcp"
,
grpcA
ddr
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Server died: %s
\n
"
,
err
)
fmt
.
Fprintf
(
os
.
Stderr
,
"Server died: %s
\n
"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
fmt
.
Printf
(
"Tiller is
running on %s
\n
"
,
a
ddr
)
fmt
.
Printf
(
"Tiller is
listening on %s
\n
"
,
grpcA
ddr
)
fmt
.
Printf
(
"
Tiller probes server is running on %s
\n
"
,
probe
)
fmt
.
Printf
(
"
Probes server is listening on %s
\n
"
,
probeAddr
)
fmt
.
Printf
(
"Storage driver is %s
\n
"
,
env
.
Releases
.
Name
())
fmt
.
Printf
(
"Storage driver is %s
\n
"
,
env
.
Releases
.
Name
())
if
enableTracing
{
startTracing
(
traceAddr
)
}
srvErrCh
:=
make
(
chan
error
)
srvErrCh
:=
make
(
chan
error
)
probeErrCh
:=
make
(
chan
error
)
probeErrCh
:=
make
(
chan
error
)
go
func
()
{
go
func
()
{
...
@@ -104,7 +111,7 @@ func start(c *cobra.Command, args []string) {
...
@@ -104,7 +111,7 @@ func start(c *cobra.Command, args []string) {
go
func
()
{
go
func
()
{
mux
:=
newProbesMux
()
mux
:=
newProbesMux
()
if
err
:=
http
.
ListenAndServe
(
probe
,
mux
);
err
!=
nil
{
if
err
:=
http
.
ListenAndServe
(
probe
Addr
,
mux
);
err
!=
nil
{
probeErrCh
<-
err
probeErrCh
<-
err
}
}
}()
}()
...
...
cmd/tiller/trace.go
0 → 100644
View file @
3c98c512
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
main
// import "k8s.io/helm/cmd/tiller"
import
(
"fmt"
"log"
"net/http"
_
"net/http/pprof"
"google.golang.org/grpc"
)
func
startTracing
(
addr
string
)
{
fmt
.
Printf
(
"Tracing server is listening on %s
\n
"
,
addr
)
grpc
.
EnableTracing
=
true
http
.
HandleFunc
(
"/"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
r
.
URL
.
Path
!=
"/"
{
http
.
NotFound
(
w
,
r
)
return
}
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/html; charset=utf-8"
)
w
.
Write
([]
byte
(
traceIndexHTML
))
})
go
func
()
{
if
err
:=
http
.
ListenAndServe
(
addr
,
nil
);
err
!=
nil
{
log
.
Printf
(
"tracing error: %s"
,
err
)
}
}()
}
const
traceIndexHTML
=
`<!DOCTYPE html>
<html>
<body>
<ul>
<li><a href="/debug/requests">requests</a></li>
<li><a href="/debug/events">events</a></li>
<li><a href="/debug/pprof">pprof</a></li>
<li><a href="/debug/vars">vars</a></li>
</ul>
</body>
</html>
`
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment