Record Class CapturedClientError

java.lang.Object
java.lang.Record
com.vaadin.observability.micrometer.insights.CapturedClientError
Record Components:
timestamp - when the server received the report. The error happened bufferedMs earlier on the browser's clock
route - the route template of the view the browser was on, resolved from the path the browser reported
kind - uncaught for a throw that reached window.onerror, promise for an unhandled rejection — the same values that tag the counter
message - the error message, truncated; null when it was not collected (see detailsIncluded)
source - where the browser said it came from, as script-url:line; null when the browser named no location
frame - the location named by the first frame of the error's stack, as script-url:line:col — the browser-side equivalent of CapturedInteraction.applicationFrame(). The location only, without the function name that stood in front of it: see StackFrames. null when the stack held no frame that named a location
function - the name of the function that frame was in, exactly as the browser wrote it and truncated; null when the frame named none, or whenever detail was not collected (see detailsIncluded). Gated with the message rather than published beside the location, because a page can set a function's name to any string it likes
bufferedMs - how long the report waited for the browser to reach the server again, measured on the browser's own clock. Offline time only, not the wait for the next flush, so zero for an ordinary report however long it sat in the buffer. Greater than zero means this report could not be delivered when it was raised — which is not the same as the error happening during an outage: a report taken while the browser was connected still accrues an outage that begins before the next flush. Read it as evidence that something went wrong the server could not be told about at the time, not as a measurement of when it went wrong
detailsIncluded - whether potentially sensitive detail was collected: the raw session id, the error message and the function name. Recorded per error so a report can say that a field was withheld rather than absent
sessionId - the Vaadin session id when detail was collected, otherwise a short one-way hash of it
uiId - UI id within the session, i.e. which browser tab reported it

public record CapturedClientError(Instant timestamp, String route, String kind, String message, String source, String frame, String function, long bufferedMs, boolean detailsIncluded, String sessionId, int uiId) extends Record
One error raised in a browser, with the detail vaadin.client.errors cannot carry.

The counter says how many browser errors happened and whether each was an uncaught throw or an unhandled rejection. That is all it can say: a message, a script URL and a stack frame are free-form text, and putting them on meter tags would make one time series per distinct message. They are retained here instead, the same way a failed server interaction is retained as a CapturedInteraction, so a report can name the error rather than count it.

  • Constructor Details

    • CapturedClientError

      public CapturedClientError(Instant timestamp, String route, String kind, String message, String source, String frame, String function, long bufferedMs, boolean detailsIncluded, String sessionId, int uiId)
      Creates an instance of a CapturedClientError record class.
      Parameters:
      timestamp - the value for the timestamp record component
      route - the value for the route record component
      kind - the value for the kind record component
      message - the value for the message record component
      source - the value for the source record component
      frame - the value for the frame record component
      function - the value for the function record component
      bufferedMs - the value for the bufferedMs record component
      detailsIncluded - the value for the detailsIncluded record component
      sessionId - the value for the sessionId record component
      uiId - the value for the uiId record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • route

      public String route()
      Returns the value of the route record component.
      Returns:
      the value of the route record component
    • kind

      public String kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • source

      public String source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • frame

      public String frame()
      Returns the value of the frame record component.
      Returns:
      the value of the frame record component
    • function

      public String function()
      Returns the value of the function record component.
      Returns:
      the value of the function record component
    • bufferedMs

      public long bufferedMs()
      Returns the value of the bufferedMs record component.
      Returns:
      the value of the bufferedMs record component
    • detailsIncluded

      public boolean detailsIncluded()
      Returns the value of the detailsIncluded record component.
      Returns:
      the value of the detailsIncluded record component
    • sessionId

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component
    • uiId

      public int uiId()
      Returns the value of the uiId record component.
      Returns:
      the value of the uiId record component