Skip to content

Metrics messages

Fluxzero supports a built-in message type for metrics: MessageType.METRICS.

These messages provide a powerful way to observe and trace system behavior across clients, handlers, and infrastructure.

Metrics messages are:

  • Lightweight, structured, and traceable
  • Logged like any other message
  • Routable to handlers (via @HandleMetrics)
  • Retained according to the metrics log configuration; export or aggregate signals you need to keep longer

Publish your own operational signals, consume them with @HandleMetrics, or use the built-in signals described below.


You can publish metrics manually using Fluxzero.publishMetrics(...):

Fluxzero.publishMetrics(new SystemMetrics("slowProjection", "thresholdExceeded"));

This emits a structured metrics message to the metrics topic.

All metrics are wrapped in a regular Message, so you can include metadata or delivery guarantees:

Fluxzero.get()
.metricsGateway()
.publish(new MyMetric("foo"),
Metadata.of("critical", "true"),
Guarantee.STORED);

You can handle metrics just like other message types:

@HandleMetrics
void on(HandleMessageEvent event) {
log.debug("Observed metric: {}", event);
}

Use this to feed dashboards, update counters, or trigger alerts. For asynchronous handlers, HandleMessageEvent.completed=false means work is still pending; CompleteMessageEvent reports the final outcome.


Handler timing, tracking, Runtime requests, application lifecycle and native HTTP outcomes are instrumented by the SDK. Host collection and detailed WebSocket diagnostics are optional.

Enable periodic process-health snapshots on the application builder:

Fluxzero.builder().enableHostMetrics().build(client);

The default interval is 60 seconds. Measurements depend on platform support; disk collection is disabled by default. Use HostMetricsConfiguration to choose collectors and the interval. These measurements observe the application process and its host, rather than managed database or cluster internals.

Enable fluxzero.websocket.transportMetrics.enabled=true (FLUXZERO_WEBSOCKET_TRANSPORT_METRICS_ENABLED) when investigating transport problems. These sparse anomaly signals complement ordinary request/result metrics. See Configuring WebSocket client for the relevant settings.


These tables group the main built-in signals by purpose. The SDK publishes handler, client-operation and application metrics; the Runtime also publishes its own lifecycle, connection and schedule-cancellation signals. Availability depends on the feature in use and its metrics settings.

Protocol operations often publish a smaller nested Metric payload through JsonType.toMetric(). For example, Java’s Append.Metric appears as Append$Metric in serialized type names. Request metrics describe an attempted operation; inspect the result for its outcome. See JsonType for the conversion contract.


Metric messageDescription
Append$MetricSummarizes an append request: message type, count and bytes.
SetRetentionTimeRequests a change to message-log retention.

Metric messageDescription
ReadPublished after a new batch of messages from the tracker’s current position is requested.
ReadResult$MetricReports metrics about the received batch (size, latency, etc.).
PauseTrackerEventA tracker paused while idle or backing off; a pause alone does not indicate failure.
ClaimSegment / ClaimSegmentResult$MetricA tracker requests segment ownership and receives its assigned range.
ProcessBatchEventMarks the end of processing a message batch by a single tracker.
HandleMessageEventPublished once a handler is done handling a message. If the handler is asynchronous HandleMessageEvent may be published before the handler completes.
CompleteMessageEventPublished when an asynchronous handler completes.
IgnoreMessageEventPublished when a message matched a handler but was deliberately skipped before invocation. Currently used when an indexed request, such as a query, web request, or opt-in command, reached the handler after its expiry deadline.
ReadFromIndexManual read starting from a specific index.
ReadFromIndexResult$MetricResponse metrics for ReadFromIndex.
GetPositionRequests the current consumer position.
GetPositionResultReturns the current consumer position.
StorePositionReports the submitted tracker position, including topic for a custom topic or document collection. An absent/null topic indicates an unscoped stream or an older producer.
ResetPositionRequests a reset of the consumer position.
DisconnectTrackerPublished when a tracker disconnects.

Metric messageDescription
CommitModels$MetricSummarizes an atomic Model commit request.
CommitModelsResult$MetricReports accepted, duplicate, rebase and conflict outcomes.
GetModelEvents$MetricBatch-loads modelstream memberships at one state boundary.
GetModelEventsResult$MetricReports stream, payload, membership and byte counts.
GetModelGraph$Metric / GetModelGraphResult$MetricLoads a bounded current or historical model graph.
GetModelChange$Metric / GetModelChangeResult$MetricResolves the target count and exact boundary of one durable model-commit substep for a graph-change handler.
PlanModelDeletion$Metric / ModelDeletionPlan$MetricPlans Model erasure and reports its scope.
DeleteModel$Metric / ModelDeletionResult$MetricRequests Model erasure and reports the result.
TrackModelUpdates / TrackModelUpdatesResult$MetricFollows committed Model changes.
RegisterModelGraphProjection / GetModelGraphProjectionStatus / AwaitModelGraphProjectionRegisters a stored Graph projection, checks its progress or waits for it to catch up.

Metric messageDescription
GetRelationshipsRequests relationships for an entity.
GetRelationshipsResultReturns relationships for an entity.
UpdateRelationships / RepairRelationshipsUpdates or repairs entity relationship records.
GetAggregateIds / GetAggregateIdsResultLooks up aggregate identities by entity identity.

For the explicit event-store API, AppendEvents$Metric, GetEvents, GetEventsResult$Metric and DeleteEvents report event writes, reads and deletion. Independent Model operations use the Model metrics above.


