Class ClientExportableMetric

java.lang.Object
io.confluent.telemetry.emitter.ContextExportableMetric
io.confluent.telemetry.emitter.ClientExportableMetric
All Implemented Interfaces:
ExportableMetric, Keyed

public class ClientExportableMetric extends ContextExportableMetric
The ClientExportableMetric class extends ContextExportableMetric to process client metrics telemetry data. It is responsible for organizing resource-level and scope-level attributes in a Metric/MetricsData payload and ensuring proper formatting for export.
  • Constructor Details

    • ClientExportableMetric

      public ClientExportableMetric(io.opentelemetry.proto.metrics.v1.Metric metric, MetricKey key, Context context, io.opentelemetry.proto.resource.v1.Resource clientResource, Map<String,String> brokerMetricsLabels, Map<String,String> requestLabels, Set<String> excludeLabels)
  • Method Details

    • metric

      public io.opentelemetry.proto.metrics.v1.Metric metric()
      Returns the metric with resource attributes, brokerLabels and requestLabels added to the metric data point. The HttpExporter uses getMetric() to get the metric data point for export. A copy of the metric is created, and all relevant attributes from resource attributes, broker labels, and request labels are added to the metric's data point before export.

      The method first retrieves the base metric from the parent class using super.getMetric() to get the original metric structure. This original metric is then enhanced with client-specific attributes by adding them to the metric's data point, preserving the metric's core data while adding the necessary context for client telemetry.

      Specified by:
      metric in interface ExportableMetric
      Overrides:
      metric in class ContextExportableMetric
      Returns:
      A Metric with all resource and scope-level attributes included in its data point
    • resourceMetrics

      public io.opentelemetry.proto.metrics.v1.ResourceMetrics resourceMetrics()
      Specified by:
      resourceMetrics in interface ExportableMetric
      Overrides:
      resourceMetrics in class ContextExportableMetric
      Returns:
      the ResourceMetrics associated with this ContextExportableMetric