Skip to content
machinemail

metrics

Counts and rates. The `machinemail metrics` commands: arguments, flags, examples and the API routes they call.

Counts and rates.

CommandSummary
metrics eventsQuery events
metrics ratesQuery rates
metrics usageQuery usage

Every command also takes the global flags.

metrics events

Query events.

Counts of events per event type over time, in buckets of —period seconds (default one day), over the last 24 hours unless —start and —end say otherwise. message.received includes its sub-types (spam, blocked, unauthenticated, quarantined). At most 100,000 events are counted per query.

Requires the metrics_read permission.

shell
machinemail metrics events [flags]

Flags

--inbox <inbox-id>string
Only this inbox.
--pod <pod-id>string
Only this pod.
-e, --event-types <value>string[]
Event types to count: message.received, message.received.spam, message.received.blocked, message.received.unauthenticated, message.received.quarantined, message.sent, message.delivered, message.bounced, message.complained, message.rejected, domain.verified (the default is all of them). message.received counts every inbound message, including the message.received.* sub-types, which are also reported under their own keys. Other values give a series of zeros. Repeat the flag for several values.
--start <time>string
Start of the range. Default: 24 hours before --end.

Default24 hours before --end

--end <time>string
End of the range. Default: now; a later time is clamped to now.

Defaultnow

--limit <n>integer
Return at most this many points per series.
--descendingboolean
Newest point first.
--period <n>integer
Bucket size in seconds, 1 to 86400. Default 86400 (one bucket per UTC day). The range may hold at most 1000 buckets.

Default86400

Examples

shell
machinemail metrics events
machinemail metrics events --inbox agent@machinemail.dev

API

metrics rates

Query rates.

Rolling bounce and complaint rates. At each —period grid point: the bounced (or complained) messages over the preceding —window, divided by the messages sent over the same window, with the send count alongside. Defaults: the last 24 hours, —period 3600, —window 86400.

Requires the metrics_read permission.

shell
machinemail metrics rates [flags]

Flags

--inbox <inbox-id>string
Only this inbox.
--pod <pod-id>string
Only this pod.
--rate-types <value>string[]
Rate types: bounce, complaint. Default: both. Another value is a 400. Repeat the flag for several values.

Defaultboth

--start <time>string
Start of the range. Default: 24 hours before --end.

Default24 hours before --end

--end <time>string
End of the range. Default: now; a later time is clamped to now.

Defaultnow

--limit <n>integer
Return at most this many points per series.
--descendingboolean
Newest point first.
--period <n>integer
How often a point is sampled, in seconds, 60 to 86400. Default 3600. The range may hold at most 1000 points.

Default3600

--window <n>integer
How far back each point looks, in seconds: a whole multiple of --period, at most 2592000 (30 days). Default 86400 when that is a multiple of --period, otherwise --period.

Default86400 when that is a multiple of --period

Examples

shell
machinemail metrics rates
machinemail metrics rates --inbox agent@machinemail.dev

API

metrics usage

Query usage.

Current usage in the scope. Usage history is not kept yet: each series has a single point, at —end, with the value now.

Requires the metrics_read permission.

shell
machinemail metrics usage [flags]

Flags

--inbox <inbox-id>string
Only this inbox.
--pod <pod-id>string
Only this pod.
--usage-types <value>string[]
Usage types: storage_bytes, message_count, thread_count, inbox_count, pod_count, domain_count. Default: all. Another value is a 400. Repeat the flag for several values.

Defaultall

--start <time>string
Start of the range. Default: 24 hours before --end.

Default24 hours before --end

--end <time>string
End of the range. Default: now; a later time is clamped to now.

Defaultnow

--limit <n>integer
Return at most this many points per series.
--descendingboolean
Newest point first.
--period <n>integer
Accepted for AgentMail compatibility; usage has no history, so there is one point whatever the period.

Examples

shell
machinemail metrics usage
machinemail metrics usage --inbox agent@machinemail.dev

API