Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: trace.Span in trace.proto
@file:Suppress("DEPRECATION")
package com.slack.sgp.tracing
import com.squareup.wire.FieldEncoding
import com.squareup.wire.Message
import com.squareup.wire.ProtoAdapter
import com.squareup.wire.ProtoReader
import com.squareup.wire.ProtoWriter
import com.squareup.wire.ReverseProtoWriter
import com.squareup.wire.Syntax.PROTO_3
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.JvmField
import com.squareup.wire.`internal`.immutableCopyOf
import com.squareup.wire.`internal`.redactElements
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.AssertionError
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.DeprecationLevel
import kotlin.Int
import kotlin.Long
import kotlin.Nothing
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import okio.ByteString
/**
* A span defines a single event in a trace.
* This span format is inspired by the zipkin span design at:
* https://github.com/openzipkin/zipkin-api/blob/master/zipkin.proto
*/
public class Span(
/**
* A field that uniquely identifies this event.
* This field usually contains a randomly generated UUID.
* This field is required and encoded as 8 or 16 bytes, in big endian byte order.
*/
@field:WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#BYTES",
label = WireField.Label.OMIT_IDENTITY,
schemaIndex = 0,
)
public val id: ByteString = ByteString.EMPTY,
/**
* This field contains the parent id of this span. It is useful to establish
* a parent-child relationships between spans.
* If empty, this span will be considered a root span.
*/
@field:WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#BYTES",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "parentId",
schemaIndex = 1,
)
public val parent_id: ByteString = ByteString.EMPTY,
/**
* A trace is a directed acyclic graph of spans. All spans with the same trace_id belong to the
* same transaction. This field is required.
*/
@field:WireField(
tag = 3,
adapter = "com.squareup.wire.ProtoAdapter#BYTES",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "traceId",
schemaIndex = 2,
)
public val trace_id: ByteString = ByteString.EMPTY,
/**
* A name for the event.
*/
@field:WireField(
tag = 4,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.OMIT_IDENTITY,
schemaIndex = 3,
)
public val name: String = "",
/**
* The timestamp field stores the epoch microseconds at which this event happened.
* For example: a value of 1551849569000000 represents March 6, 2019 5:19:29 UTC.
* We use fixed64 since it is more wire efficient for than int64 for larger numbers.
* This field is required.
*/
@field:WireField(
tag = 5,
adapter = "com.squareup.wire.ProtoAdapter#FIXED64",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "startTimestampMicros",
schemaIndex = 4,
)
public val start_timestamp_micros: Long = 0L,
/**
* This field stored the duration in microseconds for the event in the critical path.
* For example 150 milliseconds is 150000 microseconds.
* This field is required.
*/
@field:WireField(
tag = 6,
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "durationMicros",
schemaIndex = 5,
)
public val duration_micros: Long = 0L,
tags: List = emptyList(),
unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
/**
* A list of key value pairs.
*/
@field:WireField(
tag = 7,
adapter = "com.slack.sgp.tracing.KeyValue#ADAPTER",
label = WireField.Label.REPEATED,
schemaIndex = 6,
)
public val tags: List = immutableCopyOf("tags", tags)
@Deprecated(
message = "Shouldn't be used in Kotlin",
level = DeprecationLevel.HIDDEN,
)
override fun newBuilder(): Nothing = throw
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is Span) return false
if (unknownFields != other.unknownFields) return false
if (id != other.id) return false
if (parent_id != other.parent_id) return false
if (trace_id != other.trace_id) return false
if (name != other.name) return false
if (start_timestamp_micros != other.start_timestamp_micros) return false
if (duration_micros != other.duration_micros) return false
if (tags != other.tags) return false
return true
}
override fun hashCode(): Int {
var result = super.hashCode
if (result == 0) {
result = unknownFields.hashCode()
result = result * 37 + id.hashCode()
result = result * 37 + parent_id.hashCode()
result = result * 37 + trace_id.hashCode()
result = result * 37 + name.hashCode()
result = result * 37 + start_timestamp_micros.hashCode()
result = result * 37 + duration_micros.hashCode()
result = result * 37 + tags.hashCode()
super.hashCode = result
}
return result
}
override fun toString(): String {
val result = mutableListOf()
result += """id=$id"""
result += """parent_id=$parent_id"""
result += """trace_id=$trace_id"""
result += """name=${sanitize(name)}"""
result += """start_timestamp_micros=$start_timestamp_micros"""
result += """duration_micros=$duration_micros"""
if (tags.isNotEmpty()) result += """tags=$tags"""
return result.joinToString(prefix = "Span{", separator = ", ", postfix = "}")
}
public fun copy(
id: ByteString = this.id,
parent_id: ByteString = this.parent_id,
trace_id: ByteString = this.trace_id,
name: String = this.name,
start_timestamp_micros: Long = this.start_timestamp_micros,
duration_micros: Long = this.duration_micros,
tags: List = this.tags,
unknownFields: ByteString = this.unknownFields,
): Span = Span(id, parent_id, trace_id, name, start_timestamp_micros, duration_micros, tags,
unknownFields)
public companion object {
@JvmField
public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
FieldEncoding.LENGTH_DELIMITED,
Span::class,
"type.googleapis.com/trace.Span",
PROTO_3,
null,
"trace.proto"
) {
override fun encodedSize(`value`: Span): Int {
var size = value.unknownFields.size
if (value.id != okio.ByteString.EMPTY) {
size += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.id)
}
if (value.parent_id != okio.ByteString.EMPTY) {
size += ProtoAdapter.BYTES.encodedSizeWithTag(2, value.parent_id)
}
if (value.trace_id != okio.ByteString.EMPTY) {
size += ProtoAdapter.BYTES.encodedSizeWithTag(3, value.trace_id)
}
if (value.name != "") {
size += ProtoAdapter.STRING.encodedSizeWithTag(4, value.name)
}
if (value.start_timestamp_micros != 0L) {
size += ProtoAdapter.FIXED64.encodedSizeWithTag(5, value.start_timestamp_micros)
}
if (value.duration_micros != 0L) {
size += ProtoAdapter.UINT64.encodedSizeWithTag(6, value.duration_micros)
}
size += KeyValue.ADAPTER.asRepeated().encodedSizeWithTag(7, value.tags)
return size
}
override fun encode(writer: ProtoWriter, `value`: Span) {
if (value.id != okio.ByteString.EMPTY) {
ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.id)
}
if (value.parent_id != okio.ByteString.EMPTY) {
ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.parent_id)
}
if (value.trace_id != okio.ByteString.EMPTY) {
ProtoAdapter.BYTES.encodeWithTag(writer, 3, value.trace_id)
}
if (value.name != "") {
ProtoAdapter.STRING.encodeWithTag(writer, 4, value.name)
}
if (value.start_timestamp_micros != 0L) {
ProtoAdapter.FIXED64.encodeWithTag(writer, 5, value.start_timestamp_micros)
}
if (value.duration_micros != 0L) {
ProtoAdapter.UINT64.encodeWithTag(writer, 6, value.duration_micros)
}
KeyValue.ADAPTER.asRepeated().encodeWithTag(writer, 7, value.tags)
writer.writeBytes(value.unknownFields)
}
override fun encode(writer: ReverseProtoWriter, `value`: Span) {
writer.writeBytes(value.unknownFields)
KeyValue.ADAPTER.asRepeated().encodeWithTag(writer, 7, value.tags)
if (value.duration_micros != 0L) {
ProtoAdapter.UINT64.encodeWithTag(writer, 6, value.duration_micros)
}
if (value.start_timestamp_micros != 0L) {
ProtoAdapter.FIXED64.encodeWithTag(writer, 5, value.start_timestamp_micros)
}
if (value.name != "") {
ProtoAdapter.STRING.encodeWithTag(writer, 4, value.name)
}
if (value.trace_id != okio.ByteString.EMPTY) {
ProtoAdapter.BYTES.encodeWithTag(writer, 3, value.trace_id)
}
if (value.parent_id != okio.ByteString.EMPTY) {
ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.parent_id)
}
if (value.id != okio.ByteString.EMPTY) {
ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.id)
}
}
override fun decode(reader: ProtoReader): Span {
var id: ByteString = ByteString.EMPTY
var parent_id: ByteString = ByteString.EMPTY
var trace_id: ByteString = ByteString.EMPTY
var name: String = ""
var start_timestamp_micros: Long = 0L
var duration_micros: Long = 0L
val tags = mutableListOf()
val unknownFields = reader.forEachTag { tag ->
when (tag) {
1 -> id = ProtoAdapter.BYTES.decode(reader)
2 -> parent_id = ProtoAdapter.BYTES.decode(reader)
3 -> trace_id = ProtoAdapter.BYTES.decode(reader)
4 -> name = ProtoAdapter.STRING.decode(reader)
5 -> start_timestamp_micros = ProtoAdapter.FIXED64.decode(reader)
6 -> duration_micros = ProtoAdapter.UINT64.decode(reader)
7 -> tags.add(KeyValue.ADAPTER.decode(reader))
else -> reader.readUnknownField(tag)
}
}
return Span(
id = id,
parent_id = parent_id,
trace_id = trace_id,
name = name,
start_timestamp_micros = start_timestamp_micros,
duration_micros = duration_micros,
tags = tags,
unknownFields = unknownFields
)
}
override fun redact(`value`: Span): Span = value.copy(
tags = value.tags.redactElements(KeyValue.ADAPTER),
unknownFields = ByteString.EMPTY
)
}
private const val serialVersionUID: Long = 0L
}
}