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 pipeline steps by the stage a record was taken from", }, []string{"stage", "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"}, ) // Время конвертации файлов (в секундах) InputFileDurationHistogram = promauto.NewHistogramVec( prometheus.HistogramOpts{ Name: "transcriber_input_file_duration_seconds", Help: "Duration of input audio file", Buckets: []float64{15, 30, 60, 120, 300, 600, 1200, 1800, 2400, 3000, 3600, 7200, 10800, 14400}, }, []string{}, ) // Время конвертации файлов (в секундах) 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"}, ) // Поднят ли вход приёма. Метка ставится только тому входу, который у сервиса // есть; вход остался один, и метки убранного здесь не появляется — ноль рядом // с ним читался бы как поломка, а вечная единица — как исправность того, чего // нет. Различать поднятый и неподнятый признак снова станет, когда входов // снова станет больше одного. IntakeUpGauge = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "transcriber_intake_up", Help: "Whether an intake channel is up (1) or not (0)", }, []string{"channel"}, ) // Размер файла после конвертации (в байтах) 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"}, ) )