From a97ccea4b0679a8b6643a5877fbce7dc19b566bd Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Wed, 22 Feb 2023 11:13:21 -0800 Subject: [PATCH] Clean up operator usage doc additions --- website/content/api-docs/operator/usage.mdx | 153 ++++++++++---------- website/content/commands/operator/usage.mdx | 4 +- 2 files changed, 81 insertions(+), 76 deletions(-) diff --git a/website/content/api-docs/operator/usage.mdx b/website/content/api-docs/operator/usage.mdx index ac51147f70c72..82202b13fb820 100644 --- a/website/content/api-docs/operator/usage.mdx +++ b/website/content/api-docs/operator/usage.mdx @@ -7,7 +7,7 @@ description: |- datacenter. --- -# Operator Usage HTTP API +# Usage Operator HTTP API The `/operator/usage` endpoint returns usage information about the number of services, service instances and Connect-enabled service instances by datacenter. @@ -30,11 +30,11 @@ The corresponding CLI command is [`consul operator usage instances`](/consul/com ### Query Parameters -- `global` `(bool: false)` - If present, will return usage information for all - known datacenters. By default, only the local datacenter's usage information - is returned. +- `global` `(bool: false)` - If present, usage information for all + known datacenters will be returned. By default, only the local datacenter's + usage information is returned. -- `stale` `(bool: false)` - If the cluster does not currently have a leader an +- `stale` `(bool: false)` - If the cluster does not currently have a leader, an error will be returned. You can use the `?stale` query parameter to read the Raft configuration from any of the Consul servers. @@ -47,85 +47,88 @@ $ curl \ ### Sample Response + + ```json { - "Usage":{ - "dc1":{ - "Services":1, - "ServiceInstances":1, - "ConnectServiceInstances":{ - "connect-native":0, - "connect-proxy":0, - "ingress-gateway":0, - "mesh-gateway":0, - "terminating-gateway":0 - }, - "BillableServiceInstances":0 - } - }, - "Index":13, - "LastContact":0, - "KnownLeader":true, - "ConsistencyLevel":"leader", - "NotModified":false, - "Backend":0, - "ResultsFilteredByACLs":false + "Usage": { + "dc1": { + "Services": 1, + "ServiceInstances": 1, + "ConnectServiceInstances": { + "connect-native": 0, + "connect-proxy": 0, + "ingress-gateway": 0, + "mesh-gateway": 0, + "terminating-gateway": 0 + }, + "BillableServiceInstances": 0 + } + }, + "Index": 13, + "LastContact": 0, + "KnownLeader": true, + "ConsistencyLevel": "leader", + "NotModified": false, + "Backend": 0, + "ResultsFilteredByACLs": false } ``` - -### Sample Response (Enterprise) - + + ```json { - "Usage":{ - "dc1":{ - "Services":1, - "ServiceInstances":1, - "ConnectServiceInstances":{ - "connect-native":0, - "connect-proxy":0, - "ingress-gateway":0, - "mesh-gateway":0, - "terminating-gateway":0 - }, - "BillableServiceInstances":0, - "PartitionNamespaceServices":{ - "default":{ - "default":1 - } - }, - "PartitionNamespaceServiceInstances":{ - "default":{ - "default":1 - } - }, - "PartitionNamespaceBillableServiceInstances":{ - "default":{ - "default":1 - } - }, - "PartitionNamespaceConnectServiceInstances":{ - "default":{ - "default":{ - "connect-native":0, - "connect-proxy":0, - "ingress-gateway":0, - "mesh-gateway":0, - "terminating-gateway":0 - } - } - } + "Usage": { + "dc1": { + "Services": 1, + "ServiceInstances": 1, + "ConnectServiceInstances": { + "connect-native": 0, + "connect-proxy": 0, + "ingress-gateway": 0, + "mesh-gateway": 0, + "terminating-gateway": 0 + }, + "BillableServiceInstances": 0, + "PartitionNamespaceServices": { + "default": { + "default": 1 + } + }, + "PartitionNamespaceServiceInstances": { + "default": { + "default": 1 + } + }, + "PartitionNamespaceBillableServiceInstances": { + "default": { + "default": 1 + } + }, + "PartitionNamespaceConnectServiceInstances": { + "default": { + "default": { + "connect-native": 0, + "connect-proxy": 0, + "ingress-gateway": 0, + "mesh-gateway": 0, + "terminating-gateway": 0 + } + } } - }, - "Index":13, - "LastContact":0, - "KnownLeader":true, - "ConsistencyLevel":"leader", - "NotModified":false, - "Backend":0, - "ResultsFilteredByACLs":false + } + }, + "Index": 13, + "LastContact": 0, + "KnownLeader": true, + "ConsistencyLevel": "leader", + "NotModified": false, + "Backend": 0, + "ResultsFilteredByACLs": false } ``` + + - `Services` is the total number of unique service names registered in the datacenter. diff --git a/website/content/commands/operator/usage.mdx b/website/content/commands/operator/usage.mdx index 784a983a2ed76..b0d7d03db2f9c 100644 --- a/website/content/commands/operator/usage.mdx +++ b/website/content/commands/operator/usage.mdx @@ -26,7 +26,7 @@ Subcommands: Corresponding HTTP API Endpoint: [\[GET\] /v1/operator/usage](/consul/api-docs/operator/usage#operator-usage) -Retrieves usage information about the number of services registered in a given +This command retrieves usage information about the number of services registered in a given datacenter. By default, the datacenter of the local agent is queried. The table below shows this command's [required ACLs](/consul/api-docs/api-structure#authentication). Configuration of @@ -42,6 +42,7 @@ Usage: `consul operator usage instances` The output looks like this: ```text +$ consul operator usage instances Billable Service Instances Total: 3 dc1 Billable Service Instances: 3 @@ -61,6 +62,7 @@ terminating-gateway 0 With the `-all-datacenters` flag: ```text +$ consul operator usage instances -all-datacenters Billable Service Instances Total: 4 dc1 Billable Service Instances: 3 dc2 Billable Service Instances: 1