OPA can periodically report status updates to remote HTTP servers. The updates contain status information for OPA itself as well as the Bundles that have been downloaded and activated.

OPA sends status reports whenever one of the following happens:

  • Bundles are downloaded and activated – If the bundle download or activation fails for any reason, the status update will include error information describing the failure. This includes Discovery bundles.
  • A plugin state has changed – All plugin status is reported, and an update to any plugin will trigger a Status API report which contains the latest state.

The status updates will include a set of labels that uniquely identify the OPA instance. OPA automatically includes an id value in the label set that provides a globally unique identifier or the running OPA instance and a version value that provides the version of OPA.

See the Configuration Reference for configuration details.

Status Service API

OPA expects the service to expose an API endpoint that will receive status updates.

  1. POST /status[/<partition_name>] HTTP/1.1
  2. Content-Type: application/json

The partition name is an optional path segment that can be used to route status updates to different backends. If the partition name is not configured on the agent, updates will be sent to /status.

  1. {
  2. "labels": {
  3. "app": "my-example-app",
  4. "id": "1780d507-aea2-45cc-ae50-fa153c8e4a5a",
  5. "version": "v0.40.0"
  6. },
  7. "bundles": {
  8. "http/example/authz": {
  9. "active_revision": "ABC",
  10. "last_request": "2018-01-01T00:00:00.000Z",
  11. "last_successful_request": "2018-01-01T00:00:00.000Z",
  12. "last_successful_download": "2018-01-01T00:00:00.000Z",
  13. "last_successful_activation": "2018-01-01T00:00:00.000Z",
  14. "metrics": {
  15. "timer_rego_data_parse_ns": 12345,
  16. "timer_rego_module_compile_ns": 12345,
  17. "timer_rego_module_parse_ns": 12345
  18. }
  19. }
  20. },
  21. "plugins": {
  22. "bundle": {
  23. "state": "OK"
  24. },
  25. "discovery": {
  26. "state": "OK"
  27. },
  28. "status": {
  29. "state": "OK"
  30. }
  31. },
  32. "metrics": {
  33. "prometheus": {
  34. "go_gc_cycles_automatic_gc_cycles_total": {
  35. "name": "go_gc_cycles_automatic_gc_cycles_total",
  36. "help": "Count of completed GC cycles generated by the Go runtime.",
  37. "type": "COUNTER",
  38. "metric": [
  39. {
  40. "counter": {
  41. "value": 1
  42. }
  43. }
  44. ]
  45. },
  46. "go_gc_cycles_forced_gc_cycles_total": {
  47. "name": "go_gc_cycles_forced_gc_cycles_total",
  48. "help": "Count of completed GC cycles forced by the application.",
  49. "type": "COUNTER",
  50. "metric": [
  51. {
  52. "counter": {
  53. "value": 0
  54. }
  55. }
  56. ]
  57. },
  58. "go_gc_cycles_total_gc_cycles_total": {
  59. "name": "go_gc_cycles_total_gc_cycles_total",
  60. "help": "Count of all completed GC cycles.",
  61. "type": "COUNTER",
  62. "metric": [
  63. {
  64. "counter": {
  65. "value": 1
  66. }
  67. }
  68. ]
  69. },
  70. "go_gc_duration_seconds": {
  71. "name": "go_gc_duration_seconds",
  72. "help": "A summary of the pause duration of garbage collection cycles.",
  73. "type": "SUMMARY",
  74. "metric": [
  75. {
  76. "summary": {
  77. "sampleCount": "1",
  78. "sampleSum": 4.1765e-05,
  79. "quantile": [
  80. {
  81. "quantile": 0,
  82. "value": 4.1765e-05
  83. },
  84. {
  85. "quantile": 0.25,
  86. "value": 4.1765e-05
  87. },
  88. {
  89. "quantile": 0.5,
  90. "value": 4.1765e-05
  91. },
  92. {
  93. "quantile": 0.75,
  94. "value": 4.1765e-05
  95. },
  96. {
  97. "quantile": 1,
  98. "value": 4.1765e-05
  99. }
  100. ]
  101. }
  102. }
  103. ]
  104. },
  105. ------------------------------8< SNIP 8<------------------------------
  106. "http_request_duration_seconds": {
  107. "name": "http_request_duration_seconds",
  108. "help": "A histogram of duration for requests.",
  109. "type": "HISTOGRAM",
  110. "metric": [
  111. {
  112. "label": [
  113. {
  114. "name": "code",
  115. "value": "200"
  116. },
  117. {
  118. "name": "handler",
  119. "value": "v1/data"
  120. },
  121. {
  122. "name": "method",
  123. "value": "get"
  124. }
  125. ],
  126. "histogram": {
  127. "sampleCount": "2",
  128. "sampleSum": 0.00060022,
  129. "bucket": [
  130. {
  131. "cumulativeCount": "0",
  132. "upperBound": 1e-06
  133. },
  134. {
  135. "cumulativeCount": "0",
  136. "upperBound": 5e-06
  137. },
  138. {
  139. "cumulativeCount": "0",
  140. "upperBound": 1e-05
  141. },
  142. {
  143. "cumulativeCount": "0",
  144. "upperBound": 5e-05
  145. },
  146. {
  147. "cumulativeCount": "0",
  148. "upperBound": 0.0001
  149. },
  150. {
  151. "cumulativeCount": "2",
  152. "upperBound": 0.0005
  153. },
  154. {
  155. "cumulativeCount": "2",
  156. "upperBound": 0.001
  157. },
  158. {
  159. "cumulativeCount": "2",
  160. "upperBound": 0.01
  161. },
  162. {
  163. "cumulativeCount": "2",
  164. "upperBound": 0.1
  165. },
  166. {
  167. "cumulativeCount": "2",
  168. "upperBound": 1
  169. }
  170. ]
  171. }
  172. }
  173. ]
  174. }
  175. }
  176. }
  177. }

