Skip to content

Commit

Permalink
Update code and snapshots after proto update
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnici authored and abernix committed May 3, 2024
1 parent a4ba9d3 commit 283078a
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions apollo-router/src/plugins/telemetry/proto/reports.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ syntax = "proto3";

import "google/protobuf/timestamp.proto";



message Trace {
message CachePolicy {
enum Scope {
Expand Down Expand Up @@ -196,6 +198,26 @@ message Trace {
}
}

// The cost of the operation
message Limits {
// The result of the operation.
string result = 1;
// The strategy used in cost calculations.
string strategy = 2;
// The estimated cost as calculated via the strategy specified in strategy
uint64 cost_estimated = 3;
// The actual cost using the strategy specified in strategy
uint64 cost_actual = 4;
// The depth of the query
uint64 depth = 5;
// The height of the query
uint64 height = 6;
// The number of aliases in the query
uint64 alias_count = 7;
// The number of root fields in the query
uint64 root_field_count = 8;
}

// Wallclock time when the trace began.
google.protobuf.Timestamp start_time = 4; // required
// Wallclock time when the trace ended.
Expand Down Expand Up @@ -283,6 +305,9 @@ message Trace {
// 0 is treated as 1 for backwards compatibility.
double field_execution_weight = 31;

// The limits information of the query.
Limits limits = 32;


// removed: Node parse = 12; Node validate = 13;
// Id128 server_id = 1; Id128 client_id = 2;
Expand Down Expand Up @@ -369,6 +394,29 @@ message QueryLatencyStats {
reserved 1, 6, 9, 10;
}

// Stats on the query that can be populated by the gateway or router.
message LimitsStats {
// The strategy used in cost calculations.
string strategy = 1;
// The estimated cost as calculated via the strategy specified in stats context
// The reason that this is a histogram rather than fixed cost is that it can be affected by paging variables.
repeated sint64 cost_estimated = 2 [(js_use_toArray) = true];
// The maximum estimated cost of the query
uint64 max_cost_estimated = 3;
// The actual cost using the strategy specified in stats context
repeated sint64 cost_actual = 4 [(js_use_toArray) = true];
// The maximum estimated cost of the query
uint64 max_cost_actual = 5;
// The total depth of the query
uint64 depth = 6;
// The height of the query
uint64 height = 7;
// The number of aliases in the query
uint64 alias_count = 8;
// The number of root fields in the query
uint64 root_field_count = 9;
}

// The context around a block of stats and traces indicating from which client the operation was executed and its
// operation type. Operation type and subtype are only used by Apollo Router.
message StatsContext {
Expand All @@ -377,6 +425,9 @@ message StatsContext {
string client_version = 3;
string operation_type = 4;
string operation_subtype = 5;
// The result of the operation. Either OK or the error code that caused the operation to fail.
// This will not contain all errors from a query, only the primary reason the operation failed. e.g. a limits failure or an auth failure.
string result = 6;
}

message ContextualizedQueryLatencyStats {
Expand Down Expand Up @@ -424,12 +475,27 @@ message FieldStat {
reserved 1, 2, 7, 8;
}

// As FieldStat only gets returned for FTV1 payloads this is a separate message that can be used to collect stats in the router or gateway obtained directly from the request schema and response.
message LocalFieldStat {
string return_type = 1; // required; eg "String!" for User.email:String!
// Histogram of returned array sizes
repeated sint64 array_size = 2 [(js_use_toArray) = true];
}

message TypeStat {
// Key is (eg) "email" for User.email:String!
map<string, FieldStat> per_field_stat = 3;

reserved 1, 2;
}

message LocalTypeStat {
// Key is (eg) "email" for User.email:String!
// Unlike FieldStat, this is populated outside of FTV1 requests.
map<string, LocalFieldStat> local_per_field_stat = 1;
}


message ReferencedFieldsForType {
// Contains (eg) "email" for User.email:String!
repeated string field_names = 1;
Expand Down Expand Up @@ -482,13 +548,24 @@ message Report {
bool traces_pre_aggregated = 7;
}


message ContextualizedStats {
StatsContext context = 1;
QueryLatencyStats query_latency_stats = 2;
// Key is type name. This structure provides data for the count and latency of individual
// field executions and thus only reflects operations for which field-level tracing occurred.
map<string, TypeStat> per_type_stat = 3;

// Per type stats that are obtained directly by the router or gateway rather than FTV1.
map<string, LocalTypeStat> local_per_type_stat = 7;

// Stats that contain limits information for the query.
LimitsStats limits_stats = 8;

// Total number of operations processed during this period for this context. This includes all operations, even if they are sampled
// and not included in the query latency stats.
uint64 operation_count = 9;

reserved 4, 5;
}

Expand Down Expand Up @@ -523,3 +600,4 @@ message TracesAndStats {

reserved 3;
}

0 comments on commit 283078a

Please sign in to comment.