Class ClientErrorCollector
vaadin.client.errors counts but cannot describe.
The counter and this collector are fed by the same sample: the in-browser collector sends the message, the script it came from and the first stack frame alongside the count, in a field that never becomes a meter tag. The count answers "how often"; the insight answers "what broke, and where" — which is the difference between knowing that browsers are failing and being able to fix it.
The detail policy is the one InteractionCollector applies to a
server-side failure, and the line it draws is between a location and text the
page chose.
Published unconditionally: the kind, the source, and the location of the
first stack frame. The latter two go through StackFrames, which
returns a location or nothing — that is what makes "none of this is
free-form" true by construction rather than by enumeration.
Gated on ObservabilitySettings.isInsightsDetails(): the error's
message, and the frame's function name. The message because it can
quote anything the page was working with; the name for the same reason, since
Object.defineProperty(f, 'name', …) takes any string and V8 prints
it. With the kit's own collector the browser does not even gather the
message, and this class is the second of those two gates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDetail key: the first frame of the error's stack.static final StringDetail key: the function name from that frame.static final StringDetail key: the error message the browser reported.static final StringDetail key: the path the browser was on when the error happened.static final StringDetail key: where the browser said the error came from. -
Constructor Summary
ConstructorsConstructorDescriptionClientErrorCollector(RecentClientErrors buffer, ObservabilitySettings settings) -
Method Summary
-
Field Details
-
DETAIL_ROUTE
Detail key: the path the browser was on when the error happened.- See Also:
-
DETAIL_MESSAGE
Detail key: the error message the browser reported.- See Also:
-
DETAIL_SOURCE
Detail key: where the browser said the error came from.- See Also:
-
DETAIL_FRAME
Detail key: the first frame of the error's stack.- See Also:
-
DETAIL_FUNCTION
Detail key: the function name from that frame. Sent separately from the frame, and only when the browser was told to collect detail, because it is a string the page chose rather than a location.- See Also:
-
-
Constructor Details
-
ClientErrorCollector
-
-
Method Details
-
capture
public void capture(String kind, String route, Map<String, String> detail, long bufferedMs, com.vaadin.flow.component.UI ui) Retains one reported browser error.Best-effort throughout: an error report that cannot be understood is dropped rather than allowed to fail the ingest of the batch it arrived in, which may be carrying the samples of a whole outage.
- Parameters:
kind-MeterNames.KIND_UNCAUGHTorMeterNames.KIND_PROMISE, as the browser tagged the sample; a kind outside that set is grouped asMeterNames.KIND_UNKNOWNroute- the route template of the view the error happened on, already resolved and cardinality-capped, may benulldetail- the browser's description of the error, keyed byDETAIL_ROUTE,DETAIL_MESSAGE,DETAIL_SOURCE,DETAIL_FRAMEandDETAIL_FUNCTION. The last two of those are the location and the name of one stack frame, sent apart because they are trusted differentlybufferedMs- how long the report waited for the browser to reach the server again, measured on the browser's clock;0for a report that was only waiting for the next flush. 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 flushui- the UI that reported it, may benull
-