package sender

import (
	"git.k-space.ee/k-space/logmower-shipper/pkg/globals"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promauto"
)

const promSubsystem = "shipper"

var (
	promShipperQueued = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
		Name:      "shipper_record",         // "queued",
		Help:      "Log records in queue to be batched and sent to database",
	}, []string{"filename"})
	promShipperDbSent = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
		Name:      "record",                 // "sent",
		Help:      "Log records successfully committed to database",
	}, []string{"filename"})
	promShipperBatchSizeResult = promauto.NewHistogram(prometheus.HistogramOpts{
		Namespace: globals.PrometheusPrefix,  // Subsystem: promSubsystem,
		Name:      "bulk_submission_message", // "items_in_batch"
		Help:      "Batch size for database submissions",
		Buckets:   []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000},
	})
	promShipperDbSendError = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
		Name:      "insertion_error",        // "errors",
		Help:      "Failed database bulk insertions",
	}, []string{"filename"})
	promShipperSynced = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem,
		Name: "batches_synced",
		Help: "All batches available have been committed database (0 or 1)",
	}, []string{"filename"})
)
