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

io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.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.envoyproxy.envoy.config.metrics.v2

/** Configuration for disabling stat instantiation.
  * The instantiation of stats is unrestricted by default. If the goal is to configure Envoy to
  * instantiate all stats, there is no need to construct a StatsMatcher.
  *
  * However, StatsMatcher can be used to limit the creation of families of stats in order to
  * conserve memory. Stats can either be disabled entirely, or they can be
  * limited by either an exclusion or an inclusion list of :ref:`StringMatcher
  * <envoy_api_msg_type.matcher.StringMatcher>` protos:
  *
  * * If `reject_all` is set to `true`, no stats will be instantiated. If `reject_all` is set to
  *   `false`, all stats will be instantiated.
  *
  * * If an exclusion list is supplied, any stat name matching *any* of the StringMatchers in the
  *   list will not instantiate.
  *
  * * If an inclusion list is supplied, no stats will instantiate, except those matching *any* of
  *   the StringMatchers in the list.
  *
  *
  * A StringMatcher can be used to match against an exact string, a suffix / prefix, or a regex.
  * **NB:** For performance reasons, it is highly recommended to use a prefix- or suffix-based
  * matcher rather than a regex-based matcher.
  *
  * Example 1. Excluding all stats.
  *
  * .. code-block:: json
  *
  *   {
  *     "statsMatcher": {
  *       "rejectAll": "true"
  *     }
  *   }
  *
  * Example 2. Excluding all cluster-specific stats, but not cluster-manager stats:
  *
  * .. code-block:: json
  *
  *   {
  *     "statsMatcher": {
  *       "exclusionList": {
  *         "patterns": [
  *           {
  *             "prefix": "cluster."
  *           }
  *         ]
  *       }
  *     }
  *   }
  *
  * Example 3. Including only manager-related stats:
  *
  * .. code-block:: json
  *
  *   {
  *     "statsMatcher": {
  *       "inclusionList": {
  *         "patterns": [
  *           {
  *             "prefix": "cluster_manager."
  *           },
  *           {
  *             "prefix": "listener_manager."
  *           }
  *         ]
  *       }
  *     }
  *   }
  */
@SerialVersionUID(0L)
final case class StatsMatcher(
    statsMatcher: io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.Empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[StatsMatcher] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (statsMatcher.rejectAll.isDefined) {
        val __value = statsMatcher.rejectAll.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(1, __value)
      };
      if (statsMatcher.exclusionList.isDefined) {
        val __value = statsMatcher.exclusionList.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (statsMatcher.inclusionList.isDefined) {
        val __value = statsMatcher.inclusionList.get
        __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 = {
      statsMatcher.rejectAll.foreach { __v =>
        val __m = __v
        _output__.writeBool(1, __m)
      };
      statsMatcher.exclusionList.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      statsMatcher.inclusionList.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def getRejectAll: _root_.scala.Boolean = statsMatcher.rejectAll.getOrElse(false)
    def withRejectAll(__v: _root_.scala.Boolean): StatsMatcher = copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.RejectAll(__v))
    def getExclusionList: io.envoyproxy.envoy.`type`.matcher.ListStringMatcher = statsMatcher.exclusionList.getOrElse(io.envoyproxy.envoy.`type`.matcher.ListStringMatcher.defaultInstance)
    def withExclusionList(__v: io.envoyproxy.envoy.`type`.matcher.ListStringMatcher): StatsMatcher = copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.ExclusionList(__v))
    def getInclusionList: io.envoyproxy.envoy.`type`.matcher.ListStringMatcher = statsMatcher.inclusionList.getOrElse(io.envoyproxy.envoy.`type`.matcher.ListStringMatcher.defaultInstance)
    def withInclusionList(__v: io.envoyproxy.envoy.`type`.matcher.ListStringMatcher): StatsMatcher = copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.InclusionList(__v))
    def clearStatsMatcher: StatsMatcher = copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.Empty)
    def withStatsMatcher(__v: io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher): StatsMatcher = copy(statsMatcher = __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 => statsMatcher.rejectAll.orNull
        case 2 => statsMatcher.exclusionList.orNull
        case 3 => statsMatcher.inclusionList.orNull
      }
    }
    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 => statsMatcher.rejectAll.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => statsMatcher.exclusionList.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => statsMatcher.inclusionList.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.type = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher
    // @@protoc_insertion_point(GeneratedMessage[envoy.config.metrics.v2.StatsMatcher])
}