Status updates contain the following fields:

FieldTypeDescription
labelsobjectSet of key-value pairs that uniquely identify the OPA instance.
bundlesobjectSet of objects describing the status for each bundle configured with OPA.
bundles[].namestringName of bundle that the OPA instance is configured to download.
bundles[].activerevisionstringOpaque revision identifier of the last successful activation.
bundles[].lastrequeststringRFC3339 timestamp of last bundle request. This timestamp should be >= to the successful request timestamp in normal operation.
bundles[].lastsuccessful_requeststringRFC3339 timestamp of last successful bundle request. This timestamp should be >= to the successful download timestamp in normal operation.
bundles[].lastsuccessful_downloadstringRFC3339 timestamp of last successful bundle download.
bundles[].lastsuccessful_activationstringRFC3339 timestamp of last successful bundle activation.
bundles[].metricsobjectMetrics from the last update of the bundle.
bundles[].codestringIf present, indicates error(s) occurred activating this bundle.
bundles[].messagestringHuman readable messages describing the error(s).
bundles[].http_codenumberIf present, indicates an erroneous HTTP status code that OPA received downloading this bundle.
bundles[].errorsarrayCollection of detailed parse or compile errors that occurred during activation of this bundle.
discovery.namestringName of discovery bundle that the OPA instance is configured to download.
discovery.activerevisionstringOpaque revision identifier of the last successful discovery activation.
discovery.last_requeststringRFC3339 timestamp of last discovery bundle request. This timestamp should be >= to the successful request timestamp in normal operation.
discovery.last_successful_requeststringRFC3339 timestamp of last successful discovery bundle request. This timestamp should be >= to the successful download timestamp in normal operation.
discovery.last_successful_downloadstringRFC3339 timestamp of last successful discovery bundle download.
discovery.last_successful_activationstringRFC3339 timestamp of last successful discovery bundle activation.
pluginsobjectA set of objects describing the state of configured plugins in OPA’s runtime.
plugins[].statestringThe state of each plugin.
metrics.prometheusobjectGlobal performance metrics for the OPA instance.

If the discovery bundle download or activation failed, the status update will contain the following additional fields.

FieldTypeDescription
discovery.codestringIf present, indicates error(s) occurred.
discovery.messagestringHuman readable messages describing the error(s).
discovery.errorsarrayCollection of detailed parse or compile errors that occurred during activation.

Services should reply with HTTP status 200 OK if the status update is processed successfully.

Local Status Logs

Local console logging of status updates can be enabled via the console config option. This does not require any remote server. Example of minimal config to enable:

  1. status:
  2. console: true

This will dump all status updates to the console. See Configuration Reference for more details.

Warning: Status update messages are somewhat infrequent but can be very verbose! The metrics.prometheus portion of the status update in particular can create a considerable amount of log text at info level.

Prometheus Status Metrics

Prometheus status metrics can be enabled via the prometheus config option. (see the configuration documentation) Example of minimal config to enable:

  1. status:
  2. prometheus: true

When enabled the OPA instance’s Prometheus endpoint exposes the metrics described on the monitoring documentation.