All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opencensus.proto.metrics.v1.MetricDescriptor.scala Maven / Gradle / Ivy

There is a newer version: 1.23.0-dev-f04150-1
Show newest version
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package io.opencensus.proto.metrics.v1

/** Defines a metric type and its schema.
  *
  * @param name
  *   The metric type, including its DNS name prefix. It must be unique.
  * @param description
  *   A detailed description of the metric, which can be used in documentation.
  * @param unit
  *   The unit in which the metric value is reported. Follows the format
  *   described by http://unitsofmeasure.org/ucum.html.
  * @param labelKeys
  *   The label keys associated with the metric descriptor.
  */
@SerialVersionUID(0L)
final case class MetricDescriptor(
    name: _root_.scala.Predef.String = "",
    description: _root_.scala.Predef.String = "",
    unit: _root_.scala.Predef.String = "",
    `type`: io.opencensus.proto.metrics.v1.MetricDescriptor.Type = io.opencensus.proto.metrics.v1.MetricDescriptor.Type.UNSPECIFIED,
    labelKeys: _root_.scala.Seq[io.opencensus.proto.metrics.v1.LabelKey] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MetricDescriptor] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = name
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      
      {
        val __value = description
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
        }
      };
      
      {
        val __value = unit
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
        }
      };
      
      {
        val __value = `type`.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(4, __value)
        }
      };
      labelKeys.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      {
        val __v = name
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = description
        if (!__v.isEmpty) {
          _output__.writeString(2, __v)
        }
      };
      {
        val __v = unit
        if (!__v.isEmpty) {
          _output__.writeString(3, __v)
        }
      };
      {
        val __v = `type`.value
        if (__v != 0) {
          _output__.writeEnum(4, __v)
        }
      };
      labelKeys.foreach { __v =>
        val __m = __v
        _output__.writeTag(5, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withName(__v: _root_.scala.Predef.String): MetricDescriptor = copy(name = __v)
    def withDescription(__v: _root_.scala.Predef.String): MetricDescriptor = copy(description = __v)
    def withUnit(__v: _root_.scala.Predef.String): MetricDescriptor = copy(unit = __v)
    def withType(__v: io.opencensus.proto.metrics.v1.MetricDescriptor.Type): MetricDescriptor = copy(`type` = __v)
    def clearLabelKeys = copy(labelKeys = _root_.scala.Seq.empty)
    def addLabelKeys(__vs: io.opencensus.proto.metrics.v1.LabelKey *): MetricDescriptor = addAllLabelKeys(__vs)
    def addAllLabelKeys(__vs: Iterable[io.opencensus.proto.metrics.v1.LabelKey]): MetricDescriptor = copy(labelKeys = labelKeys ++ __vs)
    def withLabelKeys(__v: _root_.scala.Seq[io.opencensus.proto.metrics.v1.LabelKey]): MetricDescriptor = copy(labelKeys = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => {
          val __t = name
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = description
          if (__t != "") __t else null
        }
        case 3 => {
          val __t = unit
          if (__t != "") __t else null
        }
        case 4 => {
          val __t = `type`.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 5 => labelKeys
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PString(name)
        case 2 => _root_.scalapb.descriptors.PString(description)
        case 3 => _root_.scalapb.descriptors.PString(unit)
        case 4 => _root_.scalapb.descriptors.PEnum(`type`.scalaValueDescriptor)
        case 5 => _root_.scalapb.descriptors.PRepeated(labelKeys.iterator.map(_.toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.opencensus.proto.metrics.v1.MetricDescriptor.type = io.opencensus.proto.metrics.v1.MetricDescriptor
    // @@protoc_insertion_point(GeneratedMessage[opencensus.proto.metrics.v1.MetricDescriptor])
}

object MetricDescriptor extends scalapb.GeneratedMessageCompanion[io.opencensus.proto.metrics.v1.MetricDescriptor] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.opencensus.proto.metrics.v1.MetricDescriptor] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.opencensus.proto.metrics.v1.MetricDescriptor = {
    var __name: _root_.scala.Predef.String = ""
    var __description: _root_.scala.Predef.String = ""
    var __unit: _root_.scala.Predef.String = ""
    var __type: io.opencensus.proto.metrics.v1.MetricDescriptor.Type = io.opencensus.proto.metrics.v1.MetricDescriptor.Type.UNSPECIFIED
    val __labelKeys: _root_.scala.collection.immutable.VectorBuilder[io.opencensus.proto.metrics.v1.LabelKey] = new _root_.scala.collection.immutable.VectorBuilder[io.opencensus.proto.metrics.v1.LabelKey]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __name = _input__.readStringRequireUtf8()
        case 18 =>
          __description = _input__.readStringRequireUtf8()
        case 26 =>
          __unit = _input__.readStringRequireUtf8()
        case 32 =>
          __type = io.opencensus.proto.metrics.v1.MetricDescriptor.Type.fromValue(_input__.readEnum())
        case 42 =>
          __labelKeys += _root_.scalapb.LiteParser.readMessage[io.opencensus.proto.metrics.v1.LabelKey](_input__)
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.opencensus.proto.metrics.v1.MetricDescriptor(
        name = __name,
        description = __description,
        unit = __unit,
        `type` = __type,
        labelKeys = __labelKeys.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.opencensus.proto.metrics.v1.MetricDescriptor] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      io.opencensus.proto.metrics.v1.MetricDescriptor(
        name = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        description = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        unit = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        `type` = io.opencensus.proto.metrics.v1.MetricDescriptor.Type.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(io.opencensus.proto.metrics.v1.MetricDescriptor.Type.UNSPECIFIED.scalaValueDescriptor).number),
        labelKeys = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Seq[io.opencensus.proto.metrics.v1.LabelKey]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = MetricsProto.javaDescriptor.getMessageTypes().get(1)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = MetricsProto.scalaDescriptor.messages(1)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 5 => __out = io.opencensus.proto.metrics.v1.LabelKey
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = {
    (__fieldNumber: @_root_.scala.unchecked) match {
      case 4 => io.opencensus.proto.metrics.v1.MetricDescriptor.Type
    }
  }
  lazy val defaultInstance = io.opencensus.proto.metrics.v1.MetricDescriptor(
    name = "",
    description = "",
    unit = "",
    `type` = io.opencensus.proto.metrics.v1.MetricDescriptor.Type.UNSPECIFIED,
    labelKeys = _root_.scala.Seq.empty
  )
  /** The kind of metric. It describes how the data is reported.
    *
    * A gauge is an instantaneous measurement of a value.
    *
    * A cumulative measurement is a value accumulated over a time interval. In
    * a time series, cumulative measurements should have the same start time,
    * increasing values and increasing end times, until an event resets the
    * cumulative value to zero and sets a new start time for the following
    * points.
    */
  sealed abstract class Type(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum {
    type EnumType = Type
    def isUnspecified: _root_.scala.Boolean = false
    def isGaugeInt64: _root_.scala.Boolean = false
    def isGaugeDouble: _root_.scala.Boolean = false
    def isGaugeDistribution: _root_.scala.Boolean = false
    def isCumulativeInt64: _root_.scala.Boolean = false
    def isCumulativeDouble: _root_.scala.Boolean = false
    def isCumulativeDistribution: _root_.scala.Boolean = false
    def isSummary: _root_.scala.Boolean = false
    def companion: _root_.scalapb.GeneratedEnumCompanion[Type] = io.opencensus.proto.metrics.v1.MetricDescriptor.Type
    final def asRecognized: _root_.scala.Option[io.opencensus.proto.metrics.v1.MetricDescriptor.Type.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[io.opencensus.proto.metrics.v1.MetricDescriptor.Type.Recognized])
  }
  
  object Type extends _root_.scalapb.GeneratedEnumCompanion[Type] {
    sealed trait Recognized extends Type
    implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[Type] = this
    
    /** Do not use this default value.
      */
    @SerialVersionUID(0L)
    case object UNSPECIFIED extends Type(0) with Type.Recognized {
      val index = 0
      val name = "UNSPECIFIED"
      override def isUnspecified: _root_.scala.Boolean = true
    }
    
    /** Integer gauge. The value can go both up and down.
      */
    @SerialVersionUID(0L)
    case object GAUGE_INT64 extends Type(1) with Type.Recognized {
      val index = 1
      val name = "GAUGE_INT64"
      override def isGaugeInt64: _root_.scala.Boolean = true
    }
    
    /** Floating point gauge. The value can go both up and down.
      */
    @SerialVersionUID(0L)
    case object GAUGE_DOUBLE extends Type(2) with Type.Recognized {
      val index = 2
      val name = "GAUGE_DOUBLE"
      override def isGaugeDouble: _root_.scala.Boolean = true
    }
    
    /** Distribution gauge measurement. The count and sum can go both up and
      * down. Recorded values are always >= 0.
      * Used in scenarios like a snapshot of time the current items in a queue
      * have spent there.
      */
    @SerialVersionUID(0L)
    case object GAUGE_DISTRIBUTION extends Type(3) with Type.Recognized {
      val index = 3
      val name = "GAUGE_DISTRIBUTION"
      override def isGaugeDistribution: _root_.scala.Boolean = true
    }
    
    /** Integer cumulative measurement. The value cannot decrease, if resets
      * then the start_time should also be reset.
      */
    @SerialVersionUID(0L)
    case object CUMULATIVE_INT64 extends Type(4) with Type.Recognized {
      val index = 4
      val name = "CUMULATIVE_INT64"
      override def isCumulativeInt64: _root_.scala.Boolean = true
    }
    
    /** Floating point cumulative measurement. The value cannot decrease, if
      * resets then the start_time should also be reset. Recorded values are
      * always >= 0.
      */
    @SerialVersionUID(0L)
    case object CUMULATIVE_DOUBLE extends Type(5) with Type.Recognized {
      val index = 5
      val name = "CUMULATIVE_DOUBLE"
      override def isCumulativeDouble: _root_.scala.Boolean = true
    }
    
    /** Distribution cumulative measurement. The count and sum cannot decrease,
      * if resets then the start_time should also be reset.
      */
    @SerialVersionUID(0L)
    case object CUMULATIVE_DISTRIBUTION extends Type(6) with Type.Recognized {
      val index = 6
      val name = "CUMULATIVE_DISTRIBUTION"
      override def isCumulativeDistribution: _root_.scala.Boolean = true
    }
    
    /** Some frameworks implemented Histograms as a summary of observations
      * (usually things like request durations and response sizes). While it
      * also provides a total count of observations and a sum of all observed
      * values, it calculates configurable percentiles over a sliding time
      * window. This is not recommended, since it cannot be aggregated.
      */
    @SerialVersionUID(0L)
    case object SUMMARY extends Type(7) with Type.Recognized {
      val index = 7
      val name = "SUMMARY"
      override def isSummary: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends Type(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum
    lazy val values = scala.collection.immutable.Seq(UNSPECIFIED, GAUGE_INT64, GAUGE_DOUBLE, GAUGE_DISTRIBUTION, CUMULATIVE_INT64, CUMULATIVE_DOUBLE, CUMULATIVE_DISTRIBUTION, SUMMARY)
    def fromValue(__value: _root_.scala.Int): Type = __value match {
      case 0 => UNSPECIFIED
      case 1 => GAUGE_INT64
      case 2 => GAUGE_DOUBLE
      case 3 => GAUGE_DISTRIBUTION
      case 4 => CUMULATIVE_INT64
      case 5 => CUMULATIVE_DOUBLE
      case 6 => CUMULATIVE_DISTRIBUTION
      case 7 => SUMMARY
      case __other => Unrecognized(__other)
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = io.opencensus.proto.metrics.v1.MetricDescriptor.javaDescriptor.getEnumTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = io.opencensus.proto.metrics.v1.MetricDescriptor.scalaDescriptor.enums(0)
  }
  implicit class MetricDescriptorLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.opencensus.proto.metrics.v1.MetricDescriptor]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.opencensus.proto.metrics.v1.MetricDescriptor](_l) {
    def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_))
    def description: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.description)((c_, f_) => c_.copy(description = f_))
    def unit: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.unit)((c_, f_) => c_.copy(unit = f_))
    def `type`: _root_.scalapb.lenses.Lens[UpperPB, io.opencensus.proto.metrics.v1.MetricDescriptor.Type] = field(_.`type`)((c_, f_) => c_.copy(`type` = f_))
    def labelKeys: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[io.opencensus.proto.metrics.v1.LabelKey]] = field(_.labelKeys)((c_, f_) => c_.copy(labelKeys = f_))
  }
  final val NAME_FIELD_NUMBER = 1
  final val DESCRIPTION_FIELD_NUMBER = 2
  final val UNIT_FIELD_NUMBER = 3
  final val TYPE_FIELD_NUMBER = 4
  final val LABEL_KEYS_FIELD_NUMBER = 5
  def of(
    name: _root_.scala.Predef.String,
    description: _root_.scala.Predef.String,
    unit: _root_.scala.Predef.String,
    `type`: io.opencensus.proto.metrics.v1.MetricDescriptor.Type,
    labelKeys: _root_.scala.Seq[io.opencensus.proto.metrics.v1.LabelKey]
  ): _root_.io.opencensus.proto.metrics.v1.MetricDescriptor = _root_.io.opencensus.proto.metrics.v1.MetricDescriptor(
    name,
    description,
    unit,
    `type`,
    labelKeys
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[opencensus.proto.metrics.v1.MetricDescriptor])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy