Interface MetricsReporter
public interface MetricsReporter
Contract for a component that sends collected metrics to the
monitoring-server.
Implemented in monitoring-spring-boot-starter by
HttpMetricsReporter, which performs HTTP POST requests to the server's REST API.
Supports both single snapshot delivery and batch delivery
to reduce network overhead.
Implementations must be resilient to temporary server unavailability: on delivery failure, metrics should be buffered and resent once the connection is restored.
-
Method Summary
Modifier and TypeMethodDescriptionvoidreport(MetricSnapshot snapshot) Sends a single technical metric snapshot to the monitoring server.voidreportBatch(List<MetricSnapshot> snapshots) Sends a batch of technical snapshots in a single HTTP request.voidreportBusiness(BusinessMetric metric) Sends a single business metric to the monitoring server.
-
Method Details
-
report
Sends a single technical metric snapshot to the monitoring server.- Parameters:
snapshot- snapshot of a service state or a specific endpoint state
-
reportBatch
Sends a batch of technical snapshots in a single HTTP request. Used to reduce network overhead during buffered delivery.- Parameters:
snapshots- list of snapshots to send
-
reportBusiness
Sends a single business metric to the monitoring server. Invoked by the AOP aspect after each successful execution of a method annotated withTrackBusinessMetric.- Parameters:
metric- business metric to send
-