Class MetricDataPoint


public class MetricDataPoint extends SubscribersBatch<MetricDataPoint>
Holds the details of an individual OTLP metric data point received from a client as a Batch of all subscribers that are expected to process it.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MetricDataPoint(Batch<MetricDataPoint> parent, io.opentelemetry.context.Context otelContext)
    Create a new empty metric data point.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.opentelemetry.proto.metrics.v1.AggregationTemporality
    Get the aggregation temporality of this metric - DELTA, CUMULATIVE, etc...
    long
    Get the timestamp when the containing OTLP packet was received.
    Get the unique id of the containing OTLP packet.
    int
    Get the sequence number of this datapoint within the containing metric.
    Get the metric description.
    Get the message associated with an error in the data.
    io.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint
    Get the exponential histogram details.
    io.opentelemetry.proto.metrics.v1.NumberDataPoint
    Get the gauge details.
    io.opentelemetry.proto.metrics.v1.HistogramDataPoint
    Get the histogram details.
    Get the schema URL of the OpenTelemetry metric.
    Get the metric name.
    io.opentelemetry.proto.resource.v1.Resource
    Get the OpenTelemetry Resource of this metric.
    Get the schema URL of the OpenTelemetry Resouce of this metric.
    io.opentelemetry.proto.common.v1.InstrumentationScope
    Get the OpenTelemetry Scope of this metric.
    int
    Get the sequence number of this metric within the containing OTLP packet.
    io.opentelemetry.proto.metrics.v1.NumberDataPoint
    Get the number details.
    io.opentelemetry.proto.metrics.v1.SummaryDataPoint
    Get the summary details.
    io.opentelemetry.proto.metrics.v1.Metric.DataCase
    Get the metric type - GAUGE, HISTOGRAM, etc...
    Get the metric unit of measure.
    boolean
    Check if the metric is monotonic.
    boolean
    Check if this record is valid.
    void
    setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.ExponentialHistogram otelExponentialHistogram, int dpSeqNo, io.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint dp)
    Set the details of an exponential histogram data point.
    void
    setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Gauge otelGauge, int dpSeqNo, io.opentelemetry.proto.metrics.v1.NumberDataPoint dp)
    Set the details of a gauge data point.
    void
    setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Histogram otelHistogram, int dpSeqNo, io.opentelemetry.proto.metrics.v1.HistogramDataPoint dp)
    Set the details of a histogram data point.
    void
    setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Summary otelSummary, int dpSeqNo, io.opentelemetry.proto.metrics.v1.SummaryDataPoint dp)
    Set the details of a summary data point.
    void
    setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Sum otelSum, int dpSeqNo, io.opentelemetry.proto.metrics.v1.NumberDataPoint dp)
    Set the details of a number data point.

    Methods inherited from class io.mishmash.opentelemetry.server.collector.SubscribersBatch

    otelComplete

    Methods inherited from class io.mishmash.opentelemetry.server.collector.Batch

    add, addAll, cancel, complete, completeExceptionally, currentOtelScope, future, getOtelContext, getProcessedElements, isCancelled, isLoaded, setLoaded, setLoadFailed

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MetricDataPoint

      public MetricDataPoint(Batch<MetricDataPoint> parent, io.opentelemetry.context.Context otelContext)
      Create a new empty metric data point.
      Parameters:
      parent - parent Batch
      otelContext - Context for own telemetry
  • Method Details

    • setFrom

      public void setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.ExponentialHistogram otelExponentialHistogram, int dpSeqNo, io.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint dp)
      Set the details of an exponential histogram data point. Also verifies the data and potentially sets an error message.
      Parameters:
      batchTS - the batch timestamp
      batchID - the batch id
      sequenceNum - the sequence number of this span
      resourceMetric - used to fill-in OpenTelemetry Resource details
      scopeMetric - used to fill-in OpenTelemetry Scope details
      metric - the metric details
      otelExponentialHistogram - the exponential histogram details
      dpSeqNo - the data point sequence number
      dp - the data point itself
    • setFrom

      public void setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Gauge otelGauge, int dpSeqNo, io.opentelemetry.proto.metrics.v1.NumberDataPoint dp)
      Set the details of a gauge data point. Also verifies the data and potentially sets an error message.
      Parameters:
      batchTS - the batch timestamp
      batchID - the batch id
      sequenceNum - the sequence number of this span
      resourceMetric - used to fill-in OpenTelemetry Resource details
      scopeMetric - used to fill-in OpenTelemetry Scope details
      metric - the metric details
      otelGauge - the gauge details
      dpSeqNo - the data point sequence number
      dp - the data point itself
    • setFrom

      public void setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Histogram otelHistogram, int dpSeqNo, io.opentelemetry.proto.metrics.v1.HistogramDataPoint dp)
      Set the details of a histogram data point. Also verifies the data and potentially sets an error message.
      Parameters:
      batchTS - the batch timestamp
      batchID - the batch id
      sequenceNum - the sequence number of this span
      resourceMetric - used to fill-in OpenTelemetry Resource details
      scopeMetric - used to fill-in OpenTelemetry Scope details
      metric - the metric details
      otelHistogram - the histogram details
      dpSeqNo - the data point sequence number
      dp - the data point itself
    • setFrom

      public void setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Sum otelSum, int dpSeqNo, io.opentelemetry.proto.metrics.v1.NumberDataPoint dp)
      Set the details of a number data point. Also verifies the data and potentially sets an error message.
      Parameters:
      batchTS - the batch timestamp
      batchID - the batch id
      sequenceNum - the sequence number of this span
      resourceMetric - used to fill-in OpenTelemetry Resource details
      scopeMetric - used to fill-in OpenTelemetry Scope details
      metric - the metric details
      otelSum - the sum details
      dpSeqNo - the data point sequence number
      dp - the data point itself
    • setFrom

      public void setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetric, io.opentelemetry.proto.metrics.v1.ScopeMetrics scopeMetric, io.opentelemetry.proto.metrics.v1.Metric metric, io.opentelemetry.proto.metrics.v1.Summary otelSummary, int dpSeqNo, io.opentelemetry.proto.metrics.v1.SummaryDataPoint dp)
      Set the details of a summary data point. Also verifies the data and potentially sets an error message.
      Parameters:
      batchTS - the batch timestamp
      batchID - the batch id
      sequenceNum - the sequence number of this span
      resourceMetric - used to fill-in OpenTelemetry Resource details
      scopeMetric - used to fill-in OpenTelemetry Scope details
      metric - the metric details
      otelSummary - the summary details
      dpSeqNo - the data point sequence number
      dp - the data point itself
    • getBatchTimestamp

      public long getBatchTimestamp()
      Get the timestamp when the containing OTLP packet was received.
      Returns:
      the timestamp, in ms
    • getBatchUUID

      public String getBatchUUID()
      Get the unique id of the containing OTLP packet.
      Returns:
      the UUID
    • getSeqNo

      public int getSeqNo()
      Get the sequence number of this metric within the containing OTLP packet.
      Returns:
      the sequence number, zero-based
    • getResource

      public io.opentelemetry.proto.resource.v1.Resource getResource()
      Get the OpenTelemetry Resource of this metric.
      Returns:
      the resource details
    • getResourceSchemaUrl

      public String getResourceSchemaUrl()
      Get the schema URL of the OpenTelemetry Resouce of this metric.
      Returns:
      the schema URL
    • getScope

      public io.opentelemetry.proto.common.v1.InstrumentationScope getScope()
      Get the OpenTelemetry Scope of this metric.
      Returns:
      the scope details
    • getName

      public String getName()
      Get the metric name.
      Returns:
      the name of this metric
    • getDescription

      public String getDescription()
      Get the metric description.
      Returns:
      the description of this metric
    • getUnit

      public String getUnit()
      Get the metric unit of measure.
      Returns:
      the UOM
    • getType

      public io.opentelemetry.proto.metrics.v1.Metric.DataCase getType()
      Get the metric type - GAUGE, HISTOGRAM, etc...
      Returns:
      the type
    • getDatapointSeqNo

      public int getDatapointSeqNo()
      Get the sequence number of this datapoint within the containing metric.
      Returns:
      the sequence number, zero-based
    • getExponentialHistogram

      public io.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint getExponentialHistogram()
      Get the exponential histogram details.
      Returns:
      the details or null if metric is of different type
    • getGauge

      public io.opentelemetry.proto.metrics.v1.NumberDataPoint getGauge()
      Get the gauge details.
      Returns:
      the details or null if metric is of different type
    • getHistogram

      public io.opentelemetry.proto.metrics.v1.HistogramDataPoint getHistogram()
      Get the histogram details.
      Returns:
      the details or null if metric is of different type
    • getSum

      public io.opentelemetry.proto.metrics.v1.NumberDataPoint getSum()
      Get the number details.
      Returns:
      the details or null if metric is of different type
    • getSummary

      public io.opentelemetry.proto.metrics.v1.SummaryDataPoint getSummary()
      Get the summary details.
      Returns:
      the details or null if metric is of different type
    • getMetricSchemaUrl

      public String getMetricSchemaUrl()
      Get the schema URL of the OpenTelemetry metric.
      Returns:
      the schema URL
    • getAggregationTemporality

      public io.opentelemetry.proto.metrics.v1.AggregationTemporality getAggregationTemporality()
      Get the aggregation temporality of this metric - DELTA, CUMULATIVE, etc...
      Returns:
      the aggregation temporality
    • isMonotonic

      public boolean isMonotonic()
      Check if the metric is monotonic.
      Returns:
      true if monotonic
    • isValid

      public boolean isValid()
      Check if this record is valid.
      Returns:
      true if data is valid
    • getErrorMessage

      public String getErrorMessage()
      Get the message associated with an error in the data.
      Returns:
      the error message or null if data is valid