Class ClientSample

java.lang.Object
com.vaadin.observability.micrometer.client.ClientSample
All Implemented Interfaces:
Serializable

public class ClientSample extends Object implements Serializable
One client-side measurement, deserialized by Flow's JSON codec from the browser-side collector.
See Also:
  • Constructor Details

    • ClientSample

      public ClientSample()
  • Method Details

    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getTags

      public Map<String,String> getTags()
    • setTags

      public void setTags(Map<String,String> tags)
    • getDetail

      public Map<String,String> getDetail()
      Free-form context that describes the sample but must never become a meter tag: the message, source and first stack frame of a browser error, and the path it happened on. It is what a counter cannot carry — a number says an error happened, not what it was — so the values here feed the insight the sample produces, never its tags.
      Returns:
      the detail map, empty when the browser sent none
    • setDetail

      public void setDetail(Map<String,String> detail)
    • getValueMs

      public double getValueMs()
    • setValueMs

      public void setValueMs(double valueMs)
    • getTs

      public long getTs()
    • setTs

      public void setTs(long ts)
    • getAgeMs

      public long getAgeMs()
      How long this sample sat in the browser's buffer while the browser could not reach the server, measured at flush time.

      Offline time, not elapsed time. The collector flushes on an interval, so every sample waits a little; what makes a sample interesting is having waited because the server was unreachable, and only that is counted here.

      A non-zero value says this sample could not be sent when it was taken. It does not say the thing it describes happened during an outage: a sample taken while the browser was connected still accrues the outage that begins before the next flush. The distinction matters for a browser error, where it is tempting to read the number as "this error happened while the user was offline".

      Computed in the browser on purpose, and on a monotonic clock rather than the one that produced getTs(). A sample taken while the connection was down can only arrive once it is back, so subtracting ts from the arrival time would report the skew between two machines' clocks rather than a delay — and a wall clock that steps mid-outage, which is exactly when this is being measured, would corrupt the figure even on one machine.

      Returns:
      the offline wait in milliseconds, 0 for a sample that only waited for the next flush
    • setAgeMs

      public void setAgeMs(long ageMs)