2023-02-22 20:36:25 +00:00
|
|
|
---
|
|
|
|
layout: api
|
|
|
|
page_title: Usage - Operator - HTTP API
|
|
|
|
description: |-
|
|
|
|
The /operator/usage endpoint returns usage information about the number of
|
2023-05-05 17:41:40 +00:00
|
|
|
services, service instances and mesh-enabled service instances by
|
2023-02-22 20:36:25 +00:00
|
|
|
datacenter.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Usage Operator HTTP API
|
|
|
|
|
|
|
|
The `/operator/usage` endpoint returns usage information about the number of
|
2023-05-05 17:41:40 +00:00
|
|
|
services, service instances and mesh-enabled service instances by datacenter.
|
2023-02-22 20:36:25 +00:00
|
|
|
|
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ----------------- | ------------------ |
|
|
|
|
| `GET` | `/operator/usage` | `application/json` |
|
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
|
|
|
[blocking queries](/consul/api-docs/features/blocking),
|
|
|
|
[consistency modes](/consul/api-docs/features/consistency),
|
|
|
|
[agent caching](/consul/api-docs/features/caching), and
|
|
|
|
[required ACLs](/consul/api-docs/api-structure#authentication).
|
|
|
|
|
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | --------------- |
|
|
|
|
| `YES` | `all` | `none` | `operator:read` |
|
|
|
|
|
|
|
|
The corresponding CLI command is [`consul operator usage instances`](/consul/commands/operator/usage).
|
|
|
|
|
|
|
|
### Query Parameters
|
|
|
|
|
|
|
|
- `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
|
|
|
|
error will be returned. You can use the `?stale` query parameter to read the
|
|
|
|
Raft configuration from any of the Consul servers.
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```shell-session
|
|
|
|
$ curl \
|
|
|
|
http://127.0.0.1:8500/v1/operator/usage
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
<Tabs>
|
2023-02-23 17:58:39 +00:00
|
|
|
|
2023-02-22 20:36:25 +00:00
|
|
|
<Tab heading="OSS">
|
2023-02-23 17:41:30 +00:00
|
|
|
|
2023-02-22 20:36:25 +00:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Usage": {
|
|
|
|
"dc1": {
|
|
|
|
"Services": 1,
|
|
|
|
"ServiceInstances": 1,
|
|
|
|
"ConnectServiceInstances": {
|
|
|
|
"connect-native": 0,
|
|
|
|
"connect-proxy": 0,
|
|
|
|
"ingress-gateway": 0,
|
|
|
|
"mesh-gateway": 0,
|
|
|
|
"terminating-gateway": 0
|
|
|
|
},
|
2023-07-05 15:23:29 +00:00
|
|
|
"BillableServiceInstances": 0,
|
|
|
|
"Nodes": 1
|
2023-02-22 20:36:25 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"Index": 13,
|
|
|
|
"LastContact": 0,
|
|
|
|
"KnownLeader": true,
|
|
|
|
"ConsistencyLevel": "leader",
|
|
|
|
"NotModified": false,
|
|
|
|
"Backend": 0,
|
|
|
|
"ResultsFilteredByACLs": false
|
|
|
|
}
|
|
|
|
```
|
2023-02-23 17:41:30 +00:00
|
|
|
|
2023-02-22 20:36:25 +00:00
|
|
|
</Tab>
|
2023-02-23 17:58:39 +00:00
|
|
|
|
2023-02-22 20:36:25 +00:00
|
|
|
<Tab heading="Enterprise">
|
2023-02-23 17:41:30 +00:00
|
|
|
|
2023-02-22 20:36:25 +00:00
|
|
|
```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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Index": 13,
|
|
|
|
"LastContact": 0,
|
|
|
|
"KnownLeader": true,
|
|
|
|
"ConsistencyLevel": "leader",
|
|
|
|
"NotModified": false,
|
|
|
|
"Backend": 0,
|
|
|
|
"ResultsFilteredByACLs": false
|
|
|
|
}
|
|
|
|
```
|
2023-02-23 17:41:30 +00:00
|
|
|
|
2023-02-22 20:36:25 +00:00
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
- `Services` is the total number of unique service names registered in the
|
|
|
|
datacenter.
|
|
|
|
|
|
|
|
- `ServiceInstances` is the total number of service instances registered in
|
|
|
|
the datacenter.
|
|
|
|
|
2023-05-05 17:41:40 +00:00
|
|
|
- `ConnectServiceInstances` is the total number of mesh service instances
|
2023-02-22 20:36:25 +00:00
|
|
|
registered in the datacenter.
|
|
|
|
|
|
|
|
- `BillableServiceInstances` is the total number of billable service instances
|
|
|
|
registered in the datacenter. This is only relevant in Consul Enterprise
|
2023-05-05 17:41:40 +00:00
|
|
|
and is the total service instance count, not including any mesh service
|
2023-02-22 20:36:25 +00:00
|
|
|
instances or any Consul server instances.
|
|
|
|
|
|
|
|
- `PartitionNamespaceServices` <EnterpriseAlert inline /> is the total number
|
|
|
|
of unique service names registered in the datacenter, by partition and
|
|
|
|
namespace.
|
|
|
|
|
|
|
|
- `PartitionNamespaceServiceInstances` <EnterpriseAlert inline /> is the total
|
|
|
|
number of service instances registered in the datacenter, by partition and
|
|
|
|
namespace.
|
|
|
|
|
|
|
|
- `PartitionNamespaceBillableServiceInstances` <EnterpriseAlert inline /> is
|
|
|
|
the total number of billable service instances registered in the datacenter,
|
|
|
|
by partition and namespace.
|
|
|
|
|
|
|
|
- `PartitionNamespaceConnectServiceInstances` <EnterpriseAlert inline /> is
|
2023-05-05 17:41:40 +00:00
|
|
|
the total number of mesh service instances registered in the datacenter,
|
2023-02-23 18:02:03 +00:00
|
|
|
by partition and namespace.
|