summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-12-30 23:00:27 +0200
committerPaul Buetow <paul@buetow.org>2025-12-30 23:00:27 +0200
commit873957d4e818a6117836486d6ea7258c3f79e1d2 (patch)
tree17c6409bfd7ad3527ab11c5ccf6273543da8a530
parent9716cd2b6847b78891958de14ac5d8e1032c485b (diff)
Rename test metrics with clear prefix and add Grafana dashboard
Renamed all test metrics with "prometheus_pusher_test_" prefix to clearly indicate they are generated by the prometheus-pusher testing/demo functionality. Metric renaming: - app_requests_total → prometheus_pusher_test_requests_total - app_active_connections → prometheus_pusher_test_active_connections - app_temperature_celsius → prometheus_pusher_test_temperature_celsius - app_request_duration_seconds → prometheus_pusher_test_request_duration_seconds - app_jobs_processed_total → prometheus_pusher_test_jobs_processed_total Grafana Dashboard: - Created comprehensive dashboard with 8 panels - Request rate and total requests visualization - Active connections gauge (0-100 with thresholds) - Temperature gauge (0-50°C with thresholds) - Request duration percentiles (p50, p90, p99) - Average request duration stat - Jobs processed by type (bar gauge) - Jobs status breakdown table - Auto-refresh every 10s, 15-minute default time range Files added: - grafana-dashboard.json: Dashboard definition - deploy-dashboard.sh: Automated deployment script - DASHBOARD.md: Complete dashboard documentation Updated: - internal/metrics/generator.go: Renamed metric names - internal/ingester/remotewrite.go: Updated historic metric names - internal/ingester/remotewrite_test.go: Updated test expectations Tests updated and passing with 63.9% coverage maintained. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
-rw-r--r--f3s/prometheus-pusher/DASHBOARD.md151
-rwxr-xr-xf3s/prometheus-pusher/deploy-dashboard.sh55
-rw-r--r--f3s/prometheus-pusher/grafana-dashboard.json274
-rw-r--r--f3s/prometheus-pusher/internal/ingester/remotewrite.go16
-rw-r--r--f3s/prometheus-pusher/internal/ingester/remotewrite_test.go14
-rw-r--r--f3s/prometheus-pusher/internal/metrics/generator.go24
-rwxr-xr-xf3s/prometheus-pusher/prometheus-pusherbin14053904 -> 14053936 bytes
7 files changed, 508 insertions, 26 deletions
diff --git a/f3s/prometheus-pusher/DASHBOARD.md b/f3s/prometheus-pusher/DASHBOARD.md
new file mode 100644
index 0000000..47888ff
--- /dev/null
+++ b/f3s/prometheus-pusher/DASHBOARD.md
@@ -0,0 +1,151 @@
+# Grafana Dashboard for Prometheus Pusher Test Metrics
+
+This document describes the Grafana dashboard for visualizing metrics generated by prometheus-pusher.
+
+## Dashboard Overview
+
+The dashboard displays all test metrics with the `prometheus_pusher_test_` prefix, making it clear they are generated by the prometheus-pusher testing/demo functionality.
+
+## Metrics Displayed
+
+### 1. Request Rate
+- **Type**: Line graph
+- **Metric**: `rate(prometheus_pusher_test_requests_total[5m])`
+- **Description**: Shows the rate of requests per second over the last 5 minutes
+- **Use**: Monitor request throughput
+
+### 2. Total Requests
+- **Type**: Stat panel
+- **Metric**: `prometheus_pusher_test_requests_total`
+- **Description**: Counter showing total number of requests processed
+- **Display**: Large number with area graph background
+
+### 3. Active Connections
+- **Type**: Gauge
+- **Metric**: `prometheus_pusher_test_active_connections`
+- **Description**: Current number of active connections (0-100)
+- **Thresholds**:
+ - Green: 0-50
+ - Yellow: 50-80
+ - Red: 80-100
+
+### 4. Temperature
+- **Type**: Gauge
+- **Metric**: `prometheus_pusher_test_temperature_celsius`
+- **Description**: Current temperature in Celsius (0-50°C)
+- **Thresholds**:
+ - Blue: 0-20°C
+ - Green: 20-30°C
+ - Yellow: 30-35°C
+ - Red: 35-50°C
+
+### 5. Request Duration Histogram
+- **Type**: Line graph
+- **Metrics**:
+ - `histogram_quantile(0.50, rate(prometheus_pusher_test_request_duration_seconds_bucket[5m]))` - p50
+ - `histogram_quantile(0.90, rate(prometheus_pusher_test_request_duration_seconds_bucket[5m]))` - p90
+ - `histogram_quantile(0.99, rate(prometheus_pusher_test_request_duration_seconds_bucket[5m]))` - p99
+- **Description**: Shows request duration percentiles over time
+- **Use**: Identify latency trends and outliers
+
+### 6. Average Request Duration
+- **Type**: Stat panel
+- **Metric**: `rate(prometheus_pusher_test_request_duration_seconds_sum[5m]) / rate(prometheus_pusher_test_request_duration_seconds_count[5m])`
+- **Description**: Average request duration in seconds
+- **Display**: Number with area graph, 3 decimal places
+
+### 7. Jobs Processed by Type
+- **Type**: Bar gauge
+- **Metric**: `sum by (job_type) (prometheus_pusher_test_jobs_processed_total)`
+- **Description**: Total jobs processed grouped by job type (email, report, backup)
+- **Display**: Horizontal gradient bars
+
+### 8. Jobs Status Breakdown
+- **Type**: Table
+- **Metric**: `prometheus_pusher_test_jobs_processed_total`
+- **Description**: Detailed breakdown showing job type, status, and count
+- **Columns**: Job Type, Status, Count
+
+## Deployment
+
+### Prerequisites
+- Grafana instance running and accessible
+- Prometheus as a data source in Grafana
+- Metrics being pushed to Prometheus via prometheus-pusher
+
+### Deploy via Script
+```bash
+# Port-forward to Grafana (if running in Kubernetes)
+kubectl port-forward -n monitoring svc/prometheus-grafana 3000:80
+
+# Deploy dashboard (in another terminal)
+./deploy-dashboard.sh
+```
+
+### Deploy Manually
+1. Open Grafana UI
+2. Go to Dashboards → Import
+3. Upload `grafana-dashboard.json`
+4. Select Prometheus data source
+5. Click Import
+
+### Custom Deployment
+```bash
+# With custom Grafana URL and credentials
+GRAFANA_URL="http://grafana.example.com" \
+GRAFANA_USER="admin" \
+GRAFANA_PASSWORD="secret" \
+./deploy-dashboard.sh
+```
+
+## Dashboard Features
+
+- **Auto-refresh**: Updates every 10 seconds
+- **Time range**: Last 15 minutes by default
+- **Refresh intervals**: 5s, 10s, 30s, 1m, 5m
+- **Shared tooltips**: Hover over graphs to see all series values
+- **Dark theme**: Optimized for dark mode viewing
+
+## Metric Naming Convention
+
+All metrics use the `prometheus_pusher_test_` prefix to:
+- Clearly identify them as test/demo metrics
+- Distinguish from production application metrics
+- Make cleanup and filtering easier
+- Prevent confusion with real application data
+
+## Testing the Dashboard
+
+1. **Push test metrics**:
+ ```bash
+ ./prometheus-pusher -mode realtime -pushgateway http://localhost:9091
+ ```
+
+2. **Continuous updates** (for live dashboard testing):
+ ```bash
+ ./prometheus-pusher -mode realtime -pushgateway http://localhost:9091 -continuous
+ ```
+
+3. **View in Grafana**:
+ - Navigate to the "Prometheus Pusher Test Metrics" dashboard
+ - Watch metrics update in real-time
+ - Interact with time ranges and refresh intervals
+
+## Cleanup
+
+To remove old test metrics from Pushgateway:
+```bash
+# Delete all metrics for the example_metrics_pusher job
+curl -X DELETE http://localhost:9091/metrics/job/example_metrics_pusher
+```
+
+## Customization
+
+The dashboard JSON file can be customized:
+- Adjust panel sizes via `gridPos`
+- Change colors and thresholds
+- Add new panels for additional metrics
+- Modify queries and aggregations
+- Update refresh intervals
+
+After making changes, redeploy using the deployment script.
diff --git a/f3s/prometheus-pusher/deploy-dashboard.sh b/f3s/prometheus-pusher/deploy-dashboard.sh
new file mode 100755
index 0000000..32b12af
--- /dev/null
+++ b/f3s/prometheus-pusher/deploy-dashboard.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# Deploy Prometheus Pusher Test Metrics dashboard to Grafana
+
+set -e
+
+GRAFANA_URL="${GRAFANA_URL:-http://localhost:3000}"
+GRAFANA_USER="${GRAFANA_USER:-admin}"
+GRAFANA_PASSWORD="${GRAFANA_PASSWORD:-admin}"
+
+echo "=== Deploying Prometheus Pusher Test Metrics Dashboard ==="
+echo "Grafana URL: $GRAFANA_URL"
+echo ""
+
+# Check if Grafana is accessible
+if ! curl -sf "${GRAFANA_URL}/api/health" > /dev/null; then
+ echo "Error: Cannot reach Grafana at $GRAFANA_URL"
+ echo "Make sure Grafana is running and accessible"
+ echo ""
+ echo "If running in Kubernetes, port-forward first:"
+ echo " kubectl port-forward -n monitoring svc/prometheus-grafana 3000:80"
+ exit 1
+fi
+
+echo "✅ Grafana is accessible"
+echo ""
+
+# Import dashboard
+echo "Importing dashboard..."
+RESPONSE=$(curl -sf -X POST \
+ -H "Content-Type: application/json" \
+ -u "${GRAFANA_USER}:${GRAFANA_PASSWORD}" \
+ -d @grafana-dashboard.json \
+ "${GRAFANA_URL}/api/dashboards/db")
+
+if [ $? -eq 0 ]; then
+ DASHBOARD_UID=$(echo "$RESPONSE" | grep -o '"uid":"[^"]*"' | cut -d'"' -f4)
+ DASHBOARD_URL="${GRAFANA_URL}/d/${DASHBOARD_UID}/prometheus-pusher-test-metrics"
+
+ echo "✅ Dashboard imported successfully!"
+ echo ""
+ echo "Dashboard URL: $DASHBOARD_URL"
+ echo ""
+ echo "The dashboard shows:"
+ echo " - Request rate and total requests"
+ echo " - Active connections gauge"
+ echo " - Temperature gauge"
+ echo " - Request duration percentiles (p50, p90, p99)"
+ echo " - Average request duration"
+ echo " - Jobs processed by type"
+ echo " - Jobs status breakdown table"
+else
+ echo "❌ Failed to import dashboard"
+ echo "Response: $RESPONSE"
+ exit 1
+fi
diff --git a/f3s/prometheus-pusher/grafana-dashboard.json b/f3s/prometheus-pusher/grafana-dashboard.json
new file mode 100644
index 0000000..85cd701
--- /dev/null
+++ b/f3s/prometheus-pusher/grafana-dashboard.json
@@ -0,0 +1,274 @@
+{
+ "dashboard": {
+ "id": null,
+ "uid": "prometheus-pusher-test",
+ "title": "Prometheus Pusher Test Metrics",
+ "tags": ["prometheus-pusher", "test", "demo"],
+ "timezone": "browser",
+ "schemaVersion": 38,
+ "version": 1,
+ "refresh": "10s",
+ "panels": [
+ {
+ "id": 1,
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
+ "type": "graph",
+ "title": "Request Rate",
+ "targets": [
+ {
+ "expr": "rate(prometheus_pusher_test_requests_total[5m])",
+ "legendFormat": "Requests/sec",
+ "refId": "A"
+ }
+ ],
+ "yaxes": [
+ {"format": "reqps", "label": "Requests per Second"},
+ {"format": "short"}
+ ],
+ "xaxis": {"mode": "time"},
+ "lines": true,
+ "fill": 1,
+ "linewidth": 2,
+ "pointradius": 5,
+ "tooltip": {"shared": true}
+ },
+ {
+ "id": 2,
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
+ "type": "stat",
+ "title": "Total Requests",
+ "targets": [
+ {
+ "expr": "prometheus_pusher_test_requests_total",
+ "legendFormat": "Total",
+ "refId": "A"
+ }
+ ],
+ "options": {
+ "graphMode": "area",
+ "colorMode": "value",
+ "justifyMode": "auto",
+ "textMode": "auto",
+ "reduceOptions": {
+ "values": false,
+ "calcs": ["lastNotNull"]
+ }
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {"mode": "palette-classic"},
+ "unit": "short"
+ }
+ }
+ },
+ {
+ "id": 3,
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 8},
+ "type": "gauge",
+ "title": "Active Connections",
+ "targets": [
+ {
+ "expr": "prometheus_pusher_test_active_connections",
+ "legendFormat": "Connections",
+ "refId": "A"
+ }
+ ],
+ "options": {
+ "showThresholdLabels": false,
+ "showThresholdMarkers": true
+ },
+ "fieldConfig": {
+ "defaults": {
+ "min": 0,
+ "max": 100,
+ "color": {"mode": "thresholds"},
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {"value": 0, "color": "green"},
+ {"value": 50, "color": "yellow"},
+ {"value": 80, "color": "red"}
+ ]
+ },
+ "unit": "short"
+ }
+ }
+ },
+ {
+ "id": 4,
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 8},
+ "type": "gauge",
+ "title": "Temperature (°C)",
+ "targets": [
+ {
+ "expr": "prometheus_pusher_test_temperature_celsius",
+ "legendFormat": "°C",
+ "refId": "A"
+ }
+ ],
+ "options": {
+ "showThresholdLabels": false,
+ "showThresholdMarkers": true
+ },
+ "fieldConfig": {
+ "defaults": {
+ "min": 0,
+ "max": 50,
+ "color": {"mode": "thresholds"},
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {"value": 0, "color": "blue"},
+ {"value": 20, "color": "green"},
+ {"value": 30, "color": "yellow"},
+ {"value": 35, "color": "red"}
+ ]
+ },
+ "unit": "celsius"
+ }
+ }
+ },
+ {
+ "id": 5,
+ "gridPos": {"h": 8, "w": 24, "x": 0, "y": 16},
+ "type": "graph",
+ "title": "Request Duration Histogram",
+ "targets": [
+ {
+ "expr": "histogram_quantile(0.50, rate(prometheus_pusher_test_request_duration_seconds_bucket[5m]))",
+ "legendFormat": "p50",
+ "refId": "A"
+ },
+ {
+ "expr": "histogram_quantile(0.90, rate(prometheus_pusher_test_request_duration_seconds_bucket[5m]))",
+ "legendFormat": "p90",
+ "refId": "B"
+ },
+ {
+ "expr": "histogram_quantile(0.99, rate(prometheus_pusher_test_request_duration_seconds_bucket[5m]))",
+ "legendFormat": "p99",
+ "refId": "C"
+ }
+ ],
+ "yaxes": [
+ {"format": "s", "label": "Duration"},
+ {"format": "short"}
+ ],
+ "xaxis": {"mode": "time"},
+ "lines": true,
+ "fill": 1,
+ "linewidth": 2,
+ "tooltip": {"shared": true}
+ },
+ {
+ "id": 6,
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 24},
+ "type": "stat",
+ "title": "Average Request Duration",
+ "targets": [
+ {
+ "expr": "rate(prometheus_pusher_test_request_duration_seconds_sum[5m]) / rate(prometheus_pusher_test_request_duration_seconds_count[5m])",
+ "legendFormat": "Avg Duration",
+ "refId": "A"
+ }
+ ],
+ "options": {
+ "graphMode": "area",
+ "colorMode": "value",
+ "textMode": "auto",
+ "reduceOptions": {
+ "values": false,
+ "calcs": ["lastNotNull"]
+ }
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {"mode": "palette-classic"},
+ "unit": "s",
+ "decimals": 3
+ }
+ }
+ },
+ {
+ "id": 7,
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 24},
+ "type": "bargauge",
+ "title": "Jobs Processed by Type",
+ "targets": [
+ {
+ "expr": "sum by (job_type) (prometheus_pusher_test_jobs_processed_total)",
+ "legendFormat": "{{job_type}}",
+ "refId": "A"
+ }
+ ],
+ "options": {
+ "orientation": "horizontal",
+ "displayMode": "gradient",
+ "showUnfilled": true
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {"mode": "palette-classic"},
+ "unit": "short"
+ }
+ }
+ },
+ {
+ "id": 8,
+ "gridPos": {"h": 8, "w": 24, "x": 0, "y": 32},
+ "type": "table",
+ "title": "Jobs Status Breakdown",
+ "targets": [
+ {
+ "expr": "prometheus_pusher_test_jobs_processed_total",
+ "legendFormat": "",
+ "refId": "A",
+ "format": "table",
+ "instant": true
+ }
+ ],
+ "options": {
+ "showHeader": true
+ },
+ "fieldConfig": {
+ "defaults": {},
+ "overrides": []
+ },
+ "transformations": [
+ {
+ "id": "organize",
+ "options": {
+ "excludeByName": {
+ "Time": true,
+ "__name__": true,
+ "instance": true,
+ "job": true
+ },
+ "indexByName": {},
+ "renameByName": {
+ "job_type": "Job Type",
+ "status": "Status",
+ "Value": "Count"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "time": {"from": "now-15m", "to": "now"},
+ "timepicker": {
+ "refresh_intervals": ["5s", "10s", "30s", "1m", "5m"]
+ },
+ "templating": {"list": []},
+ "annotations": {"list": []},
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 1,
+ "links": [],
+ "liveNow": false,
+ "style": "dark"
+ },
+ "overwrite": true,
+ "folderUid": "",
+ "message": "Prometheus Pusher Test Metrics Dashboard - Auto-generated"
+}
diff --git a/f3s/prometheus-pusher/internal/ingester/remotewrite.go b/f3s/prometheus-pusher/internal/ingester/remotewrite.go
index ee5bd65..c88cff6 100644
--- a/f3s/prometheus-pusher/internal/ingester/remotewrite.go
+++ b/f3s/prometheus-pusher/internal/ingester/remotewrite.go
@@ -164,9 +164,9 @@ func generateHistoricTimeSeries(timestamp time.Time) []prompb.TimeSeries {
{Name: "job", Value: "historic_data"},
}
- timeSeries = append(timeSeries, createCounterSeries("app_requests_total", baseLabels, float64(rand.Intn(100)+1), timestampMs))
- timeSeries = append(timeSeries, createGaugeSeries("app_active_connections", baseLabels, float64(rand.Intn(100)), timestampMs))
- timeSeries = append(timeSeries, createGaugeSeries("app_temperature_celsius", baseLabels, 15+rand.Float64()*20, timestampMs))
+ timeSeries = append(timeSeries, createCounterSeries("prometheus_pusher_test_requests_total", baseLabels, float64(rand.Intn(100)+1), timestampMs))
+ timeSeries = append(timeSeries, createGaugeSeries("prometheus_pusher_test_active_connections", baseLabels, float64(rand.Intn(100)), timestampMs))
+ timeSeries = append(timeSeries, createGaugeSeries("prometheus_pusher_test_temperature_celsius", baseLabels, 15+rand.Float64()*20, timestampMs))
timeSeries = append(timeSeries, generateHistogramSeries(baseLabels, timestampMs)...)
timeSeries = append(timeSeries, generateLabeledCounterSeries(baseLabels, timestampMs)...)
@@ -199,7 +199,7 @@ func generateHistogramSeries(baseLabels []prompb.Label, timestamp int64) []promp
for _, bucket := range buckets {
cumulativeCount += rand.Intn(5)
labels := []prompb.Label{
- {Name: "__name__", Value: "app_request_duration_seconds_bucket"},
+ {Name: "__name__", Value: "prometheus_pusher_test_request_duration_seconds_bucket"},
{Name: "le", Value: fmt.Sprintf("%g", bucket)},
}
labels = append(labels, baseLabels...)
@@ -211,7 +211,7 @@ func generateHistogramSeries(baseLabels []prompb.Label, timestamp int64) []promp
}
infLabels := []prompb.Label{
- {Name: "__name__", Value: "app_request_duration_seconds_bucket"},
+ {Name: "__name__", Value: "prometheus_pusher_test_request_duration_seconds_bucket"},
{Name: "le", Value: "+Inf"},
}
infLabels = append(infLabels, baseLabels...)
@@ -220,8 +220,8 @@ func generateHistogramSeries(baseLabels []prompb.Label, timestamp int64) []promp
Samples: []prompb.Sample{{Value: float64(cumulativeCount), Timestamp: timestamp}},
})
- series = append(series, createCounterSeries("app_request_duration_seconds_sum", baseLabels, rand.Float64()*100, timestamp))
- series = append(series, createCounterSeries("app_request_duration_seconds_count", baseLabels, float64(cumulativeCount), timestamp))
+ series = append(series, createCounterSeries("prometheus_pusher_test_request_duration_seconds_sum", baseLabels, rand.Float64()*100, timestamp))
+ series = append(series, createCounterSeries("prometheus_pusher_test_request_duration_seconds_count", baseLabels, float64(cumulativeCount), timestamp))
return series
}
@@ -235,7 +235,7 @@ func generateLabeledCounterSeries(baseLabels []prompb.Label, timestamp int64) []
for _, jobType := range jobTypes {
for _, status := range statuses {
labels := []prompb.Label{
- {Name: "__name__", Value: "app_jobs_processed_total"},
+ {Name: "__name__", Value: "prometheus_pusher_test_jobs_processed_total"},
{Name: "job_type", Value: jobType},
{Name: "status", Value: status},
}
diff --git a/f3s/prometheus-pusher/internal/ingester/remotewrite_test.go b/f3s/prometheus-pusher/internal/ingester/remotewrite_test.go
index 5d386ef..2f375dc 100644
--- a/f3s/prometheus-pusher/internal/ingester/remotewrite_test.go
+++ b/f3s/prometheus-pusher/internal/ingester/remotewrite_test.go
@@ -83,10 +83,10 @@ func TestGenerateHistoricTimeSeries(t *testing.T) {
}
expectedMetrics := []string{
- "app_requests_total",
- "app_active_connections",
- "app_temperature_celsius",
- "app_jobs_processed_total",
+ "prometheus_pusher_test_requests_total",
+ "prometheus_pusher_test_active_connections",
+ "prometheus_pusher_test_temperature_celsius",
+ "prometheus_pusher_test_jobs_processed_total",
}
for _, expected := range expectedMetrics {
@@ -159,13 +159,13 @@ func TestGenerateHistogramSeries(t *testing.T) {
}
}
- if metricTypes["app_request_duration_seconds_bucket"] == 0 {
+ if metricTypes["prometheus_pusher_test_request_duration_seconds_bucket"] == 0 {
t.Error("Expected histogram buckets")
}
- if metricTypes["app_request_duration_seconds_sum"] != 1 {
+ if metricTypes["prometheus_pusher_test_request_duration_seconds_sum"] != 1 {
t.Error("Expected histogram sum")
}
- if metricTypes["app_request_duration_seconds_count"] != 1 {
+ if metricTypes["prometheus_pusher_test_request_duration_seconds_count"] != 1 {
t.Error("Expected histogram count")
}
}
diff --git a/f3s/prometheus-pusher/internal/metrics/generator.go b/f3s/prometheus-pusher/internal/metrics/generator.go
index 2b5c739..3ad7fe4 100644
--- a/f3s/prometheus-pusher/internal/metrics/generator.go
+++ b/f3s/prometheus-pusher/internal/metrics/generator.go
@@ -27,38 +27,40 @@ type Collectors struct {
JobsProcessed *prometheus.CounterVec
}
-// NewCollectors creates new Prometheus metric collectors
+// NewCollectors creates new Prometheus metric collectors for testing.
+// All metrics are prefixed with "prometheus_pusher_test_" to clearly indicate
+// they are generated by the prometheus-pusher test/demo functionality.
func NewCollectors() Collectors {
return Collectors{
RequestsTotal: prometheus.NewCounter(
prometheus.CounterOpts{
- Name: "app_requests_total",
- Help: "Total number of requests processed",
+ Name: "prometheus_pusher_test_requests_total",
+ Help: "Total number of requests processed (test metric)",
},
),
ActiveConnections: prometheus.NewGauge(
prometheus.GaugeOpts{
- Name: "app_active_connections",
- Help: "Number of currently active connections",
+ Name: "prometheus_pusher_test_active_connections",
+ Help: "Number of currently active connections (test metric)",
},
),
TemperatureCelsius: prometheus.NewGauge(
prometheus.GaugeOpts{
- Name: "app_temperature_celsius",
- Help: "Current temperature in Celsius",
+ Name: "prometheus_pusher_test_temperature_celsius",
+ Help: "Current temperature in Celsius (test metric)",
},
),
RequestDuration: prometheus.NewHistogram(
prometheus.HistogramOpts{
- Name: "app_request_duration_seconds",
- Help: "Histogram of request duration in seconds",
+ Name: "prometheus_pusher_test_request_duration_seconds",
+ Help: "Histogram of request duration in seconds (test metric)",
Buckets: prometheus.DefBuckets,
},
),
JobsProcessed: prometheus.NewCounterVec(
prometheus.CounterOpts{
- Name: "app_jobs_processed_total",
- Help: "Total number of jobs processed by type",
+ Name: "prometheus_pusher_test_jobs_processed_total",
+ Help: "Total number of jobs processed by type (test metric)",
},
[]string{"job_type", "status"},
),
diff --git a/f3s/prometheus-pusher/prometheus-pusher b/f3s/prometheus-pusher/prometheus-pusher
index a431693..725c1af 100755
--- a/f3s/prometheus-pusher/prometheus-pusher
+++ b/f3s/prometheus-pusher/prometheus-pusher
Binary files differ