-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
061c6dd
commit 47b4945
Showing
12 changed files
with
1,252 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/agglayer/aggkit/log" | ||
"github.com/agglayer/aggkit/prometheus" | ||
prometheusClient "github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
const ( | ||
prefix = "aggsender_" | ||
numberOfCertificatesSent = prefix + "number_of_certificates_sent" | ||
numberOfCertificatesInError = prefix + "number_of_certificates_in_error" | ||
numberOfSendingRetries = prefix + "number_of_sending_retries" | ||
numberOfCertificatesSettled = prefix + "number_of_sending_settled" | ||
certificateBuildTime = prefix + "certificate_build_time" | ||
proverTime = prefix + "prover_time" | ||
) | ||
|
||
// Register the metrics for the aggsender package | ||
func Register() { | ||
gauges := []prometheusClient.GaugeOpts{ | ||
{ | ||
Name: numberOfCertificatesSent, | ||
Help: "[AGGSENDER] number of certificates sent", | ||
}, | ||
{ | ||
Name: numberOfCertificatesInError, | ||
Help: "[AGGSENDER] number of certificates in error", | ||
}, | ||
{ | ||
Name: numberOfSendingRetries, | ||
Help: "[AGGSENDER] number of sending retries", | ||
}, | ||
{ | ||
Name: numberOfCertificatesSettled, | ||
Help: "[AGGSENDER] number of certificates settled", | ||
}, | ||
{ | ||
Name: certificateBuildTime, | ||
Help: "[AGGSENDER] certificate build time", | ||
}, | ||
{ | ||
Name: proverTime, | ||
Help: "[AGGSENDER] prover time", | ||
}, | ||
} | ||
prometheus.RegisterGauges(gauges...) | ||
log.Info("Registered prometheus aggsender metrics") | ||
} | ||
|
||
// CertificateSent increments the gauge for the number of certificates sent | ||
func CertificateSent() { | ||
prometheus.GaugeInc(numberOfCertificatesSent) | ||
} | ||
|
||
// InError increments the gauge for the number of certificates in error | ||
func InError() { | ||
prometheus.GaugeInc(numberOfCertificatesInError) | ||
} | ||
|
||
// SendingRetry increments the gauge for the number of sending retries | ||
func SendingRetry() { | ||
prometheus.GaugeInc(numberOfSendingRetries) | ||
} | ||
|
||
// Settled increments the gauge for the number of certificates settled | ||
func Settled() { | ||
prometheus.GaugeInc(numberOfCertificatesSettled) | ||
} | ||
|
||
// CertificateBuildTime sets the gauge for the certificate build time | ||
func CertificateBuildTime(value float64) { | ||
prometheus.GaugeSet(certificateBuildTime, value) | ||
} | ||
|
||
// ProverTime sets the gauge for the prover time | ||
func ProverTime(value float64) { | ||
prometheus.GaugeSet(proverTime, value) | ||
} |
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
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,16 @@ | ||
package prometheus | ||
|
||
const ( | ||
// Endpoint the endpoint for exposing the metrics | ||
Endpoint = "/metrics" | ||
// ProfilingIndexEndpoint the endpoint for exposing the profiling metrics | ||
ProfilingIndexEndpoint = "/debug/pprof/" | ||
// ProfileEndpoint the endpoint for exposing the profile of the profiling metrics | ||
ProfileEndpoint = "/debug/pprof/profile" | ||
// ProfilingCmdEndpoint the endpoint for exposing the command-line of profiling metrics | ||
ProfilingCmdEndpoint = "/debug/pprof/cmdline" | ||
// ProfilingSymbolEndpoint the endpoint for exposing the symbol of profiling metrics | ||
ProfilingSymbolEndpoint = "/debug/pprof/symbol" | ||
// ProfilingTraceEndpoint the endpoint for exposing the trace of profiling metrics | ||
ProfilingTraceEndpoint = "/debug/pprof/trace" | ||
) |
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,11 @@ | ||
package prometheus | ||
|
||
// Config represents the configuration of the metrics | ||
type Config struct { | ||
// Enabled is the flag to enable/disable the metrics server | ||
Enabled bool `mapstructure:"Enabled"` | ||
// Host is the address to bind the metrics server | ||
Host string `mapstructure:"Host"` | ||
// Port is the port to bind the metrics server | ||
Port int `mapstructure:"Port"` | ||
} |
Oops, something went wrong.