Trace

class Trace(    val start_time: Instant? = null,     val end_time: Instant? = null,     val duration_ns: Long = 0,     val root: Trace.Node? = null,     val is_incomplete: Boolean = false,     val signature: String = "",     val unexecutedOperationBody: String = "",     val unexecutedOperationName: String = "",     val details: Trace.Details? = null,     val client_name: String = "",     val client_version: String = "",     val http: Trace.HTTP? = null,     val cache_policy: Trace.CachePolicy? = null,     val query_plan: Trace.QueryPlanNode? = null,     val full_query_cache_hit: Boolean = false,     val persisted_query_hit: Boolean = false,     val persisted_query_register: Boolean = false,     val registered_operation: Boolean = false,     val forbidden_operation: Boolean = false,     val field_execution_weight: Double = 0.0,     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace, Nothing>

Constructors

Link copied to clipboard
constructor(    start_time: Instant? = null,     end_time: Instant? = null,     duration_ns: Long = 0,     root: Trace.Node? = null,     is_incomplete: Boolean = false,     signature: String = "",     unexecutedOperationBody: String = "",     unexecutedOperationName: String = "",     details: Trace.Details? = null,     client_name: String = "",     client_version: String = "",     http: Trace.HTTP? = null,     cache_policy: Trace.CachePolicy? = null,     query_plan: Trace.QueryPlanNode? = null,     full_query_cache_hit: Boolean = false,     persisted_query_hit: Boolean = false,     persisted_query_register: Boolean = false,     registered_operation: Boolean = false,     forbidden_operation: Boolean = false,     field_execution_weight: Double = 0.0,     unknownFields: ByteString = ByteString.EMPTY)

Types

Link copied to clipboard
class CachePolicy(    val scope: Trace.CachePolicy.Scope = Scope.UNKNOWN,     val max_age_ns: Long = 0,     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.CachePolicy, Nothing>
Link copied to clipboard
object Companion
Link copied to clipboard
class Details(    variables_json: Map<String, String> = emptyMap(),     val operation_name: String = "",     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.Details, Nothing>
Link copied to clipboard
class Error(    val message: String = "",     location: List<Trace.Location> = emptyList(),     val time_ns: Long = 0,     val json: String = "",     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.Error, Nothing>
Link copied to clipboard
class HTTP(    val method: Trace.HTTP.Method = Method.UNKNOWN,     request_headers: Map<String, Trace.HTTP.Values> = emptyMap(),     response_headers: Map<String, Trace.HTTP.Values> = emptyMap(),     val status_code: Int = 0,     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.HTTP, Nothing>
Link copied to clipboard
class Location(val line: Int = 0, val column: Int = 0, unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.Location, Nothing>
Link copied to clipboard
class Node(    val response_name: String? = null,     val index: Int? = null,     val original_field_name: String = "",     val type: String = "",     val parent_type: String = "",     val cache_policy: Trace.CachePolicy? = null,     val start_time: Long = 0,     val end_time: Long = 0,     error: List<Trace.Error> = emptyList(),     child: List<Trace.Node> = emptyList(),     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.Node, Nothing>

We store information on each resolver execution as a Node on a tree. The structure of the tree corresponds to the structure of the GraphQL response; it does not indicate the order in which resolvers were invoked. Note that nodes representing indexes (and the root node) don't contain all Node fields (eg types and times).

Link copied to clipboard
class QueryPlanNode(    val sequence: Trace.QueryPlanNode.SequenceNode? = null,     val parallel: Trace.QueryPlanNode.ParallelNode? = null,     val fetch: Trace.QueryPlanNode.FetchNode? = null,     val flatten: Trace.QueryPlanNode.FlattenNode? = null,     val defer: Trace.QueryPlanNode.DeferNode? = null,     val condition: Trace.QueryPlanNode.ConditionNode? = null,     unknownFields: ByteString = ByteString.EMPTY) : Message<Trace.QueryPlanNode, Nothing>

represents a node in the query plan, under which there is a trace tree for that service fetch. In particular, each fetch node represents a call to an implementing service, and calls to implementing services may not be unique. See https://github.com/apollographql/federation/blob/main/query-planner-js/src/QueryPlan.ts for more information and details.

Properties

Link copied to clipboard
val adapter: ProtoAdapter<Trace>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val details: Trace.Details? = null
Link copied to clipboard
val duration_ns: Long = 0

High precision duration of the trace; may not equal end_time-start_time (eg, if your machine's clock changed during the trace). required

Link copied to clipboard
val end_time: Instant? = null

Wallclock time when the trace ended. required

Link copied to clipboard

Some servers don't do field-level instrumentation for every request and assign each request a "weight" for each request that they do instrument. When this trace is aggregated into field usage stats, it should count as this value towards the estimated_execution_count rather than just 1. This value should typically be at least 1.

Link copied to clipboard

Was this operation forbidden due to lack of safelisting?

Link copied to clipboard

Was this response served from a full query response cache? (In that case the node tree will have no resolvers.)

Link copied to clipboard
val http: Trace.HTTP? = null
Link copied to clipboard
val is_incomplete: Boolean = false

If this is true, the trace is potentially missing some nodes that were present on the query plan. This can happen if the trace span buffer used in the Router fills up and some spans have to be dropped. In these cases the overall trace timing will still be correct, but the trace data could be missing some referenced or executed fields, and some nodes may be missing. If this is true we should display a warning to the user when they view the trace in Explorer.

Link copied to clipboard

Was this query specified successfully as a persisted query hash?

Link copied to clipboard

Did this query contain both a full query string and a persisted query hash? (This typically means that a previous request was rejected as an unknown persisted query.)

Link copied to clipboard

If this Trace was created by a Router/Gateway, this is the query plan, including sub-Traces for subgraphs. Note that the 'root' tree on the top-level Trace won't contain any resolvers (though it could contain errors that occurred in the Router/Gateway itself).

Link copied to clipboard

Was this operation registered and a part of the safelist?

Link copied to clipboard
val root: Trace.Node? = null

A tree containing information about all resolvers run directly by this service, including errors.

Link copied to clipboard

Fields below this line are not included in inline traces (the traces sent from subgraphs to the Router/Gateway). In addition to details.raw_query, we include a "signature" of the query, which can be normalized: for example, you may want to discard aliases, drop unused operations and fragments, sort fields, etc. The most important thing here is that the signature match the signature in StatsReports. In StatsReports signatures show up as the key in the per_query map (with the operation name prepended). The signature should be a valid GraphQL query. All traces must have a signature; if this Trace is in a FullTracesReport that signature is in the key of traces_per_query rather than in this field. Engineproxy provides the signature in legacy_signature_needs_resigning instead.

Link copied to clipboard
val start_time: Instant? = null

Wallclock time when the trace began. required

Link copied to clipboard

Optional: when GraphQL parsing or validation against the GraphQL schema fails, these fields can include reference to the operation being sent for users to dig into the set of operations that are failing validation.

Link copied to clipboard
val unknownFields: ByteString

Functions

Link copied to clipboard
fun copy(    start_time: Instant? = this.start_time,     end_time: Instant? = this.end_time,     duration_ns: Long = this.duration_ns,     root: Trace.Node? = this.root,     is_incomplete: Boolean = this.is_incomplete,     signature: String = this.signature,     unexecutedOperationBody: String = this.unexecutedOperationBody,     unexecutedOperationName: String = this.unexecutedOperationName,     details: Trace.Details? = this.details,     client_name: String = this.client_name,     client_version: String = this.client_version,     http: Trace.HTTP? = this.http,     cache_policy: Trace.CachePolicy? = this.cache_policy,     query_plan: Trace.QueryPlanNode? = this.query_plan,     full_query_cache_hit: Boolean = this.full_query_cache_hit,     persisted_query_hit: Boolean = this.persisted_query_hit,     persisted_query_register: Boolean = this.persisted_query_register,     registered_operation: Boolean = this.registered_operation,     forbidden_operation: Boolean = this.forbidden_operation,     field_execution_weight: Double = this.field_execution_weight,     unknownFields: ByteString = this.unknownFields): Trace
Link copied to clipboard
fun encode(sink: BufferedSink)
Link copied to clipboard
fun encodeByteString(): ByteString
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String