-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
server/handlers/instrumented_project_command_output_handler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package handlers | ||
|
||
import ( | ||
stats "github.com/lyft/gostats" | ||
"github.com/runatlantis/atlantis/server/events/models" | ||
) | ||
|
||
type InstrumentedProjectCommandOutputHandler struct { | ||
ProjectCommandOutputHandler | ||
numChans stats.Gauge | ||
} | ||
|
||
func NewInstrumentedProjectCommandOutputHandler(prjCmdOutputHandler ProjectCommandOutputHandler, statsScope stats.Scope) ProjectCommandOutputHandler { | ||
return &InstrumentedProjectCommandOutputHandler{ | ||
ProjectCommandOutputHandler: prjCmdOutputHandler, | ||
numChans: statsScope.Scope("log_streaming").NewGauge("num_ws_chans"), | ||
} | ||
} | ||
|
||
func (p *InstrumentedProjectCommandOutputHandler) Clear(ctx models.ProjectCommandContext) { | ||
p.ProjectCommandOutputHandler.Clear(ctx) | ||
} | ||
|
||
func (p *InstrumentedProjectCommandOutputHandler) Send(ctx models.ProjectCommandContext, msg string) { | ||
p.ProjectCommandOutputHandler.Send(ctx, msg) | ||
} | ||
|
||
func (p *InstrumentedProjectCommandOutputHandler) Receive(projectInfo string, receiver chan string, callback func(msg string) error) error { | ||
p.numChans.Inc() | ||
defer p.numChans.Dec() | ||
return p.ProjectCommandOutputHandler.Receive(projectInfo, receiver, callback) | ||
} | ||
|
||
func (p *InstrumentedProjectCommandOutputHandler) Handle() { | ||
p.ProjectCommandOutputHandler.Handle() | ||
} | ||
|
||
func (p *InstrumentedProjectCommandOutputHandler) SetJobURLWithStatus(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus) error { | ||
return p.ProjectCommandOutputHandler.SetJobURLWithStatus(ctx, cmdName, status) | ||
} | ||
|
||
func (p *InstrumentedProjectCommandOutputHandler) CleanUp(pull string) { | ||
p.ProjectCommandOutputHandler.CleanUp(pull) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters