Sunbird Obsrv
  • Introduction
    • The Value of Data
    • Data Value Chain
    • Challenges
    • The Solution: Obsrv
  • Core Concepts
    • Obsrv Overview
    • Key Capabilities
    • Datasets
    • Connectors
    • High Level Architecture
    • Tech Stack
    • Monitoring
  • Explore
    • Roadmap
    • Case Studies
      • Agri Climate Advisory
      • Learning Analytics at Population Scale
      • IOT Observations Infra
      • Data Driven Features in Learning Platform
      • Network Observability
      • Fraud Detection
    • Performance Benchmarks
  • Guides
    • Installation
      • AWS Installation Guide
      • Azure Installation Guide
      • GCP Installation Guide
      • OCI Installation Guide
      • Data Center Installation Guide
    • Dataset Management APIs
    • Dataset Management Console
    • Connector APIs
    • Data In & Out APIs
    • Alerts and Notification Channels APIs
    • Developer Guide
    • Example Datasets
    • Connectors Developer Guide
      • SDK Assumptions
      • Required Files
        • metadata.json
        • ui-config.json
        • metrics.yaml
        • alerts.yaml
      • Obsrv Base Setup
      • Dev Requirements
      • Interfaces
        • Stream Interfaces
        • Batch Interfaces
      • Classes
        • ConnectorContext Class
        • ConnectorStats Class
        • ConnectorState Class
        • ErrorData Class
        • MetricData Class
      • Verifying
      • Packaging Guide
      • Reference Implementations
    • Coming Soon!
  • Community
  • Previous Versions
    • SB-5.0 Version
      • Overview
      • USE
        • Release Notes
          • Obsrv 2.0-Beta
          • Obsrv 2.1.0
          • Obsrv 2.2.0
          • Obsrv 2.0.0-GA
          • Obsrv 5.3.0-GA
          • Release V 5.1.0
          • Release V 5.1.2
          • Release V 5.1.3
          • Release V 5.0.0
          • Release V 4.10.0
        • Installation Guide
        • Obsrv 2.0 Installation Guide
          • Getting Started with Obsrv Deployment Using Helm
        • System Requirements
      • LEARN
        • Functional Capabilities
        • Dependencies
        • Product Roadmap
        • Product & Developer Guide
          • Telemetry Service
          • Data Pipeline
          • Data Service
          • Data Product
            • On Demand Druid Exhaust Job
              • Component Diagram
              • ML CSV Reports
              • Folder Struture
          • Report Service
          • Report Configurator
          • Summarisers
      • ENGAGE
        • Discuss
        • Contribute to Obsrv
      • Raise an Issue
  • Release Notes
    • Obsrv 1.1.0 Beta Release
    • Obsrv 1.2.0-RC Release
Powered by GitBook
On this page
  • Overview
  • Class Definition
  • Fields
  • Usage
  • JSON Representation

Was this helpful?

Edit on GitHub
  1. Guides
  2. Connectors Developer Guide
  3. Classes

MetricData Class

Overview

The MetricData case class is a part of the org.sunbird.obsrv.job.model.Models package. It encapsulates metric information, including a map of metric names to their values and a list of labels associated with these metrics. This class is useful for representing and managing metrics data within the application.

Class Definition

package org.sunbird.obsrv.job.model.Models

case class MetricData(
  metric: Map[String, Long],
  labels: List[Map[String, String]]
)

Fields

metric: Map[String, Long]

  • Description: A map where the keys are metric names and the values are the corresponding metric values.

  • Type: Map[String, Long]

labels: List[Map[String, String]]

  • Description: A list of maps, where each map represents a set of labels associated with the metrics.

  • Type: List[Map[String, String]]

Usage

The MetricData case class is used to encapsulate and manage metrics data, including the metric values and their associated labels. It provides a structured way to represent metrics in the application.

Example

import org.sunbird.obsrv.job.model.Models.MetricData

val metric = Map("metric1" -> 100L, "metric2" -> 200L)
val labels = List(
  Map("label1" -> "value1", "label2" -> "value2"),
  Map("label3" -> "value3", "label4" -> "value4")
)

val metricData = MetricData(metric, labels)

// Accessing metric data fields
println(s"Metrics: ${metricData.metric}")
println(s"Labels: ${metricData.labels}")

JSON Representation

An instance of MetricData can be serialized to JSON as follows:

{
  "metric": {
    "metric1": 100,
    "metric2": 200
  },
  "labels": [
    {
      "label1": "value1",
      "label2": "value2"
    },
    {
      "label3": "value3",
      "label4": "value4"
    }
  ]
}
PreviousErrorData ClassNextVerifying

Last updated 5 months ago

Was this helpful?