Metric messageDescription
Schedule$MetricSummarizes a request to schedule one or more messages.
CancelScheduleRequests cancellation of a scheduled message.
GetScheduleRequests a specific schedule by ID.
GetScheduleResult$MetricSummarizes the returned schedule.
ScheduleWithParents$MetricSchedules work tied to committed Model parents.
GetScheduleParents$MetricSummarizes parent-lifetime lookup; used for both its request and result.
ScheduleAutoCancelledThe Runtime removed pending work because a Model parent was deleted.

See Parent-owned schedules for the lifecycle behavior.


Metric messageDescription
IndexDocuments$MetricIndexes one or more documents for search.
SearchDocumentsExecutes a search query on a document collection.
SearchDocumentsResult$MetricReports match count, returned bytes and response time.
GetDocumentRetrieves a document by ID.
GetDocumentResult$MetricReports whether a document was found and its size.
GetDocumentsRetrieves multiple documents by their IDs.
GetDocumentsResult$MetricSummarizes the returned document batch.
HasDocumentChecks if a document exists.
DeleteCollectionDeletes an entire document collection.
DeleteDocumentsDeletes documents matching a query.
MoveDocumentsMoves documents between collections.
DeleteDocumentByIdDeletes a single document by ID.
MoveDocumentByIdMoves a single document by ID.
BulkUpdateDocuments$MetricUpdates documents in bulk.
GetFacetStatsRequests facet statistics for a search query.
GetFacetStatsResult$MetricReturns facet statistics results.
GetDocumentStats / GetDocumentStatsResult$MetricComputes document statistics.
GetSearchHistogram / GetSearchHistogramResultComputes a search histogram.
GetSearchCollections / GetSearchCollectionsResult$MetricLists available search collections.
SearchModelDocuments$Metric / SearchModelGraphDocuments$MetricSearches Model documents or stored Graph projections.

Model migration and rematerialization operations also emit request/result metrics. See Tracking & updating documents for when to use those operations; the API reference describes their fields.


Metric messageDescription
StoreValues$Metric / StoreValueIfAbsent$MetricSummarizes values submitted for storage, including conditional writes.
GetValue / GetValueResult$MetricRequests a value and summarizes the response.
DeleteValueRequests deletion of a stored value.
Metric messageDescription
VoidResultEmpty acknowledgement for successful commands.
ErrorResultIndicates that a request failed in the runtime.
BooleanResultBoolean response for a request.
StringResultString response for a request.

Metric messageDescription
ConnectEventPublished by the runtime when a client connects a WebSocket session.
DisconnectEventPublished by the runtime when a client disconnects a WebSocket session.
Metric messageDescription
ApplicationLifecycleEventAn SDK application started or began controlled shutdown (STARTED / STOPPING).
RuntimeLifecycleEventA Runtime or Test Server started or began stopping.
HostMetricsA periodic snapshot containing available CPU, memory, GC, thread, class-loading, uptime, file-descriptor, disk and container measurements. Requires host collection to be enabled.
CacheEvictionEventAn SDK cache entry was evicted, with its identity and reason.

Host measurements are fields inside HostMetrics, not a separate message for every collector. A stopping metric is useful evidence of controlled shutdown; its absence alone does not prove the process is still running. See ApplicationLifecycleEvent and RuntimeLifecycleEvent .

Metric messageDescription
NativeWebRequestMetricOutcome and duration of a direct outbound HTTP request, including attempts, cancellation and redirect rejection.
WebsocketTransportMetricOpt-in diagnostics for ping timeouts, ingress backpressure, stalls/recovery, overflow and rejected executor work.

NativeWebRequestMetric describes the original request target. Its raw query is separate metric metadata; headers, bodies and exception text are excluded. Path and query can still contain sensitive application data. See NativeWebRequestMetric . Requests sent through the Runtime proxy retain their handler metrics; they do not use the native-client metric.


To reduce noise or overhead, you can disable automatic metric publishing:

Option 1: Disable via handler or batch interceptors

Section titled “Option 1: Disable via handler or batch interceptors”
@Consumer(handlerInterceptors = DisableMetrics.class)
public class SilentHandler {
@HandleEvent
void on(MyEvent event) {
// ...
}
}

You can also disable metrics for an entire consumer by using batchInterceptors.

Option 2: Disable globally in the client config

Section titled “Option 2: Disable globally in the client config”

When creating a WebSocket client, set disableMetrics = true in its configuration to suppress client-operation metrics. The standard application builder also respects this choice for native HTTP and application-lifecycle metrics. This does not disable every SDK publisher or metrics emitted by the Runtime.

The application builder has separate disableTrackingMetrics(), disableCacheEvictionMetrics() and disableApplicationLifecycleMetrics() switches. Host collection runs only when explicitly enabled. See FluxzeroBuilder for their scopes.

Option 3: Disable dynamically using a dispatch interceptor

Section titled “Option 3: Disable dynamically using a dispatch interceptor”
AdhocDispatchInterceptor.runWithAdhocInterceptor(() -> {
// your code here
}, (message, messageType, topic) -> null, MessageType.METRICS);

  • Audit debugging: trace which handler caused a slowdown
  • Observability: track search throughput or handler lag
  • Dashboards: surface per-entity or per-consumer stats
  • Alerting: trigger alerts on retries, delays, or timeouts

© 2026 Fluxzero