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

io.envoyproxy.envoy.api.v2.route.Tracing.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.api.v2.route

/** @param clientSampling
  *   Target percentage of requests managed by this HTTP connection manager that will be force
  *   traced if the :ref:`x-client-trace-id <config_http_conn_man_headers_x-client-trace-id>`
  *   header is set. This field is a direct analog for the runtime variable
  *   'tracing.client_sampling' in the :ref:`HTTP Connection Manager
  *   <config_http_conn_man_runtime>`.
  *   Default: 100%
  * @param randomSampling
  *   Target percentage of requests managed by this HTTP connection manager that will be randomly
  *   selected for trace generation, if not requested by the client or not forced. This field is
  *   a direct analog for the runtime variable 'tracing.random_sampling' in the
  *   :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
  *   Default: 100%
  * @param overallSampling
  *   Target percentage of requests managed by this HTTP connection manager that will be traced
  *   after all other sampling checks have been applied (client-directed, force tracing, random
  *   sampling). This field functions as an upper limit on the total configured sampling rate. For
  *   instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1%
  *   of client requests with the appropriate headers to be force traced. This field is a direct
  *   analog for the runtime variable 'tracing.global_enabled' in the
  *   :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
  *   Default: 100%
  * @param customTags
  *   A list of custom tags with unique tag name to create tags for the active span.
  *   It will take effect after merging with the :ref:`corresponding configuration
  *   <envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.Tracing.custom_tags>`
  *   configured in the HTTP connection manager. If two tags with the same name are configured
  *   each in the HTTP connection manager and the route level, the one configured here takes
  *   priority.
  */
