metrics

package
v0.0.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TotalUsers = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "app_total_users",
			Help: "Total number of unique users.",
		},
	)

	TotalRecords = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "app_total_records",
			Help: "Total number of records.",
		},
	)

	TotalTokens = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "app_total_tokens",
			Help: "Total number of tokens.",
		},
	)

	ConversationDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "app_conversation_duration_seconds",
			Help:    "Duration of conversations in seconds.",
			Buckets: prometheus.DefBuckets,
		},
	)

	ImageDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "generate_image_duration_seconds",
			Help:    "generate image API requests in seconds.",
			Buckets: prometheus.DefBuckets,
		},
	)
)

define all metrics

Functions

func InitPprof

func InitPprof()

func RegisterMetrics

func RegisterMetrics()

RegisterMetrics register metrics

Types

type PProfServer

type PProfServer struct {
	Addr string
}

func NewPProfServer

func NewPProfServer(addr string) *PProfServer

NewPProfServer create http server, listen 36060 port.

func (*PProfServer) Start

func (p *PProfServer) Start()

Start start pprof server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL