Skip to content

Exposed Metrics

The exporter exposes a standard /metrics HTTP endpoint that Prometheus can scrape.

To prevent Prometheus timeouts and browser race conditions, all metrics are cached. They are updated continuously by a background goroutine, and instantly served upon a scrape request.

All metrics are tagged with the service label configured in config.yaml, enabling seamless multi-tenant dashboarding.

Metric Reference

Metric NameTypeLabelsDescription
synthetic_http_status_codeGaugeservice, endpointThe HTTP response status code for the API endpoints (e.g., 200, 404). Returns -1 on network failure.
synthetic_ssl_cert_expiry_timestamp_secondsGaugeservice, endpointUnix timestamp (in seconds) of the TLS certificate expiration date. Returns -1 if no certificate is present.
synthetic_ui_step_duration_secondsGaugeservice, scenario, step, actionThe elapsed time in seconds it took to successfully complete a specific UI journey step.
synthetic_ui_journey_successGaugeservice, scenarioEmits 1 if the entire UI scenario passed successfully, and 0 if any single step failed.
synthetic_ui_journey_errors_totalCounterservice, scenario, step, error_type_nameThe total number of journey errors. It increments at the exact point of failure, tagged with your custom error_type_name.

Example Scrape Output

A realistic raw response from curl http://localhost:10050/metrics:

text
# HELP synthetic_http_status_code HTTP response status code returned by the API endpoint.
# TYPE synthetic_http_status_code gauge
synthetic_http_status_code{endpoint="https://my-e-commerce-app.example.com/api/health",service="my-e-commerce-app"} 200

# HELP synthetic_ssl_cert_expiry_timestamp_seconds Unix timestamp of the TLS certificate expiration date.
# TYPE synthetic_ssl_cert_expiry_timestamp_seconds gauge
synthetic_ssl_cert_expiry_timestamp_seconds{endpoint="https://my-e-commerce-app.example.com/api/health",service="my-e-commerce-app"} 1.7839584e+09

# HELP synthetic_ui_step_duration_seconds Elapsed time in seconds for each UI journey step.
# TYPE synthetic_ui_step_duration_seconds gauge
synthetic_ui_step_duration_seconds{action="goto",scenario="Login Flow",step="navigate_to_login",service="my-e-commerce-app"} 1.204
synthetic_ui_step_duration_seconds{action="fill",scenario="Login Flow",step="fill_username",service="my-e-commerce-app"} 0.087
synthetic_ui_step_duration_seconds{action="click",scenario="Login Flow",step="click_login_button",service="my-e-commerce-app"} 0.341

# HELP synthetic_ui_journey_success 1 if the full UI journey completed without errors, 0 otherwise.
# TYPE synthetic_ui_journey_success gauge
synthetic_ui_journey_success{scenario="Login Flow",service="my-e-commerce-app"} 1

# HELP synthetic_ui_journey_errors_total Total number of UI journey failures, labelled by the step's error_type_name.
# TYPE synthetic_ui_journey_errors_total counter
synthetic_ui_journey_errors_total{error_type_name="navigation_failed",scenario="Login Flow",step="navigate_to_login",service="my-e-commerce-app"} 0

How to use these metrics (PromQL)

Once Prometheus scrapes these metrics, you can create highly effective alerts and dashboards using PromQL.

Example 1: Alerting on Journey Failure

If synthetic_ui_journey_success is 0, the critical flow is broken right now.

promql
synthetic_ui_journey_success == 0

Example 2: Calculating Error Rates

To see how often a specific error occurs over time (e.g., login buttons failing), use the rate() function on the error counter:

promql
rate(synthetic_ui_journey_errors_total{error_type_name="login_failed"}[$__rate_interval]) > 0

(Note: We use Grafana's dynamic [$__rate_interval] variable instead of a hardcoded [5m] to prevent data gaps or aliasing when zooming out in your Grafana dashboard.)

Example 3: Alerting on expiring SSL Certificates

To trigger an alert if any SSL certificate will expire in less than 7 days (604800 seconds):

promql
(synthetic_ssl_cert_expiry_timestamp_seconds - time()) < 604800

TIP

We strongly recommend using our official Grafana Dashboard to visualize all these metrics and queries instantly. See the Grafana Dashboard page for instructions on how to import it.

Released under the MIT License.