Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-6265

Decouple Wire of MetricHttpSink from internal java Metric classes. i.e. MetricName

Details

    • New Feature
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • 2.7.1
    • java-fn-execution
    • None

    Description

      I recommend decoupling the MetricName from the MetricResult object which is used by MetricHttpSink and other MetricResult classes.

       

      I was trying to enhance MetricName with a naming style more similar to MonitoringInfo, by allowing a MonitoringInfoMetricName subclass to define a name using a

      • urn - string
      • labels - <string,string> map

      I encountered an issue when adding accessor methods to the base MetricName for getUrn and getLabels. The tests in MetricHttpSinkTest fail because serialized the JSON of the object using reflection via a call to ObjectMapper.writeValuesAsString.

      To decouple this, a Wire format Pojo could be introduced (that does not use MetricName) to copy the metric onto first before invoking ObjectMapper.writeValuesAsString.

      Then if new capabilities are added to internal MetricName, we won't break the MetricHttpSink, we can update it to include new fields as necessary.

       

      Additionally, I will propose a new design for MetricResult soon, as it lacks labeling capabilities.

       

      The current MetricResult only supports a single label getStep() at the moment.

      Additionally, it is focused on a name+namespace style metric.

       

      Attachments

        Activity

          People

            ajamato@google.com Alex Amato
            ajamato@google.com Alex Amato
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: