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.
Info
The/info endpoint provides basic information about the Optimizely Agent instance.
Example request
curl localhost:8088/infoExample 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/healthExample response
{ "status": "ok"}Optimizely Agent will return anHTTP 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 anHTTP 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.
Metrics
The/metrics endpoint exposes telemetry data of the running Optimizely Agent.
Optimizely Agent currently exposes two metrics data types (expvar andprometheus) based on the user's input. Expvar metrics are used by default. To configure the metrics, update theconfig.yaml file or set the value of theOPTIMIZELY_ADMIN_METRICSTYPE environment variable.
Supported values
expvar(default)promethues
admin: ## http listener port port: "8088" ## metrics package to use ## supported packages are expvar and prometheus ## default is expvar metricsType: "" ## metricsType: "promethues" ## for prometheus metricsExpvar metrics
The core Optimizely Agent runtime metrics are exposed through theGo expvar package, which provides a standardized interface to public variables. Documentation for the various statistics can be found as part of themstats package.
Example request
curl localhost:8088/metricsExample response
{ "cmdline": [ "bin/optimizely" ], "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 the following:
"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 supportsPrometheus 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/metricsThis will return a plain text response in thePrometheus exposition format, including the metrics Prometheus is currently tracking.
📘
NoteYou must configure your Prometheus server to scrape metrics from this endpoint.
For information on how to use Prometheus for monitoring, see theofficial Prometheus documentation.
Example Response
...# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.# TYPE promhttp_metric_handler_requests_total counterpromhttp_metric_handler_requests_total{code="200"} 1promhttp_metric_handler_requests_total{code="500"} 0promhttp_metric_handler_requests_total{code="503"} 0# HELP timer_decide_hits # TYPE timer_decide_hits countertimer_decide_hits 1# HELP timer_decide_response_time # TYPE timer_decide_response_time countertimer_decide_response_time 658.109# HELP timer_decide_response_time_hist # TYPE timer_decide_response_time_hist histogramtimer_decide_response_time_hist_bucket{le="0.005"} 0timer_decide_response_time_hist_bucket{le="0.01"} 0timer_decide_response_time_hist_bucket{le="0.025"} 0timer_decide_response_time_hist_bucket{le="0.05"} 0timer_decide_response_time_hist_bucket{le="0.1"} 0timer_decide_response_time_hist_bucket{le="0.25"} 0timer_decide_response_time_hist_bucket{le="0.5"} 0timer_decide_response_time_hist_bucket{le="1"} 0timer_decide_response_time_hist_bucket{le="2.5"} 0timer_decide_response_time_hist_bucket{le="5"} 0timer_decide_response_time_hist_bucket{le="10"} 0timer_decide_response_time_hist_bucket{le="+Inf"} 1timer_decide_response_time_hist_sum 658.109timer_decide_response_time_hist_count 1# HELP timer_track_event_hits # TYPE timer_track_event_hits countertimer_track_event_hits 1# HELP timer_track_event_response_time # TYPE timer_track_event_response_time countertimer_track_event_response_time 0.356334# HELP timer_track_event_response_time_hist # TYPE timer_track_event_response_time_hist histogramtimer_track_event_response_time_hist_bucket{le="0.005"} 0timer_track_event_response_time_hist_bucket{le="0.01"} 0timer_track_event_response_time_hist_bucket{le="0.025"} 0timer_track_event_response_time_hist_bucket{le="0.05"} 0timer_track_event_response_time_hist_bucket{le="0.1"} 0timer_track_event_response_time_hist_bucket{le="0.25"} 0timer_track_event_response_time_hist_bucket{le="0.5"} 1timer_track_event_response_time_hist_bucket{le="1"} 1timer_track_event_response_time_hist_bucket{le="2.5"} 1timer_track_event_response_time_hist_bucket{le="5"} 1timer_track_event_response_time_hist_bucket{le="10"} 1timer_track_event_response_time_hist_bucket{le="+Inf"} 1timer_track_event_response_time_hist_sum 0.356334timer_track_event_response_time_hist_count 1...Updated 17 days ago