Add prometheus metrics
This commit is contained in:
46
internal/metrics/metrics.go
Normal file
46
internal/metrics/metrics.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
var (
|
||||
WorkerJobCounter = promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: "transcriber_worker_job_count",
|
||||
Help: "Count of jobs handled by each worker",
|
||||
},
|
||||
[]string{"name", "error"},
|
||||
)
|
||||
|
||||
// Размер принятых на обработку файлов (в байтах)
|
||||
InputFileSizeHistogram = promauto.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Name: "transcriber_input_file_size_bytes",
|
||||
Help: "Size of input files received for processing",
|
||||
Buckets: []float64{1024, 10240, 102400, 1048576, 10485760, 104857600, 1073741824}, // 1KB, 10KB, 100KB, 1MB, 10MB, 100MB, 1GB
|
||||
},
|
||||
[]string{"file_extension"},
|
||||
)
|
||||
|
||||
// Время конвертации файлов (в секундах)
|
||||
ConversionDurationHistogram = promauto.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Name: "transcriber_conversion_duration_seconds",
|
||||
Help: "Time taken to convert audio files",
|
||||
Buckets: []float64{0.1, 0.5, 1, 5, 10, 30, 60, 120, 300}, // 0.1s, 0.5s, 1s, 5s, 10s, 30s, 1m, 2m, 5m
|
||||
},
|
||||
[]string{"source_format", "target_format", "error"},
|
||||
)
|
||||
|
||||
// Размер файла после конвертации (в байтах)
|
||||
OutputFileSizeHistogram = promauto.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Name: "transcriber_output_file_size_bytes",
|
||||
Help: "Size of files after conversion",
|
||||
Buckets: []float64{1024, 10240, 102400, 1048576, 10485760, 104857600, 1073741824}, // 1KB, 10KB, 100KB, 1MB, 10MB, 100MB, 1GB
|
||||
},
|
||||
[]string{"format"},
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user