Help us shape the future of Go! Take the 2026 Go Developer Survey

metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: "",
		Name:      "requests_total",
		Help:      "How many HTTP requests processed, partitioned by status code and HTTP method.",
	}, []string{"code", "method", "path"})

	RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: "",
		Name:      "request_duration_seconds",
		Help:      "The HTTP request latencies in seconds.",
	}, []string{"code", "method", "path"})
)

Functions

func CollectRequestMetrics

func CollectRequestMetrics() gin.HandlerFunc

CollectRequestMetrics is the middleware to collect metrics for the request.

Types

type Interactor

type Interactor interface {
	CountActiveRepos(ctx context.Context) (int, error)
	CountRepos(ctx context.Context) (int, error)
	ListAllDeploymentStatistics(ctx context.Context) ([]*ent.DeploymentStatistics, error)
	ListDeploymentStatisticsGreaterThanTime(ctx context.Context, updated time.Time) ([]*ent.DeploymentStatistics, error)
	GetLicense(ctx context.Context) (*extent.License, error)
}

type Metric

type Metric struct {
	// contains filtered or unexported fields
}

func NewMetric

func NewMetric(c *MetricConfig) *Metric

func (*Metric) CollectMetrics

func (m *Metric) CollectMetrics(c *gin.Context)

type MetricConfig

type MetricConfig struct {
	Interactor
	PrometheusAuthSecret string
}

Jump to

Keyboard shortcuts

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