Skip to content

Commit

Permalink
Merge a97ccea into backport/operator-usage-docs/violently-known-clam
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-consul-core authored Feb 22, 2023
2 parents f9a8b64 + a97ccea commit 964f95a
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 76 deletions.
153 changes: 78 additions & 75 deletions website/content/api-docs/operator/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.

Expand All @@ -47,85 +47,88 @@ $ curl \

### Sample Response

<Tabs>
<Tab heading="OSS">
```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)

</Tab>
<Tab heading="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
}
```
</Tab>
</Tabs>

- `Services` is the total number of unique service names registered in the
datacenter.
Expand Down
4 changes: 3 additions & 1 deletion website/content/commands/operator/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 964f95a

Please sign in to comment.