Interface DiagnosticEventPersister<T extends DiagnosticData>

Type Parameters:
T - concrete DiagnosticData payload type handled by this persister
All Known Implementing Classes:
CallStackReportDiagnosticEventPersister, RuntimeMetricsDiagnosticEventPersister, ThreadStateSnapshotDiagnosticEventPersister

public interface DiagnosticEventPersister<T extends DiagnosticData>
Strategy for persisting DiagnosticEvents of a single DiagnosticEventCode.

A single implementation supports exactly one event code. Adding support for a new event code is done by providing a new implementation and registering it with the flush watcher.

The default persist(List) flow filters the incoming batch by dataType(), logs the count + event code, and delegates a typed list to saveBatch(List).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The payload class this persister handles.
    default void
    Persist a batch of events.
    void
    saveBatch(List<T> items)
    Batch-insert the type-safe payloads into the underlying store.
    The event code this persister handles.
  • Field Details

    • log

      static final org.slf4j.Logger log
  • Method Details

    • supportedCode

      DiagnosticEventCode supportedCode()
      The event code this persister handles.
    • dataType

      Class<T> dataType()
      The payload class this persister handles. Used by the default persist(List) to filter the incoming batch.
    • saveBatch

      void saveBatch(List<T> items)
      Batch-insert the type-safe payloads into the underlying store.
      Parameters:
      items - items to persist; never null or empty
    • persist

      default void persist(List<DiagnosticEvent> events)
      Persist a batch of events. All events in the list are guaranteed to have supportedCode() as their event code; events whose payload does not match dataType() are skipped.