object StatsMatcher extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.metrics.v2.StatsMatcher] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.metrics.v2.StatsMatcher] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.config.metrics.v2.StatsMatcher = {
    var __statsMatcher: io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.RejectAll(_input__.readBool())
        case 18 =>
          __statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.ExclusionList(__statsMatcher.exclusionList.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.InclusionList(__statsMatcher.inclusionList.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.config.metrics.v2.StatsMatcher(
        statsMatcher = __statsMatcher,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.config.metrics.v2.StatsMatcher] = _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.envoyproxy.envoy.config.metrics.v2.StatsMatcher(
        statsMatcher = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]).map(io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.RejectAll(_))
            .orElse[io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher]]).map(io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.ExclusionList(_)))
            .orElse[io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher]]).map(io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.InclusionList(_)))
            .getOrElse(io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = StatsProto.javaDescriptor.getMessageTypes().get(2)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = StatsProto.scalaDescriptor.messages(2)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = io.envoyproxy.envoy.`type`.matcher.ListStringMatcher
      case 3 => __out = io.envoyproxy.envoy.`type`.matcher.ListStringMatcher
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher(
    statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.Empty
  )
  sealed trait StatsMatcher extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isRejectAll: _root_.scala.Boolean = false
    def isExclusionList: _root_.scala.Boolean = false
    def isInclusionList: _root_.scala.Boolean = false
    def rejectAll: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None
    def exclusionList: _root_.scala.Option[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher] = _root_.scala.None
    def inclusionList: _root_.scala.Option[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher] = _root_.scala.None
  }
  object StatsMatcher {
    @SerialVersionUID(0L)
    case object Empty extends io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class RejectAll(value: _root_.scala.Boolean) extends io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher {
      type ValueType = _root_.scala.Boolean
      override def isRejectAll: _root_.scala.Boolean = true
      override def rejectAll: _root_.scala.Option[_root_.scala.Boolean] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class ExclusionList(value: io.envoyproxy.envoy.`type`.matcher.ListStringMatcher) extends io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher {
      type ValueType = io.envoyproxy.envoy.`type`.matcher.ListStringMatcher
      override def isExclusionList: _root_.scala.Boolean = true
      override def exclusionList: _root_.scala.Option[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class InclusionList(value: io.envoyproxy.envoy.`type`.matcher.ListStringMatcher) extends io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher {
      type ValueType = io.envoyproxy.envoy.`type`.matcher.ListStringMatcher
      override def isInclusionList: _root_.scala.Boolean = true
      override def inclusionList: _root_.scala.Option[io.envoyproxy.envoy.`type`.matcher.ListStringMatcher] = Some(value)
      override def number: _root_.scala.Int = 3
    }
  }
  implicit class StatsMatcherLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.metrics.v2.StatsMatcher]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.config.metrics.v2.StatsMatcher](_l) {
    def rejectAll: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getRejectAll)((c_, f_) => c_.copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.RejectAll(f_)))
    def exclusionList: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.`type`.matcher.ListStringMatcher] = field(_.getExclusionList)((c_, f_) => c_.copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.ExclusionList(f_)))
    def inclusionList: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.`type`.matcher.ListStringMatcher] = field(_.getInclusionList)((c_, f_) => c_.copy(statsMatcher = io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher.InclusionList(f_)))
    def statsMatcher: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher] = field(_.statsMatcher)((c_, f_) => c_.copy(statsMatcher = f_))
  }
  final val REJECT_ALL_FIELD_NUMBER = 1
  final val EXCLUSION_LIST_FIELD_NUMBER = 2
  final val INCLUSION_LIST_FIELD_NUMBER = 3
  def of(
    statsMatcher: io.envoyproxy.envoy.config.metrics.v2.StatsMatcher.StatsMatcher
  ): _root_.io.envoyproxy.envoy.config.metrics.v2.StatsMatcher = _root_.io.envoyproxy.envoy.config.metrics.v2.StatsMatcher(
    statsMatcher
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.config.metrics.v2.StatsMatcher])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy