Appearance
Metrics
Internal
These endpoints are internal to Hailer and not part of the supported public API.
Workspace metrics and usage data.
Endpoints
| Endpoint | Arguments | Returns |
|---|---|---|
v3.metrics.get | metricTypes: string[], options?: object | object[] |
v3.metrics.list | - | string[] |
v3.metrics.user.list | Search options | object[] |
v3.metrics.workspaceSearch | Search options - provide workspaceIds or name | object[] |
v3.metrics.get
Description
Get current metrics data - designed for frontend polling to build live graphs. Pass metrics as array (use single-item array for one metric). Use v3.metrics.list to discover available metrics.
Parameters
Argument 1 (string[], required):
Argument 2 (object, optional):
| Field | Type | Required | Description |
|---|---|---|---|
workspaceId | WorkspaceId | no | workspaceId (former networkId) |
timeRange | object | no | |
interval | 1m | 5m | 15m | 30m | 1h | 5h | no | Default: "1h". One of: 1m, 5m, 15m, 30m, 1h, 5h. |
aggregation | sum | avg | max | min | count | rate | increase | no | One of: sum, avg, max, min, count, rate, increase. |
groupBy | userId | userRole | workspaceId | teamId | processId | workflowId | discussionId | activityId | signal | type[] | no | |
topk | integer | no | |
labelFilters | Record<userId | userRole | workspaceId | teamId | processId | workflowId | discussionId | activityId | signal | type, string> | no |
Example
javascript
const { Client } = require('@hailer/cli');
const client = await Client.create({
host: 'https://api.hailer.com',
username: 'you@example.com',
password: '••••••',
});
const result = await client.request('v3.metrics.get', [
['string'],
{
workspaceId: '507f1f77bcf86cd799439011', // workspaceId (former networkId)
timeRange: {
start: 0,
end: 0,
},
},
]);
console.log(result);Returns
Array of objects:
| Field | Type | Required | Description |
|---|---|---|---|
value | number | no | |
labels | object | no | |
timeSeries | object[] | no | |
error | boolean | no | |
errorMessage | string | no |
Auth: requires an authenticated session.
Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.
v3.metrics.list
Description
List available metrics from metrics server
Parameters
Undocumented
This endpoint declares no argument schema in the source yet.
Example
javascript
const { Client } = require('@hailer/cli');
const client = await Client.create({
host: 'https://api.hailer.com',
username: 'you@example.com',
password: '••••••',
});
const result = await client.request('v3.metrics.list', []);
console.log(result);Returns
Array of string.
Auth: requires an authenticated session.
Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.
v3.metrics.user.list
Description
Get user names by array of user IDs for metrics app.
Parameters
Argument 1 (Search options, optional):
| Field | Type | Required | Description |
|---|---|---|---|
userIds | string[] | yes | Array of user IDs to look up |
Example
javascript
const { Client } = require('@hailer/cli');
const client = await Client.create({
host: 'https://api.hailer.com',
username: 'you@example.com',
password: '••••••',
});
const result = await client.request('v3.metrics.user.list', [
{
userIds: ['string'], // Array of user IDs to look up
},
]);
console.log(result);Returns
Array of objects:
| Field | Type | Required | Description |
|---|---|---|---|
_id | string | yes | |
name | string | no | |
email | string | yes |
Auth: requires an authenticated session.
Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.
v3.metrics.workspaceSearch
Description
Get workspaces by IDs or search by name for metrics app.
Parameters
Argument 1 (Search options - provide workspaceIds or name, optional):
| Field | Type | Required | Description |
|---|---|---|---|
workspaceIds | string[] | no | Array of workspace IDs to look up |
name | string | no | Search by workspace name (min 3 characters) |
Example
javascript
const { Client } = require('@hailer/cli');
const client = await Client.create({
host: 'https://api.hailer.com',
username: 'you@example.com',
password: '••••••',
});
const result = await client.request('v3.metrics.workspaceSearch', [
{
workspaceIds: ['string'], // Array of workspace IDs to look up
name: 'string', // Search by workspace name (min 3 characters)
},
]);
console.log(result);Returns
Array of objects:
| Field | Type | Required | Description |
|---|---|---|---|
_id | string | yes | |
name | string | yes |
Auth: requires an authenticated session.
Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.