Dev guideAPI Reference
Dev guideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Agent admin API

Optimizely Agent's Admin API provides system information that can be used to check the availability of the Agent service, runtime information, and operational metrics

By default, the Agent admin listener is configured on port 8088.


The /info endpoint provides basic information about the Optimizely Agent instance.

Example request:

curl localhost:8088/info

Example response:

    "version": "v0.10.0",
    "author": "Optimizely Inc.",
    "app_name": "optimizely"

Health check

The /health endpoint is used to determine service availability.

Example request:

curl localhost:8088/health

Example response:

   "status": "ok"

Optimizely Agent will return an HTTP 200 - OK response if and only if all configured listeners are open and all external dependent services can be reached.

A non-healthy service will return an HTTP 503 - Unavailable response with a descriptive message to help diagnose the issue.

This endpoint can be used when placing Optimizely Agent behind a load balancer to indicate whether a particular instance can receive inbound requests.


The /metrics endpoint exposes telemetry data of the running Optimizely Agent.

Optimizely Agent currently exposes two metrics data types (expvar and prometheus) based on the user's input. Expvar metrics are used by default. To configure the metrics, update the config.yaml file or set the value of the OPTIMIZELY_ADMIN_METRICSTYPE environment variable.

Supported values:

  • expvar (default)
  • promethues
    ## http listener port
    port: "8088"
    ## metrics package to use
    ## supported packages are expvar and prometheus
    ## default is expvar
    metricsType: ""
    ## metricsType: "promethues" ## for prometheus metrics

Expvar metrics

The core Optimizely Agent runtime metrics are exposed through the Go expvar package, which provides a standardized interface to public variables. Documentation for the various statistics can be found as part of the mstats package.

Example request:

curl localhost:8088/metrics

Example response:

    "cmdline": [
    "memstats": {
        "Alloc": 924136,
        "TotalAlloc": 924136,
        "Sys": 71893240,
        "Lookups": 0,
        "Mallocs": 4726,
        "HeapAlloc": 924136,
        "Frees": 172

Custom metrics are also provided for the individual service endpoints and follow the pattern of:

"timers.<metric-name>.counts": 0,
"timers.<metric-name>.responseTime": 0,
"timers.<metric-name>.responseTimeHist.p50": 0,
"timers.<metric-name>.responseTimeHist.p90": 0,
"timers.<metric-name>.responseTimeHist.p95": 0,
"timers.<metric-name>.responseTimeHist.p99": 0,

Prometheus metrics

Optimizely Agent supports Prometheus metrics. Prometheus is an open-source toolkit for monitoring and alerting. You can use it to collect and visualize metrics in a time-series database.

To access the Prometheus metrics, you can use the /metrics endpoint with a Prometheus server. The metrics are exposed in a format that Prometheus can scrape and aggregate.

Example Request:

curl localhost:8088/metrics

This will return a plain text response in the Prometheus exposition format, including the metrics Prometheus is currently tracking.



You must configure your Prometheus server to scrape metrics from this endpoint.

For information on how to use Prometheus for monitoring, see the official Prometheus documentation.

Example Response:

# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 1
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0
# HELP timer_decide_hits 
# TYPE timer_decide_hits counter
timer_decide_hits 1
# HELP timer_decide_response_time 
# TYPE timer_decide_response_time counter
timer_decide_response_time 658.109
# HELP timer_decide_response_time_hist 
# TYPE timer_decide_response_time_hist histogram
timer_decide_response_time_hist_bucket{le="0.005"} 0
timer_decide_response_time_hist_bucket{le="0.01"} 0
timer_decide_response_time_hist_bucket{le="0.025"} 0
timer_decide_response_time_hist_bucket{le="0.05"} 0
timer_decide_response_time_hist_bucket{le="0.1"} 0
timer_decide_response_time_hist_bucket{le="0.25"} 0
timer_decide_response_time_hist_bucket{le="0.5"} 0
timer_decide_response_time_hist_bucket{le="1"} 0
timer_decide_response_time_hist_bucket{le="2.5"} 0
timer_decide_response_time_hist_bucket{le="5"} 0
timer_decide_response_time_hist_bucket{le="10"} 0
timer_decide_response_time_hist_bucket{le="+Inf"} 1
timer_decide_response_time_hist_sum 658.109
timer_decide_response_time_hist_count 1
# HELP timer_track_event_hits 
# TYPE timer_track_event_hits counter
timer_track_event_hits 1
# HELP timer_track_event_response_time 
# TYPE timer_track_event_response_time counter
timer_track_event_response_time 0.356334
# HELP timer_track_event_response_time_hist 
# TYPE timer_track_event_response_time_hist histogram
timer_track_event_response_time_hist_bucket{le="0.005"} 0
timer_track_event_response_time_hist_bucket{le="0.01"} 0
timer_track_event_response_time_hist_bucket{le="0.025"} 0
timer_track_event_response_time_hist_bucket{le="0.05"} 0
timer_track_event_response_time_hist_bucket{le="0.1"} 0
timer_track_event_response_time_hist_bucket{le="0.25"} 0
timer_track_event_response_time_hist_bucket{le="0.5"} 1
timer_track_event_response_time_hist_bucket{le="1"} 1
timer_track_event_response_time_hist_bucket{le="2.5"} 1
timer_track_event_response_time_hist_bucket{le="5"} 1
timer_track_event_response_time_hist_bucket{le="10"} 1
timer_track_event_response_time_hist_bucket{le="+Inf"} 1
timer_track_event_response_time_hist_sum 0.356334
timer_track_event_response_time_hist_count 1