Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions server/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ func New(config *libconfig.MetricsConfig) *Metrics {
),
metricOperationsLatencyTotal: prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Subsystem: collectors.Subsystem,
Name: collectors.OperationsLatencyTotal.String(),
Help: "Latency in microseconds of CRI-O operations. Broken down by operation type.",
Subsystem: collectors.Subsystem,
Name: collectors.OperationsLatencyTotal.String(),
Help: "Latency in microseconds of CRI-O operations. Broken down by operation type.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{"operation_type"},
),
Expand Down
15 changes: 15 additions & 0 deletions test/metrics.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ function teardown() {
curl -sf "http://localhost:$PORT/metrics" | grep crio_operations
}

@test "metrics with operations quantile" {
# start crio with custom port
PORT=$(free_port)
CONTAINER_ENABLE_METRICS=true CONTAINER_METRICS_PORT=$PORT start_crio

for ((i = 0; i < 100; i++)); do
crictl version
done

# get metrics
curl -sf "http://localhost:$PORT/metrics" | grep 'container_runtime_crio_operations_latency_microseconds_total{operation_type="Version",quantile="0.5"}'
curl -sf "http://localhost:$PORT/metrics" | grep 'container_runtime_crio_operations_latency_microseconds_total{operation_type="Version",quantile="0.9"}'
curl -sf "http://localhost:$PORT/metrics" | grep 'container_runtime_crio_operations_latency_microseconds_total{operation_type="Version",quantile="0.99"}'
}

@test "secure metrics with random port" {
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
-subj "/C=US/ST=State/L=City/O=Org/CN=Name" \
Expand Down