Metric Types
PRISM supports various metric types to represent different kinds of measurements.
Available Metric Types
| Type | Constant | Description | Example |
|---|---|---|---|
| Coverage | coverage |
Percentage of coverage | Test coverage |
| Rate | rate |
Frequency or percentage | Error rate, availability |
| Latency | latency |
Time duration | P99 latency, MTTR |
| Ratio | ratio |
Proportion | Success ratio |
| Count | count |
Absolute count | Deployment count |
| Distribution | distribution |
Statistical distribution | Latency percentiles |
| Score | score |
Composite score | Health score |
Coverage
Coverage metrics measure the extent of coverage for a control or practice.
Characteristics
- Range: 0-100%
- Trend direction:
higher_better - Common unit:
%
Examples
{
"id": "ops-test-coverage",
"name": "Test Coverage",
"metricType": "coverage",
"trendDirection": "higher_better",
"unit": "%",
"current": 85,
"target": 95
}
Rate
Rate metrics measure frequency or percentage over time.
Characteristics
- Can be percentages (0-100%) or counts per time period
- Trend direction varies by metric
- Common units:
%,per hour,per day
Examples
{
"id": "ops-availability",
"name": "Service Availability",
"metricType": "rate",
"trendDirection": "higher_better",
"unit": "%",
"current": 99.95,
"target": 99.99
}
{
"id": "ops-error-rate",
"name": "Error Rate",
"metricType": "rate",
"trendDirection": "lower_better",
"unit": "%",
"current": 0.1,
"target": 0.01
}
Latency
Latency metrics measure time duration, typically for response times or recovery.
Characteristics
- Trend direction: Usually
lower_better - Common units:
ms,seconds,minutes,hours,days
Examples
{
"id": "ops-p99-latency",
"name": "P99 Latency",
"metricType": "latency",
"trendDirection": "lower_better",
"unit": "ms",
"current": 250,
"target": 200
}
{
"id": "ops-mttr",
"name": "Mean Time to Recovery",
"metricType": "latency",
"trendDirection": "lower_better",
"unit": "hours",
"current": 2,
"target": 1
}
Ratio
Ratio metrics measure proportions, often as decimals or percentages.
Characteristics
- Range: 0-1 (decimal) or 0-100 (percentage)
- Trend direction varies
- Common units: none,
%
Examples
{
"id": "ops-success-ratio",
"name": "Request Success Ratio",
"metricType": "ratio",
"trendDirection": "higher_better",
"current": 0.998,
"target": 0.999
}
Count
Count metrics measure absolute numbers.
Characteristics
- Integer values
- Trend direction varies by metric
- No unit or custom unit
Examples
{
"id": "ops-deploy-count",
"name": "Daily Deployments",
"metricType": "count",
"trendDirection": "higher_better",
"unit": "/day",
"current": 5,
"target": 10
}
{
"id": "ops-incident-count",
"name": "Open Incidents",
"metricType": "count",
"trendDirection": "lower_better",
"current": 3,
"target": 0
}
Distribution
Distribution metrics capture statistical distributions, often with percentiles.
Characteristics
- Multiple values (p50, p90, p99, etc.)
- Typically used with
dataPointsarray - Trend direction usually
lower_betterfor latency distributions
Examples
{
"id": "ops-latency-distribution",
"name": "Latency Distribution",
"metricType": "distribution",
"trendDirection": "lower_better",
"unit": "ms",
"dataPoints": [
{"timestamp": "2024-01-01T00:00:00Z", "value": 50, "label": "p50"},
{"timestamp": "2024-01-01T00:00:00Z", "value": 150, "label": "p90"},
{"timestamp": "2024-01-01T00:00:00Z", "value": 250, "label": "p99"}
]
}
Score
Score metrics represent composite or aggregated scores.
Characteristics
- Range: Typically 0-100 or 0-1
- May be computed from other metrics
- Trend direction:
higher_better
Examples
{
"id": "ops-health-score",
"name": "Service Health Score",
"metricType": "score",
"trendDirection": "higher_better",
"current": 85,
"target": 95
}
Trend Directions
| Direction | Constant | Description |
|---|---|---|
| Higher Better | higher_better |
Higher values indicate improvement |
| Lower Better | lower_better |
Lower values indicate improvement |
| Target Value | target_value |
Target a specific value |
Choosing Trend Direction
| Metric Type | Typical Direction |
|---|---|
| Coverage | higher_better |
| Availability | higher_better |
| Error Rate | lower_better |
| Latency | lower_better |
| MTTR | lower_better |
| Deployment Frequency | higher_better |
| Health Score | higher_better |