-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] - move buffer pool logic into own pkg (#2828)
* move buffer pool logic into own pkg * fix test * fix test * whoops
- Loading branch information
Showing
9 changed files
with
255 additions
and
225 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package pool | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
|
||
"github.com/trufflesecurity/trufflehog/v3/pkg/common" | ||
) | ||
|
||
var ( | ||
activeBufferCount = promauto.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: common.MetricsNamespace, | ||
Subsystem: common.MetricsSubsystem, | ||
Name: "active_buffer_count", | ||
Help: "Current number of active buffers.", | ||
}) | ||
|
||
bufferCount = promauto.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: common.MetricsNamespace, | ||
Subsystem: common.MetricsSubsystem, | ||
Name: "buffer_count", | ||
Help: "Total number of buffers managed by the pool.", | ||
}) | ||
|
||
shrinkCount = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: common.MetricsNamespace, | ||
Subsystem: common.MetricsSubsystem, | ||
Name: "shrink_count", | ||
Help: "Total number of times buffers in the pool have shrunk.", | ||
}) | ||
|
||
shrinkAmount = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: common.MetricsNamespace, | ||
Subsystem: common.MetricsSubsystem, | ||
Name: "shrink_amount", | ||
Help: "Total amount of bytes buffers in the pool have shrunk by.", | ||
}) | ||
|
||
checkoutCount = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: common.MetricsNamespace, | ||
Subsystem: common.MetricsSubsystem, | ||
Name: "checkout_count", | ||
Help: "Total number of Buffer checkouts.", | ||
}) | ||
) |
Oops, something went wrong.