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)
  • Stored by default for 1 month due to volume

The following tables summarize all built‑in metric message types available in Fluxzero.


The metrics listed below are published automatically by the Fluxzero SDK and Runtime when using common SDK functions (e.g. publishing messages, tracking, scheduling, searching, etc.). These metrics are essential for observability and are written to the metrics log for monitoring and analysis.

All metric messages are published by the SDK, except for ConnectEvent and DisconnectEvent, which are published by the Runtime when a client connects or disconnects a WebSocket session.


Metric messageDescription
Append$MetricPublished when messages are appended to a log.
SetRetentionTimeIndicates that the retention time of a message log has been updated.

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.).
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 that the tracker position has been updated.
ResetPositionIndicates that a consumer’s position has been reset.
DisconnectTrackerPublished when a tracker disconnects.

Metric messageDescription
AppendEventsAppends events to an aggregate.
GetEventsRequests events for an aggregate.
GetEventsResult$MetricReports metrics for GetEvents.
DeleteEventsDeletes events for an aggregate.

Metric messageDescription
UpdateRelationshipsUpdates entity–aggregate relationships.
RepairRelationshipsRepairs relationship consistency.
GetAggregateIdsRequests aggregate IDs for a given entity.
GetAggregateIdsResultReturns aggregate IDs for an entity.
GetRelationshipsRequests relationships for an entity.
GetRelationshipsResultReturns relationships for an entity.

Metric messageDescription
ScheduleSchedules one or more messages for future dispatch.
CancelScheduleCancels a scheduled message.
GetScheduleRequests a specific schedule by ID.
GetScheduleResultReturns schedule details.

Metric messageDescription
IndexDocumentsIndexes one or more documents for search.
SearchDocumentsExecutes a search query on a document collection.
SearchDocumentsResultReturns the results of a document search.
GetDocumentRetrieves a document by ID.
GetDocumentResultReturns the requested document.
GetDocumentsRetrieves multiple documents by their IDs.
GetDocumentsResultReturns multiple documents.
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.
BulkUpdateDocumentsUpdates documents in bulk.
GetFacetStatsRequests facet statistics for a search query.
GetFacetStatsResultReturns facet statistics results.

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.

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);

Many metrics are emitted automatically by the Flux Java client:

  • Connect/disconnect events when clients start or stop
  • Tracking stats (throughput, latency, handler timing)
  • Search, state, or document store usage
  • Web request round-trip timings

You can handle metrics just like other message types:

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

Use this to feed dashboards, update counters, or trigger alerts.


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 the configuration.

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