Skip to content
Closed
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
21 changes: 14 additions & 7 deletions router/debug_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,21 @@ func routing(m []string, t time.Duration, h handler.Func) http.Handler {
for {
select {
case err := <-ech:
if err != nil {
http.Error(w,
fmt.Sprintf("Error: %s\t%s",
err.Error(),
http.StatusText(http.StatusInternalServerError)),
http.StatusInternalServerError)
glg.Error(err)
if err == nil {
return
}

if err == ctx.Err() {
glg.Info("Stopped debug router") // TODO: the log message should be checked by wfan
return
}

http.Error(w,
fmt.Sprintf("Error: %s\t%s",
err.Error(),
http.StatusText(http.StatusInternalServerError)),
http.StatusInternalServerError)
glg.Error(err)
return
case <-ctx.Done():
glg.Errorf("Handler Time Out: %v", time.Since(start))
Expand Down
29 changes: 19 additions & 10 deletions usecase/authz_proxyd.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,24 @@ func (g *authzProxyDaemon) Start(ctx context.Context) <-chan []error {
pch := g.athenz.Start(ctx)

for err := range pch {
if err != nil {
glg.Errorf("pch: %v", err)
// count errors by cause
cause := errors.Cause(err).Error()
_, ok := emap[cause]
if !ok {
emap[cause] = 1
} else {
emap[cause]++
}
if err == nil {
continue
}

if err == ctx.Err() {
// TODO: the log message should be checked by wfan
glg.Info("Stopped Athenz Proxy Daemon Channel")
continue
}

glg.Errorf("pch: %v", err)
// count errors by cause
cause := errors.Cause(err).Error()
_, ok := emap[cause]
if !ok {
emap[cause] = 1
} else {
emap[cause]++
}
}

Expand All @@ -127,6 +135,7 @@ func (g *authzProxyDaemon) Start(ctx context.Context) <-chan []error {
return errors.New("")
}
var baseErr error
// TODO: This part might have to be fixed
for i, err := range errs {
if i == 0 {
baseErr = err
Expand Down