Prometheus

LigningUserVault integrates with Prometheus via the gin-metrics middleware to provide real-time metrics about the application's performance and usage.

📝 Default Metrics

Upon deploying LigningUserVault, the following metrics are automatically tracked:

Metric
Type
Description

gin_request_total

Counter

Total number of requests received.

gin_request_uv

Counter

Total number of unique IPs that have made requests.

gin_uri_request_total

Counter

Number of requests for each URI.

gin_request_body_total

Counter

Total size of request bodies (in bytes).

gin_response_body_total

Counter

Total size of response bodies (in bytes).

gin_request_duration

Histogram

Time taken to handle each request.

gin_slow_request_total

Counter

Number of requests that exceeded the defined threshold for processing time.

⚙️ Custom Metrics

LigningUserVault also supports the addition of custom metrics tailored to specific monitoring needs. Here's an example of how a custom gauge metric can be added:

goCopy codegaugeMetric := &ginmetrics.Metric{
    Type:        ginmetrics.Gauge,
    Name:        "example_gauge_metric",
    Description: "an example of gauge type metric",
    Labels:      []string{"label1"},
}

// Add metric to global monitor object
_ = ginmetrics.GetMonitor().AddMetric(gaugeMetric)

🚀 Accessing Metrics

Metrics can be accessed via the /debug/metrics endpoint, regardless of whether LigningUserVault is started using Docker or run locally.

Last updated