Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Registry is the Prometheus registry for all metrics Registry = prometheus.NewRegistry() // General metrics RequestsTotal = factory.NewCounterVec( prometheus.CounterOpts{ Name: "service_layer_requests_total", Help: "Total number of API requests processed", }, []string{"method", "endpoint", "status"}, ) RequestDuration = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "service_layer_request_duration_seconds", Help: "Duration of API requests in seconds", Buckets: prometheus.ExponentialBuckets(0.001, 2, 15), }, []string{"method", "endpoint"}, ) // Function metrics FunctionExecutionsTotal = factory.NewCounterVec( prometheus.CounterOpts{ Name: "function_executions_total", Help: "Total number of function executions", }, []string{"status", "function_id"}, ) FunctionExecutionDuration = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "function_execution_duration_seconds", Help: "Duration of function executions in seconds", Buckets: prometheus.ExponentialBuckets(0.001, 2, 15), }, []string{"function_id"}, ) FunctionMemoryUsage = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "function_memory_usage_bytes", Help: "Memory usage of function executions in bytes", Buckets: prometheus.ExponentialBuckets(1024*1024, 2, 10), }, []string{"function_id"}, ) // Blockchain metrics BlockchainOperationsTotal = factory.NewCounterVec( prometheus.CounterOpts{ Name: "blockchain_operations_total", Help: "Total number of blockchain operations", }, []string{"operation", "status"}, ) BlockchainOperationDuration = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "blockchain_operation_duration_seconds", Help: "Duration of blockchain operations in seconds", Buckets: prometheus.ExponentialBuckets(0.01, 2, 10), }, []string{"operation"}, ) // TEE metrics TEEOperationsTotal = factory.NewCounterVec( prometheus.CounterOpts{ Name: "tee_operations_total", Help: "Total number of TEE operations", }, []string{"operation", "status"}, ) TEEAttestationDuration = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "tee_attestation_duration_seconds", Help: "Duration of TEE attestation in seconds", Buckets: prometheus.ExponentialBuckets(0.1, 2, 8), }, []string{"provider"}, ) // Secret management metrics SecretOperationsTotal = factory.NewCounterVec( prometheus.CounterOpts{ Name: "secret_operations_total", Help: "Total number of secret operations", }, []string{"operation", "status"}, ) SecretOperationDuration = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "secret_operation_duration_seconds", Help: "Duration of secret operations in seconds", Buckets: prometheus.ExponentialBuckets(0.001, 2, 10), }, []string{"operation"}, ) // Database metrics DatabaseOperationsTotal = factory.NewCounterVec( prometheus.CounterOpts{ Name: "database_operations_total", Help: "Total number of database operations", }, []string{"operation", "repository", "status"}, ) DatabaseOperationDuration = factory.NewHistogramVec( prometheus.HistogramOpts{ Name: "database_operation_duration_seconds", Help: "Duration of database operations in seconds", Buckets: prometheus.ExponentialBuckets(0.0005, 2, 12), }, []string{"operation", "repository"}, ) // System metrics MemoryUsage = factory.NewGauge( prometheus.GaugeOpts{ Name: "system_memory_usage_bytes", Help: "Current memory usage of the service", }, ) GoroutinesCount = factory.NewGauge( prometheus.GaugeOpts{ Name: "system_goroutines_count", Help: "Current number of goroutines", }, ) OpenConnections = factory.NewGaugeVec( prometheus.GaugeOpts{ Name: "system_open_connections", Help: "Current number of open connections", }, []string{"type"}, ) // Rate limiting metrics RateLimitExceededTotal = factory.NewCounter( prometheus.CounterOpts{ Name: "rate_limit_exceeded_total", Help: "Total number of requests that exceeded the rate limit", }, ) )
View Source
var ( // Memory heap metrics MemoryHeapAlloc = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_memory_heap_alloc_bytes", Help: "Current heap memory allocation in bytes", }) MemoryHeapSys = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_memory_heap_sys_bytes", Help: "Current heap memory reserved by the system in bytes", }) MemoryHeapObjects = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_memory_heap_objects", Help: "Current number of allocated heap objects", }) MemoryGCSys = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_memory_gc_sys_bytes", Help: "Memory used by the garbage collector in bytes", }) GCCount = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_gc_count", Help: "Number of completed garbage collection cycles", }) // System memory metrics SystemMemoryTotal = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_system_memory_total_bytes", Help: "Total system memory in bytes", }) SystemMemoryUsed = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_system_memory_used_bytes", Help: "Used system memory in bytes", }) SystemMemoryFree = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_system_memory_free_bytes", Help: "Free system memory in bytes", }) // Process memory metrics ProcessMemoryRSS = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_process_memory_rss_bytes", Help: "Resident set size (RSS) of the process in bytes", }) ProcessMemoryVMS = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_process_memory_vms_bytes", Help: "Virtual memory size of the process in bytes", }) )
System memory metrics
View Source
var ( // System CPU metrics SystemCPUUsage = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_system_cpu_usage_percent", Help: "System CPU usage percentage (0-100)", }) // Process CPU metrics ProcessCPUUsage = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_process_cpu_usage_percent", Help: "Process CPU usage percentage (0-100)", }) )
CPU metrics
View Source
var ( DiskTotal = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_disk_total_bytes", Help: "Total disk space in bytes", }) DiskUsed = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_disk_used_bytes", Help: "Used disk space in bytes", }) DiskFree = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_disk_free_bytes", Help: "Free disk space in bytes", }) DiskUsagePercent = factory.NewGauge(prometheus.GaugeOpts{ Name: "service_layer_disk_usage_percent", Help: "Disk usage percentage (0-100)", }) )
Disk metrics
View Source
var (
ServiceUptimeSeconds = factory.NewGauge(prometheus.GaugeOpts{
Name: "service_layer_uptime_seconds",
Help: "Service uptime in seconds",
})
)
Uptime metrics
Functions ¶
This section is empty.
Types ¶
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer is a helper for measuring durations
func NewTimer ¶
func NewTimer(observer prometheus.Observer) *Timer
NewTimer creates a new timer that will observe the duration using the given observer
func (*Timer) ObserveDuration ¶
func (t *Timer) ObserveDuration()
ObserveDuration ends the timer and observes the duration
Click to show internal directories.
Click to hide internal directories.