scalapb.mdg.engine.proto.reports.Report.scala Maven / Gradle / Ivy
The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package mdg.engine.proto.reports
/** This is the top-level message used by the new traces ingress. This
* is designed for the apollo-engine-reporting TypeScript agent and will
* eventually be documented as a public ingress API. This message consists
* solely of traces; the equivalent of the StatsReport is automatically
* generated server-side from this message. Agent should either send a trace or include it in the stats
* for every request in this report. Generally, buffering up until a large
* size has been reached (say, 4MB) or 5-10 seconds has passed is appropriate.
* This message used to be know as FullTracesReport, but got renamed since it isn't just for traces anymore
*
* @param tracesPerQuery
* key is statsReportKey (# operationName&92;nsignature) Note that the nested
* traces will *not* have a signature or details.operationName (because the
* key is adequate).
*
* We also assume that traces don't have
* legacy_per_query_implicit_operation_name, and we don't require them to have
* details.raw_query (which would consume a lot of space and has privacy/data
* access issues, and isn't currently exposed by our app anyway).
* @param endTime
* This is the time that the requests in this trace are considered to have taken place
* If this field is not present the max of the end_time of each trace will be used instead.
* If there are no traces and no end_time present the report will not be able to be processed.
* Note: This will override the end_time from traces.
* required if no traces in this message
*/
@SerialVersionUID(0L)
final case class Report(
header: _root_.scala.Option[mdg.engine.proto.reports.ReportHeader] = _root_.scala.None,
tracesPerQuery: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats] = _root_.scala.collection.immutable.Map.empty,
endTime: _root_.scala.Option[com.google.protobuf.timestamp.Timestamp] = _root_.scala.None,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Report] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (header.isDefined) {
val __value = header.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
tracesPerQuery.foreach { __item =>
val __value = mdg.engine.proto.reports.Report._typemapper_tracesPerQuery.toBase(__item)
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
if (endTime.isDefined) {
val __value = endTime.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 = {
header.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
endTime.foreach { __v =>
val __m = __v
_output__.writeTag(2, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
tracesPerQuery.foreach { __v =>
val __m = mdg.engine.proto.reports.Report._typemapper_tracesPerQuery.toBase(__v)
_output__.writeTag(5, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def getHeader: mdg.engine.proto.reports.ReportHeader = header.getOrElse(mdg.engine.proto.reports.ReportHeader.defaultInstance)
def clearHeader: Report = copy(header = _root_.scala.None)
def withHeader(__v: mdg.engine.proto.reports.ReportHeader): Report = copy(header = Option(__v))
def clearTracesPerQuery = copy(tracesPerQuery = _root_.scala.collection.immutable.Map.empty)
def addTracesPerQuery(__vs: (_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats) *): Report = addAllTracesPerQuery(__vs)
def addAllTracesPerQuery(__vs: Iterable[(_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats)]): Report = copy(tracesPerQuery = tracesPerQuery ++ __vs)
def withTracesPerQuery(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats]): Report = copy(tracesPerQuery = __v)
def getEndTime: com.google.protobuf.timestamp.Timestamp = endTime.getOrElse(com.google.protobuf.timestamp.Timestamp.defaultInstance)
def clearEndTime: Report = copy(endTime = _root_.scala.None)
def withEndTime(__v: com.google.protobuf.timestamp.Timestamp): Report = copy(endTime = Option(__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 => header.orNull
case 5 => tracesPerQuery.iterator.map(mdg.engine.proto.reports.Report._typemapper_tracesPerQuery.toBase(_)).toSeq
case 2 => endTime.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 => header.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 5 => _root_.scalapb.descriptors.PRepeated(tracesPerQuery.iterator.map(mdg.engine.proto.reports.Report._typemapper_tracesPerQuery.toBase(_).toPMessage).toVector)
case 2 => endTime.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: mdg.engine.proto.reports.Report.type = mdg.engine.proto.reports.Report
// @@protoc_insertion_point(GeneratedMessage[mdg.engine.proto.Report])
}
object Report extends scalapb.GeneratedMessageCompanion[mdg.engine.proto.reports.Report] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[mdg.engine.proto.reports.Report] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): mdg.engine.proto.reports.Report = {
var __header: _root_.scala.Option[mdg.engine.proto.reports.ReportHeader] = _root_.scala.None
val __tracesPerQuery: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats]
var __endTime: _root_.scala.Option[com.google.protobuf.timestamp.Timestamp] = _root_.scala.None
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__header = _root_.scala.Option(__header.fold(_root_.scalapb.LiteParser.readMessage[mdg.engine.proto.reports.ReportHeader](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 42 =>
__tracesPerQuery += mdg.engine.proto.reports.Report._typemapper_tracesPerQuery.toCustom(_root_.scalapb.LiteParser.readMessage[mdg.engine.proto.reports.Report.TracesPerQueryEntry](_input__))
case 18 =>
__endTime = _root_.scala.Option(__endTime.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.timestamp.Timestamp](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
mdg.engine.proto.reports.Report(
header = __header,
tracesPerQuery = __tracesPerQuery.result(),
endTime = __endTime,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[mdg.engine.proto.reports.Report] = _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.")
mdg.engine.proto.reports.Report(
header = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[mdg.engine.proto.reports.ReportHeader]]),
tracesPerQuery = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Seq[mdg.engine.proto.reports.Report.TracesPerQueryEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(mdg.engine.proto.reports.Report._typemapper_tracesPerQuery.toCustom(_)).toMap,
endTime = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.timestamp.Timestamp]])
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ReportsProto.javaDescriptor.getMessageTypes().get(11)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ReportsProto.scalaDescriptor.messages(11)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = mdg.engine.proto.reports.ReportHeader
case 5 => __out = mdg.engine.proto.reports.Report.TracesPerQueryEntry
case 2 => __out = com.google.protobuf.timestamp.Timestamp
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
_root_.mdg.engine.proto.reports.Report.TracesPerQueryEntry
)
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = mdg.engine.proto.reports.Report(
header = _root_.scala.None,
tracesPerQuery = _root_.scala.collection.immutable.Map.empty,
endTime = _root_.scala.None
)
@SerialVersionUID(0L)
final case class TracesPerQueryEntry(
key: _root_.scala.Predef.String = "",
value: _root_.scala.Option[mdg.engine.proto.reports.TracesAndStats] = _root_.scala.None,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[TracesPerQueryEntry] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
{
val __value = key
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
}
};
if (value.isDefined) {
val __value = value.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 = {
{
val __v = key
if (!__v.isEmpty) {
_output__.writeString(1, __v)
}
};
value.foreach { __v =>
val __m = __v
_output__.writeTag(2, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def withKey(__v: _root_.scala.Predef.String): TracesPerQueryEntry = copy(key = __v)
def getValue: mdg.engine.proto.reports.TracesAndStats = value.getOrElse(mdg.engine.proto.reports.TracesAndStats.defaultInstance)
def clearValue: TracesPerQueryEntry = copy(value = _root_.scala.None)
def withValue(__v: mdg.engine.proto.reports.TracesAndStats): TracesPerQueryEntry = copy(value = Option(__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 = key
if (__t != "") __t else null
}
case 2 => value.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 => _root_.scalapb.descriptors.PString(key)
case 2 => value.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: mdg.engine.proto.reports.Report.TracesPerQueryEntry.type = mdg.engine.proto.reports.Report.TracesPerQueryEntry
// @@protoc_insertion_point(GeneratedMessage[mdg.engine.proto.Report.TracesPerQueryEntry])
}
object TracesPerQueryEntry extends scalapb.GeneratedMessageCompanion[mdg.engine.proto.reports.Report.TracesPerQueryEntry] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[mdg.engine.proto.reports.Report.TracesPerQueryEntry] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): mdg.engine.proto.reports.Report.TracesPerQueryEntry = {
var __key: _root_.scala.Predef.String = ""
var __value: _root_.scala.Option[mdg.engine.proto.reports.TracesAndStats] = _root_.scala.None
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__key = _input__.readStringRequireUtf8()
case 18 =>
__value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[mdg.engine.proto.reports.TracesAndStats](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
mdg.engine.proto.reports.Report.TracesPerQueryEntry(
key = __key,
value = __value,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[mdg.engine.proto.reports.Report.TracesPerQueryEntry] = _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.")
mdg.engine.proto.reports.Report.TracesPerQueryEntry(
key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[mdg.engine.proto.reports.TracesAndStats]])
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = mdg.engine.proto.reports.Report.javaDescriptor.getNestedTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = mdg.engine.proto.reports.Report.scalaDescriptor.nestedMessages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 2 => __out = mdg.engine.proto.reports.TracesAndStats
}
__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 = mdg.engine.proto.reports.Report.TracesPerQueryEntry(
key = "",
value = _root_.scala.None
)
implicit class TracesPerQueryEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, mdg.engine.proto.reports.Report.TracesPerQueryEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, mdg.engine.proto.reports.Report.TracesPerQueryEntry](_l) {
def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_))
def value: _root_.scalapb.lenses.Lens[UpperPB, mdg.engine.proto.reports.TracesAndStats] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_)))
def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[mdg.engine.proto.reports.TracesAndStats]] = field(_.value)((c_, f_) => c_.copy(value = f_))
}
final val KEY_FIELD_NUMBER = 1
final val VALUE_FIELD_NUMBER = 2
@transient
implicit val keyValueMapper: _root_.scalapb.TypeMapper[mdg.engine.proto.reports.Report.TracesPerQueryEntry, (_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats)] =
_root_.scalapb.TypeMapper[mdg.engine.proto.reports.Report.TracesPerQueryEntry, (_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats)](__m => (__m.key, __m.getValue))(__p => mdg.engine.proto.reports.Report.TracesPerQueryEntry(__p._1, Some(__p._2)))
def of(
key: _root_.scala.Predef.String,
value: _root_.scala.Option[mdg.engine.proto.reports.TracesAndStats]
): _root_.mdg.engine.proto.reports.Report.TracesPerQueryEntry = _root_.mdg.engine.proto.reports.Report.TracesPerQueryEntry(
key,
value
)
// @@protoc_insertion_point(GeneratedMessageCompanion[mdg.engine.proto.Report.TracesPerQueryEntry])
}
implicit class ReportLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, mdg.engine.proto.reports.Report]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, mdg.engine.proto.reports.Report](_l) {
def header: _root_.scalapb.lenses.Lens[UpperPB, mdg.engine.proto.reports.ReportHeader] = field(_.getHeader)((c_, f_) => c_.copy(header = _root_.scala.Option(f_)))
def optionalHeader: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[mdg.engine.proto.reports.ReportHeader]] = field(_.header)((c_, f_) => c_.copy(header = f_))
def tracesPerQuery: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats]] = field(_.tracesPerQuery)((c_, f_) => c_.copy(tracesPerQuery = f_))
def endTime: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.timestamp.Timestamp] = field(_.getEndTime)((c_, f_) => c_.copy(endTime = _root_.scala.Option(f_)))
def optionalEndTime: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.timestamp.Timestamp]] = field(_.endTime)((c_, f_) => c_.copy(endTime = f_))
}
final val HEADER_FIELD_NUMBER = 1
final val TRACES_PER_QUERY_FIELD_NUMBER = 5
final val END_TIME_FIELD_NUMBER = 2
@transient
private[reports] val _typemapper_tracesPerQuery: _root_.scalapb.TypeMapper[mdg.engine.proto.reports.Report.TracesPerQueryEntry, (_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats)] = implicitly[_root_.scalapb.TypeMapper[mdg.engine.proto.reports.Report.TracesPerQueryEntry, (_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats)]]
def of(
header: _root_.scala.Option[mdg.engine.proto.reports.ReportHeader],
tracesPerQuery: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, mdg.engine.proto.reports.TracesAndStats],
endTime: _root_.scala.Option[com.google.protobuf.timestamp.Timestamp]
): _root_.mdg.engine.proto.reports.Report = _root_.mdg.engine.proto.reports.Report(
header,
tracesPerQuery,
endTime
)
// @@protoc_insertion_point(GeneratedMessageCompanion[mdg.engine.proto.Report])
}