Class McpMetricsSnapshot.Builder
java.lang.Object
com.soklet.McpMetricsSnapshot.Builder
- Enclosing class:
McpMetricsSnapshot
Builder for immutable
McpMetricsSnapshot instances.- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionactiveHandlerExecutions(@NonNull Long activeHandlerExecutions) Sets the number of occupied MCP application-handler execution slots.activeRequests(@NonNull Long activeRequests) Sets the number of currently active admitted MCP requests.activeRequestStreams(@NonNull Long activeRequestStreams) Sets the number of currently active MCP request streams.activeSubscriptions(@NonNull Long activeSubscriptions) Sets the number of currently active MCP subscriptions.build()Builds an immutable MCP metrics snapshot.cancelationsSignaled(@Nullable Map<@NonNull McpMetricsSnapshot.EndpointMethodKey, @NonNull Long> cancelationsSignaled) Replaces cooperative request-cancelation signal counts grouped by bounded endpoint and method dimensions.connectionsAccepted(@NonNull Long connectionsAccepted) Sets the number of successfully accepted MCP connections admitted within the configured connection-capacity bound.connectionsRejected(@NonNull Long connectionsRejected) Sets the number of MCP connections rejected because the configured connection-capacity bound was full.handlerCapacityRejections(@NonNull Long handlerCapacityRejections) Sets the number of MCP application requests rejected because the bounded handler queue was full.handlerQueueDepth(@NonNull Long handlerQueueDepth) Sets the number of MCP application requests waiting for a handler slot.keepAlivesEmitted(@NonNull Long keepAlivesEmitted) Sets the number of MCP keep-alive comments accepted for delivery.progressEmitted(@Nullable Map<@NonNull McpMetricsSnapshot.EndpointMethodKey, @NonNull Long> progressEmitted) Replaces progress-notification counts accepted for delivery grouped by bounded endpoint and method dimensions.Replaces client-visible MCP protocol-error counts grouped by error code.requestDurations(@Nullable Map<@NonNull McpMetricsSnapshot.RequestOutcomeKey, @NonNull MetricsCollector.HistogramSnapshot> requestDurations) Replaces request-duration histograms grouped by bounded endpoint, method, and terminal outcome dimensions.Replaces completed-request counts grouped by bounded endpoint, method, and terminal outcome dimensions.requestsAccepted(@NonNull Long requestsAccepted) Sets the number of MCP requests accepted by the bounded protocol processor.requestsRejected(@NonNull Long requestsRejected) Sets the number of MCP requests rejected before admitted semantic handling.requestStreamDurations(@Nullable Map<@NonNull McpMetricsSnapshot.RequestStreamTerminationKey, @NonNull MetricsCollector.HistogramSnapshot> requestStreamDurations) Replaces request-stream duration histograms grouped by bounded endpoint, method, and fixed termination reason dimensions.serverStarts(@NonNull Long serverStarts) Sets the number of successful MCP server starts.serverStops(@Nullable Map<@NonNull ShutdownComponentDisposition, @NonNull Long> serverStops) Replaces the server-stop counts grouped by fixed shutdown disposition.subscriptionDurations(@Nullable Map<@NonNull McpMetricsSnapshot.SubscriptionTerminationKey, @NonNull MetricsCollector.HistogramSnapshot> subscriptionDurations) Replaces subscription-duration histograms grouped by bounded endpoint and fixed termination reason dimensions.subscriptionMaintenance(@Nullable Map<@NonNull McpMetricsSnapshot.SubscriptionMaintenanceKey, @NonNull Long> subscriptionMaintenance) Replaces delivered subscription-maintenance event counts grouped by bounded endpoint and fixed work/outcome dimensions.transportFailures(@Nullable Map<@NonNull MetricsCollector.TransportFailureReason, @NonNull Long> transportFailures) Replaces the MCP transport-failure counts grouped by fixed reason.unknownMirroredHeaders(@Nullable Map<@NonNull McpMetricsSnapshot.EndpointMethodKey, @NonNull Long> unknownMirroredHeaders) Replaces unknown mirrored-header occurrence counts grouped by bounded endpoint and method dimensions.
-
Method Details
-
activeHandlerExecutions
public @NonNull McpMetricsSnapshot.Builder activeHandlerExecutions(@NonNull Long activeHandlerExecutions) Sets the number of occupied MCP application-handler execution slots.- Parameters:
activeHandlerExecutions- active handler executions- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
handlerQueueDepth
Sets the number of MCP application requests waiting for a handler slot.- Parameters:
handlerQueueDepth- handler queue depth- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
handlerCapacityRejections
public @NonNull McpMetricsSnapshot.Builder handlerCapacityRejections(@NonNull Long handlerCapacityRejections) Sets the number of MCP application requests rejected because the bounded handler queue was full.- Parameters:
handlerCapacityRejections- handler capacity rejections- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
serverStops
public @NonNull McpMetricsSnapshot.Builder serverStops(@Nullable Map<@NonNull ShutdownComponentDisposition, @NonNull Long> serverStops) Replaces the server-stop counts grouped by fixed shutdown disposition. Passingnullor an empty map clears all server-stop counts.- Parameters:
serverStops- nonnegative server-stop counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
connectionsAccepted
Sets the number of successfully accepted MCP connections admitted within the configured connection-capacity bound.- Parameters:
connectionsAccepted- accepted MCP connections- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
connectionsRejected
Sets the number of MCP connections rejected because the configured connection-capacity bound was full.- Parameters:
connectionsRejected- rejected MCP connections- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
transportFailures
public @NonNull McpMetricsSnapshot.Builder transportFailures(@Nullable Map<@NonNull MetricsCollector.TransportFailureReason, @NonNull Long> transportFailures) Replaces the MCP transport-failure counts grouped by fixed reason. Passingnullor an empty map clears all transport-failure counts.- Parameters:
transportFailures- nonnegative MCP transport-failure counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
serverStarts
Sets the number of successful MCP server starts.- Parameters:
serverStarts- successful MCP server starts- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
requestsAccepted
Sets the number of MCP requests accepted by the bounded protocol processor.- Parameters:
requestsAccepted- accepted MCP requests- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
requestsRejected
Sets the number of MCP requests rejected before admitted semantic handling.- Parameters:
requestsRejected- rejected MCP requests- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
activeRequests
Sets the number of currently active admitted MCP requests.- Parameters:
activeRequests- active admitted MCP requests- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
requests
public @NonNull McpMetricsSnapshot.Builder requests(@Nullable Map<@NonNull McpMetricsSnapshot.RequestOutcomeKey, @NonNull Long> requests) Replaces completed-request counts grouped by bounded endpoint, method, and terminal outcome dimensions. Passingnullor an empty map clears all completed-request counts.- Parameters:
requests- completed-request counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
requestDurations
public @NonNull McpMetricsSnapshot.Builder requestDurations(@Nullable Map<@NonNull McpMetricsSnapshot.RequestOutcomeKey, @NonNull MetricsCollector.HistogramSnapshot> requestDurations) Replaces request-duration histograms grouped by bounded endpoint, method, and terminal outcome dimensions. Passingnullor an empty map clears all request-duration histograms.- Parameters:
requestDurations- request-duration histograms, ornullto clear them- Returns:
- this builder
-
activeRequestStreams
Sets the number of currently active MCP request streams.- Parameters:
activeRequestStreams- active MCP request streams- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
requestStreamDurations
public @NonNull McpMetricsSnapshot.Builder requestStreamDurations(@Nullable Map<@NonNull McpMetricsSnapshot.RequestStreamTerminationKey, @NonNull MetricsCollector.HistogramSnapshot> requestStreamDurations) Replaces request-stream duration histograms grouped by bounded endpoint, method, and fixed termination reason dimensions. Passingnullor an empty map clears all request-stream duration histograms.- Parameters:
requestStreamDurations- request-stream duration histograms, ornullto clear them- Returns:
- this builder
-
activeSubscriptions
Sets the number of currently active MCP subscriptions.- Parameters:
activeSubscriptions- active MCP subscriptions- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
subscriptionDurations
public @NonNull McpMetricsSnapshot.Builder subscriptionDurations(@Nullable Map<@NonNull McpMetricsSnapshot.SubscriptionTerminationKey, @NonNull MetricsCollector.HistogramSnapshot> subscriptionDurations) Replaces subscription-duration histograms grouped by bounded endpoint and fixed termination reason dimensions. Passingnullor an empty map clears all subscription-duration histograms.- Parameters:
subscriptionDurations- subscription-duration histograms, ornullto clear them- Returns:
- this builder
-
subscriptionMaintenance
public @NonNull McpMetricsSnapshot.Builder subscriptionMaintenance(@Nullable Map<@NonNull McpMetricsSnapshot.SubscriptionMaintenanceKey, @NonNull Long> subscriptionMaintenance) Replaces delivered subscription-maintenance event counts grouped by bounded endpoint and fixed work/outcome dimensions. Passingnullor an empty map clears these counts. The map is defensively copied; explicit zero counts are retained.- Parameters:
subscriptionMaintenance- subscription-maintenance event counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
cancelationsSignaled
public @NonNull McpMetricsSnapshot.Builder cancelationsSignaled(@Nullable Map<@NonNull McpMetricsSnapshot.EndpointMethodKey, @NonNull Long> cancelationsSignaled) Replaces cooperative request-cancelation signal counts grouped by bounded endpoint and method dimensions. Passingnullor an empty map clears all cancelation-signal counts.- Parameters:
cancelationsSignaled- cancelation-signaled counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
progressEmitted
public @NonNull McpMetricsSnapshot.Builder progressEmitted(@Nullable Map<@NonNull McpMetricsSnapshot.EndpointMethodKey, @NonNull Long> progressEmitted) Replaces progress-notification counts accepted for delivery grouped by bounded endpoint and method dimensions. Passingnullor an empty map clears all progress-notification counts.- Parameters:
progressEmitted- progress-emitted counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
keepAlivesEmitted
Sets the number of MCP keep-alive comments accepted for delivery.- Parameters:
keepAlivesEmitted- keep-alive comments accepted for delivery- Returns:
- this builder
- Throws:
IllegalArgumentException- if the count is negative
-
protocolErrors
public @NonNull McpMetricsSnapshot.Builder protocolErrors(@Nullable Map<@NonNull Integer, @NonNull Long> protocolErrors) Replaces client-visible MCP protocol-error counts grouped by error code. Passingnullor an empty map clears all protocol-error counts.- Parameters:
protocolErrors- protocol-error counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
unknownMirroredHeaders
public @NonNull McpMetricsSnapshot.Builder unknownMirroredHeaders(@Nullable Map<@NonNull McpMetricsSnapshot.EndpointMethodKey, @NonNull Long> unknownMirroredHeaders) Replaces unknown mirrored-header occurrence counts grouped by bounded endpoint and method dimensions. Passingnullor an empty map clears all unknown mirrored-header counts.- Parameters:
unknownMirroredHeaders- unknown mirrored-header counts, ornullto clear them- Returns:
- this builder
- Throws:
IllegalArgumentException- if any count is negative
-
build
Builds an immutable MCP metrics snapshot.- Returns:
- built snapshot
-