io.prometheus.client.MetricFamily.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of envoy-scala-control-plane_2.13 Show documentation
Show all versions of envoy-scala-control-plane_2.13 Show documentation
ScalaPB generated bindings for Envoy
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO2
package io.prometheus.client
@SerialVersionUID(0L)
final case class MetricFamily(
name: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None,
help: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None,
`type`: _root_.scala.Option[io.prometheus.client.MetricType] = _root_.scala.None,
metric: _root_.scala.Seq[io.prometheus.client.Metric] = _root_.scala.Seq.empty,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MetricFamily] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (name.isDefined) {
val __value = name.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
};
if (help.isDefined) {
val __value = help.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
};
if (`type`.isDefined) {
val __value = `type`.get.value
__size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(3, __value)
};
metric.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 = {
name.foreach { __v =>
val __m = __v
_output__.writeString(1, __m)
};
help.foreach { __v =>
val __m = __v
_output__.writeString(2, __m)
};
`type`.foreach { __v =>
val __m = __v.value
_output__.writeEnum(3, __m)
};
metric.foreach { __v =>
val __m = __v
_output__.writeTag(4, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def getName: _root_.scala.Predef.String = name.getOrElse("")
def clearName: MetricFamily = copy(name = _root_.scala.None)
def withName(__v: _root_.scala.Predef.String): MetricFamily = copy(name = Option(__v))
def getHelp: _root_.scala.Predef.String = help.getOrElse("")
def clearHelp: MetricFamily = copy(help = _root_.scala.None)
def withHelp(__v: _root_.scala.Predef.String): MetricFamily = copy(help = Option(__v))
def getType: io.prometheus.client.MetricType = `type`.getOrElse(io.prometheus.client.MetricType.COUNTER)
def clearType: MetricFamily = copy(`type` = _root_.scala.None)
def withType(__v: io.prometheus.client.MetricType): MetricFamily = copy(`type` = Option(__v))
def clearMetric = copy(metric = _root_.scala.Seq.empty)
def addMetric(__vs: io.prometheus.client.Metric *): MetricFamily = addAllMetric(__vs)
def addAllMetric(__vs: Iterable[io.prometheus.client.Metric]): MetricFamily = copy(metric = metric ++ __vs)
def withMetric(__v: _root_.scala.Seq[io.prometheus.client.Metric]): MetricFamily = copy(metric = __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 => name.orNull
case 2 => help.orNull
case 3 => `type`.map(_.javaValueDescriptor).orNull
case 4 => metric
}
}
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 => name.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => help.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 3 => `type`.map(__e => _root_.scalapb.descriptors.PEnum(__e.scalaValueDescriptor)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 4 => _root_.scalapb.descriptors.PRepeated(metric.iterator.map(_.toPMessage).toVector)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: io.prometheus.client.MetricFamily.type = io.prometheus.client.MetricFamily
// @@protoc_insertion_point(GeneratedMessage[io.prometheus.client.MetricFamily])
}
object MetricFamily extends scalapb.GeneratedMessageCompanion[io.prometheus.client.MetricFamily] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.prometheus.client.MetricFamily] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.prometheus.client.MetricFamily = {
var __name: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
var __help: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
var __type: _root_.scala.Option[io.prometheus.client.MetricType] = _root_.scala.None
val __metric: _root_.scala.collection.immutable.VectorBuilder[io.prometheus.client.Metric] = new _root_.scala.collection.immutable.VectorBuilder[io.prometheus.client.Metric]
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 = Option(_input__.readStringRequireUtf8())
case 18 =>
__help = Option(_input__.readStringRequireUtf8())
case 24 =>
__type = Option(io.prometheus.client.MetricType.fromValue(_input__.readEnum()))
case 34 =>
__metric += _root_.scalapb.LiteParser.readMessage[io.prometheus.client.Metric](_input__)
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
io.prometheus.client.MetricFamily(
name = __name,
help = __help,
`type` = __type,
metric = __metric.result(),
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[io.prometheus.client.MetricFamily] = _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.prometheus.client.MetricFamily(
name = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]),
help = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]),
`type` = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.scalapb.descriptors.EnumValueDescriptor]]).map(__e => io.prometheus.client.MetricType.fromValue(__e.number)),
metric = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[io.prometheus.client.Metric]]).getOrElse(_root_.scala.Seq.empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = MetricsProto.javaDescriptor.getMessageTypes().get(10)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = MetricsProto.scalaDescriptor.messages(10)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 4 => __out = io.prometheus.client.Metric
}
__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 3 => io.prometheus.client.MetricType
}
}
lazy val defaultInstance = io.prometheus.client.MetricFamily(
name = _root_.scala.None,
help = _root_.scala.None,
`type` = _root_.scala.None,
metric = _root_.scala.Seq.empty
)
implicit class MetricFamilyLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.prometheus.client.MetricFamily]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.prometheus.client.MetricFamily](_l) {
def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getName)((c_, f_) => c_.copy(name = Option(f_)))
def optionalName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Predef.String]] = field(_.name)((c_, f_) => c_.copy(name = f_))
def help: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getHelp)((c_, f_) => c_.copy(help = Option(f_)))
def optionalHelp: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Predef.String]] = field(_.help)((c_, f_) => c_.copy(help = f_))
def `type`: _root_.scalapb.lenses.Lens[UpperPB, io.prometheus.client.MetricType] = field(_.getType)((c_, f_) => c_.copy(`type` = Option(f_)))
def optionalType: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.prometheus.client.MetricType]] = field(_.`type`)((c_, f_) => c_.copy(`type` = f_))
def metric: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[io.prometheus.client.Metric]] = field(_.metric)((c_, f_) => c_.copy(metric = f_))
}
final val NAME_FIELD_NUMBER = 1
final val HELP_FIELD_NUMBER = 2
final val TYPE_FIELD_NUMBER = 3
final val METRIC_FIELD_NUMBER = 4
def of(
name: _root_.scala.Option[_root_.scala.Predef.String],
help: _root_.scala.Option[_root_.scala.Predef.String],
`type`: _root_.scala.Option[io.prometheus.client.MetricType],
metric: _root_.scala.Seq[io.prometheus.client.Metric]
): _root_.io.prometheus.client.MetricFamily = _root_.io.prometheus.client.MetricFamily(
name,
help,
`type`,
metric
)
// @@protoc_insertion_point(GeneratedMessageCompanion[io.prometheus.client.MetricFamily])
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy