Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
withinboredom committed Sep 25, 2024
1 parent eed12d2 commit 733fb9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion frankenphp.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func calculateMaxThreads(opt *opt) error {

metrics.TotalThreads(opt.numThreads)
MaxThreads = opt.numThreads

return nil
}

Expand Down Expand Up @@ -475,7 +476,7 @@ func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) error
fc.responseWriter = responseWriter
fc.startedAt = time.Now()

isWorker := nil == fc.responseWriter
isWorker := fc.responseWriter == nil
isWorkerRequest := false

rc := requestChan
Expand Down
15 changes: 8 additions & 7 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ var metricsNameRegex = regexp.MustCompile(`\W+`)
var metricsNameFixRegex = regexp.MustCompile(`^_+|_+$`)

type Metrics interface {
// StartWorker Collects started workers
// StartWorker collects started workers
StartWorker(name string)
// StopWorker Collects stopped workers
// StopWorker collects stopped workers
StopWorker(name string)
// TotalWorkers Collects expected workers
// TotalWorkers collects expected workers
TotalWorkers(name string, num int)
// TotalThreads Collects total threads
// TotalThreads collects total threads
TotalThreads(num int)
// StartRequest Collects started requests
// StartRequest collects started requests
StartRequest()
// StopRequest Collects stopped requests
// StopRequest collects stopped requests
StopRequest()
// StopWorkerRequest Collects stopped worker requests
// StopWorkerRequest collects stopped worker requests
StopWorkerRequest(name string, duration time.Duration)
// StartWorkerRequest collects started worker requests
StartWorkerRequest(name string)
Shutdown()
}
Expand Down

0 comments on commit 733fb9a

Please sign in to comment.