Class MeasurementContext.Builder

java.lang.Object
dk.cloudcreate.essentials.shared.measurement.MeasurementContext.Builder
Enclosing class:
MeasurementContext

public static class MeasurementContext.Builder extends Object
Builder for creating instances of MeasurementContext.
  • Constructor Details

    • Builder

      public Builder(String metricName)
      Creates a new Builder with the given metric name.
      Parameters:
      metricName - the metric name
  • Method Details

    • description

      public MeasurementContext.Builder description(String description)
      Sets the description for the measurement.
      Parameters:
      description - the description text
      Returns:
      the builder instance
    • tag

      Adds a tag to the measurement.
      Parameters:
      key - the tag key
      value - the tag value
      Returns:
      the builder instance
    • tag

      public MeasurementContext.Builder tag(String key, String value)
      Adds a tag to the measurement.
      Parameters:
      key - the tag key
      value - the tag value
      Returns:
      the builder instance
    • optionalTag

      public MeasurementContext.Builder optionalTag(String key, String value)
      Adds an optional tag to the measurement. If the value is null then the tag isn't added
      Parameters:
      key - the tag key
      value - the tag value
      Returns:
      the builder instance
    • tag

      public MeasurementContext.Builder tag(String key, int value)
      Adds a tag to the measurement.
      Parameters:
      key - the tag key
      value - the tag value
      Returns:
      the builder instance
    • build

      public MeasurementContext build()
      Builds the MeasurementContext instance.
      Returns:
      the immutable MeasurementContext