|
| 1 | +--- |
| 2 | +layout: docs |
| 3 | +page_title: Boundary Metrics |
| 4 | +description: |- |
| 5 | + Obtain visibility of various components of a running Boundary |
| 6 | +--- |
| 7 | + |
| 8 | +## Boundary Metrics |
| 9 | + |
| 10 | +Boundary provides metrics through the `/metrics` path using a listener with the |
| 11 | +`"ops"` purpose. By default, a listener with that purpose runs on port `9203`. |
| 12 | +See the [example configuration](#example-configuration) section for an example |
| 13 | +listener stanza in a `config.hcl` file. |
| 14 | + |
| 15 | +Metrics are important for understanding what is happening in a Boundary |
| 16 | +deployment, enabling diagnoses of deployed controllers and workers. The exported |
| 17 | +metrics grant greater visibility into the various components of a running |
| 18 | +Boundary deployment through Prometheus. |
| 19 | + |
| 20 | +The metrics uses the [OpenMetric |
| 21 | +exposition](https://prometheus.io/docs/instrumenting/exposition_formats/#openmetrics-text-format) |
| 22 | +format which can be read by |
| 23 | +[Prometheus](https://prometheus.io/docs/introduction/overview/). |
| 24 | + |
| 25 | +### Controller |
| 26 | + |
| 27 | +The following table lists the current names and descriptions of metrics provided |
| 28 | +by controllers. |
| 29 | + |
| 30 | +| Name | Description | |
| 31 | +|---------------------------------------------------------------|-----------------------------------------------| |
| 32 | +| `boundary_controller_api_http_request_duration_seconds` | Histogram of latencies for HTTP requests. | |
| 33 | +| `boundary_controller_api_http_request_size_bytes` | Histogram of request sizes for HTTP requests. | |
| 34 | +| `boundary_controller_api_http_response_size_bytes` | Histogram of response sizes for HTTP requests. | |
| 35 | +| `boundary_controller_cluster_grpc_request_duration_seconds` | Histogram of latencies for requests made to the gRPC service running on the cluster listener. | |
| 36 | + |
| 37 | +### Worker |
| 38 | + |
| 39 | +The following table lists the current names and descriptions of metrics provided |
| 40 | +by workers. |
| 41 | + |
| 42 | +| Name | Description | |
| 43 | +|---------------------------------------------------------------|-----------------------------------------------| |
| 44 | +| `boundary_worker_proxy_http_write_header_duration_seconds` | Histogram of time elapsed after the TLS connection is established to when the first http header is written back from the server. | |
| 45 | +| `boundary_worker_proxy_websocket_active_connections` | A gauge of the current count of open proxy connections on the worker. | |
| 46 | +| `boundary_worker_proxy_websocket_received_bytes_total` | Count of received bytes sent over all proxy connections handled by the worker. | |
| 47 | +| `boundary_worker_proxy_websocket_sent_bytes_total` | Count of sent bytes sent over all proxy connections handled by the worker. | |
| 48 | + |
| 49 | +### Other |
| 50 | + |
| 51 | +The following table lists the current miscellaneous metrics provided by Boundary. |
| 52 | + |
| 53 | +| Name | Description | |
| 54 | +|---------------------------------------------------------------|-----------------------------------------------| |
| 55 | +| `boundary_build_info` | A gauge set to 1 with label values detailing the current Go version, git revision, and Boundary version. | |
| 56 | + |
| 57 | +### Metric Labels |
| 58 | + |
| 59 | +Each metric uses labels to help organize and narrow its scope so that users can |
| 60 | +filter for different characteristics, allowing more flexible analysis of the |
| 61 | +measurements collected. |
| 62 | + |
| 63 | +#### Metrics for HTTP requests include the following labels: |
| 64 | + |
| 65 | +| Label | Description | |
| 66 | +|--------------|----------------------------------------------------------------| |
| 67 | +| `code` | The HTTP status code of the request (e.g., “200”, “400”, etc.). | |
| 68 | +| `path` | The path, excluding query parameters, associated with the request. The value for this label replaces resource IDs with "{id}" (for example, `/v1/groups/{id}` is a possible value for this label). Any unexpected paths receive the value "unknown." | |
| 69 | +| `method` | The name of the method on the HTTP request. For example "GET", “POST”, “DELETE”. | |
| 70 | + |
| 71 | + |
| 72 | +#### Metrics for gRPC requests include the following labels: |
| 73 | + |
| 74 | +| Label | Description | |
| 75 | +|-----------------|-----------------------------------------------------------------| |
| 76 | +| `grpc_method` | The name of the method on the grpc service (e.g., `GetGroup`). | |
| 77 | +| `grpc_service` | The proto service name including the package (e.g., `controller.api.services.v1.GroupService`). | |
| 78 | +| `grpc_code` | The grpc [status code](https://github.com/grpc/grpc-go/blob/master/codes/codes.go) in human-readable format. For example, `OK`, `IllegalArgument`, `Unknown`. | |
| 79 | + |
| 80 | + |
| 81 | +## Example configuration |
| 82 | + |
| 83 | +Defining a listener stanza in the config file is sufficient for enabling metrics |
| 84 | +reporting in Boundary. For details on what fields are allowed in this stanza, |
| 85 | +refer to the documentation about [TCP |
| 86 | +Listener](/docs/configuration/listener/tcp). |
| 87 | + |
| 88 | +An example listener stanza: |
| 89 | + |
| 90 | +```hcl |
| 91 | +listener "tcp" { |
| 92 | + purpose = "ops" |
| 93 | + tls_disable = true |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +## Tutorial |
| 98 | + |
| 99 | +Refer to [Prometheus |
| 100 | +Metrics](https://learn.hashicorp.com/tutorials/boundary/prometheus-metrics) |
| 101 | +tutorial for a step-by-step introduction to metrics. |
0 commit comments