@SerialVersionUID(0L)
final case class Tracing(
    clientSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent] = _root_.scala.None,
    randomSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent] = _root_.scala.None,
    overallSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent] = _root_.scala.None,
    customTags: _root_.scala.Seq[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Tracing] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (clientSampling.isDefined) {
        val __value = clientSampling.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (randomSampling.isDefined) {
        val __value = randomSampling.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (overallSampling.isDefined) {
        val __value = overallSampling.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      customTags.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 = {
      clientSampling.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      randomSampling.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      overallSampling.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      customTags.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def getClientSampling: io.envoyproxy.envoy.`type`.FractionalPercent = clientSampling.getOrElse(io.envoyproxy.envoy.`type`.FractionalPercent.defaultInstance)
    def clearClientSampling: Tracing = copy(clientSampling = _root_.scala.None)
    def withClientSampling(__v: io.envoyproxy.envoy.`type`.FractionalPercent): Tracing = copy(clientSampling = Option(__v))
    def getRandomSampling: io.envoyproxy.envoy.`type`.FractionalPercent = randomSampling.getOrElse(io.envoyproxy.envoy.`type`.FractionalPercent.defaultInstance)
    def clearRandomSampling: Tracing = copy(randomSampling = _root_.scala.None)
    def withRandomSampling(__v: io.envoyproxy.envoy.`type`.FractionalPercent): Tracing = copy(randomSampling = Option(__v))
    def getOverallSampling: io.envoyproxy.envoy.`type`.FractionalPercent = overallSampling.getOrElse(io.envoyproxy.envoy.`type`.FractionalPercent.defaultInstance)
    def clearOverallSampling: Tracing = copy(overallSampling = _root_.scala.None)
    def withOverallSampling(__v: io.envoyproxy.envoy.`type`.FractionalPercent): Tracing = copy(overallSampling = Option(__v))
    def clearCustomTags = copy(customTags = _root_.scala.Seq.empty)
    def addCustomTags(__vs: io.envoyproxy.envoy.`type`.tracing.v2.CustomTag *): Tracing = addAllCustomTags(__vs)
    def addAllCustomTags(__vs: Iterable[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag]): Tracing = copy(customTags = customTags ++ __vs)
    def withCustomTags(__v: _root_.scala.Seq[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag]): Tracing = copy(customTags = __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 => clientSampling.orNull
        case 2 => randomSampling.orNull
        case 3 => overallSampling.orNull
        case 4 => customTags
      }
    }
    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 => clientSampling.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => randomSampling.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => overallSampling.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => _root_.scalapb.descriptors.PRepeated(customTags.iterator.map(_.toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.api.v2.route.Tracing.type = io.envoyproxy.envoy.api.v2.route.Tracing
    // @@protoc_insertion_point(GeneratedMessage[envoy.api.v2.route.Tracing])
}

object Tracing extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.api.v2.route.Tracing] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.api.v2.route.Tracing] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.api.v2.route.Tracing = {
    var __clientSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent] = _root_.scala.None
    var __randomSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent] = _root_.scala.None
    var __overallSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent] = _root_.scala.None
    val __customTags: _root_.scala.collection.immutable.VectorBuilder[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag] = new _root_.scala.collection.immutable.VectorBuilder[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __clientSampling = Option(__clientSampling.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.`type`.FractionalPercent](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 18 =>
          __randomSampling = Option(__randomSampling.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.`type`.FractionalPercent](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __overallSampling = Option(__overallSampling.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.`type`.FractionalPercent](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 34 =>
          __customTags += _root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag](_input__)
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.api.v2.route.Tracing(
        clientSampling = __clientSampling,
        randomSampling = __randomSampling,
        overallSampling = __overallSampling,
        customTags = __customTags.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.api.v2.route.Tracing] = _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.api.v2.route.Tracing(
        clientSampling = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent]]),
        randomSampling = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent]]),
        overallSampling = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent]]),
        customTags = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = RouteComponentsProto.javaDescriptor.getMessageTypes().get(12)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = RouteComponentsProto.scalaDescriptor.messages(12)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = io.envoyproxy.envoy.`type`.FractionalPercent
      case 2 => __out = io.envoyproxy.envoy.`type`.FractionalPercent
      case 3 => __out = io.envoyproxy.envoy.`type`.FractionalPercent
      case 4 => __out = io.envoyproxy.envoy.`type`.tracing.v2.CustomTag
    }
    __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.api.v2.route.Tracing(
    clientSampling = _root_.scala.None,
    randomSampling = _root_.scala.None,
    overallSampling = _root_.scala.None,
    customTags = _root_.scala.Seq.empty
  )
  implicit class TracingLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.api.v2.route.Tracing]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.api.v2.route.Tracing](_l) {
    def clientSampling: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.`type`.FractionalPercent] = field(_.getClientSampling)((c_, f_) => c_.copy(clientSampling = Option(f_)))
    def optionalClientSampling: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent]] = field(_.clientSampling)((c_, f_) => c_.copy(clientSampling = f_))
    def randomSampling: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.`type`.FractionalPercent] = field(_.getRandomSampling)((c_, f_) => c_.copy(randomSampling = Option(f_)))
    def optionalRandomSampling: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent]] = field(_.randomSampling)((c_, f_) => c_.copy(randomSampling = f_))
    def overallSampling: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.`type`.FractionalPercent] = field(_.getOverallSampling)((c_, f_) => c_.copy(overallSampling = Option(f_)))
    def optionalOverallSampling: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent]] = field(_.overallSampling)((c_, f_) => c_.copy(overallSampling = f_))
    def customTags: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag]] = field(_.customTags)((c_, f_) => c_.copy(customTags = f_))
  }
  final val CLIENT_SAMPLING_FIELD_NUMBER = 1
  final val RANDOM_SAMPLING_FIELD_NUMBER = 2
  final val OVERALL_SAMPLING_FIELD_NUMBER = 3
  final val CUSTOM_TAGS_FIELD_NUMBER = 4
  def of(
    clientSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent],
    randomSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent],
    overallSampling: _root_.scala.Option[io.envoyproxy.envoy.`type`.FractionalPercent],
    customTags: _root_.scala.Seq[io.envoyproxy.envoy.`type`.tracing.v2.CustomTag]
  ): _root_.io.envoyproxy.envoy.api.v2.route.Tracing = _root_.io.envoyproxy.envoy.api.v2.route.Tracing(
    clientSampling,
    randomSampling,
    overallSampling,
    customTags
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.api.v2.route.Tracing])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy