Documentation
¶
Index ¶
- Constants
- Variables
- func ObserveActiveUser(userID int64)
- func ObserveDownloadFailure(source, reason string)
- func ObserveExtractionAttempt(source string, started time.Time, err error)
- func ObserveExtractionRequest(source string, err error)
- func ObserveTelegramDelivery(source, kind string, err error)
- func TrackDownload(source string, body io.ReadCloser) io.ReadCloser
Constants ¶
const ( OutcomeSuccess = "success" OutcomeFailure = "failure" ReasonNone = "none" ReasonTimeout = "timeout" ReasonCanceled = "canceled" ReasonOpen = "open" ReasonRead = "read" ReasonIncomplete = "incomplete" ReasonSizeLimit = "size_limit" ReasonTelegram = "telegram" ReasonOther = "other" )
Variables ¶
var ( InlineRequests = prometheus.NewCounter(prometheus.CounterOpts{ Name: "inline_requests_total", Help: "Total number of requests", }) PrivateMessageRequests = prometheus.NewCounter(prometheus.CounterOpts{ Name: "private_message_requests_total", Help: "Total number of private message requests", }) ExtractDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "extract_duration_seconds", Help: "Duration of media extraction by source.", Buckets: prometheus.DefBuckets, }, []string{"source"}) ExtractErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "extract_errors_total", Help: "Number of media extraction errors by source and kind.", }, []string{"source", "kind"}) TelegramSendErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "telegram_send_errors_total", Help: "Number of Telegram send errors by kind.", }, []string{"kind"}) MediaSizeBytes = prometheus.NewHistogram(prometheus.HistogramOpts{ Name: "media_size_bytes", Help: "Sizes of downloaded media items in bytes.", Buckets: prometheus.ExponentialBuckets(64*1024, 2, 12), }) MediaExtractionAttempts = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "media_extraction_attempts_total", Help: "Number of media extraction attempts, including retries.", }, []string{"source", "outcome", "reason"}) MediaExtractionRequests = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "media_extraction_requests_total", Help: "Final outcomes of logical media extraction requests after retries.", }, []string{"source", "outcome", "reason"}) MediaDownloads = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "media_downloads_total", Help: "Final outcomes of media objects downloaded by the bot.", }, []string{"source", "outcome", "reason"}) MediaDownloadBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "media_download_bytes_total", Help: "Bytes actually read by the bot from upstream media responses, including partial downloads.", }, []string{"source"}) MediaDownloadCompletedBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "media_download_completed_bytes_total", Help: "Bytes read for media objects that the bot downloaded completely.", }, []string{"source"}) TelegramDeliveries = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "telegram_deliveries_total", Help: "Final outcomes of media delivery operations to Telegram after retries.", }, []string{"source", "kind", "outcome", "reason"}) )
Functions ¶
func ObserveActiveUser ¶ added in v0.5.10
func ObserveActiveUser(userID int64)
ObserveActiveUser adds a Telegram sender to the process-local cardinality sketches. A zero ID is ignored because it means the update had no sender.
func ObserveDownloadFailure ¶ added in v0.5.10
func ObserveDownloadFailure(source, reason string)
ObserveDownloadFailure records a media object that the bot could not or did not download. reason is normalized to a bounded enum before becoming a label.
func ObserveExtractionAttempt ¶ added in v0.5.10
ObserveExtractionAttempt records one extractor call. Calls made by retries are deliberately counted separately from the final logical request result.
func ObserveExtractionRequest ¶ added in v0.5.10
ObserveExtractionRequest records the final result after all extraction retries for one logical caller request.
func ObserveTelegramDelivery ¶ added in v0.5.10
ObserveTelegramDelivery records the final Telegram API result after retries. Existing telegram_send_errors_total is maintained for compatibility.
func TrackDownload ¶ added in v0.5.10
func TrackDownload(source string, body io.ReadCloser) io.ReadCloser
TrackDownload wraps an upstream media body. It counts bytes as they are actually read and records success only after EOF. Closing before EOF is an incomplete download, even when the underlying Close succeeds.
Types ¶
This section is empty.