update protobuf and remove default branch

This commit is contained in:
James Baxley 2018-10-25 21:10:03 -04:00 committed by Jesse Rosenberger
parent 49052b81d9
commit 3eb0c3e79a
2 changed files with 25 additions and 18 deletions

View file

@ -176,6 +176,13 @@ message Trace {
reserved 12, 13, 1, 2;
}
// The `service` value embedded within the header key is not guaranteed to contain an actual service,
// and, in most cases, the service information is trusted to come from upstream processing. If the
// service _is_ specified in this header, then it is checked to match the context that is reporting it.
// Otherwise, the service information is deduced from the token context of the reporter and then sent
// along via other mechanisms (in Kafka, the `ReportKafkaKey). The other information (hostname,
// agent_version, etc.) is sent by the Apollo Engine Reporting agent, but we do not currently save that
// information to any of our persistent storage.
message ReportHeader {
string service = 3;
// eg "host-01.example.com"
@ -191,7 +198,7 @@ message ReportHeader {
string uname = 9;
// eg "current", "prod"
string schema_tag = 10;
// The hex representation of the sha512 of the schema IDL string
// The hex representation of the sha512 of the introspection response
string schema_hash = 11;
}
@ -201,7 +208,7 @@ message PathErrorStats {
uint64 requests_with_errors_count = 5;
}
message ClientStats {
message ClientNameStats {
// Duration histogram for non-cache-hit queries.
// (See docs/histograms.md for the histogram format.)
repeated int64 latency_count = 1;
@ -212,7 +219,7 @@ message ClientStats {
// have stats reported with contextual information so we can have the specific breakdown we're
// looking for. These fields are somewhat misleading as we never actually do any per-version
// awareness with anything reporting in the legacy "per_client_name" stats, and instead use
// "stats_with_context" to have more contextual information.
// "query_stats_with_context" to have more contextual information.
map<string, uint64> requests_count_per_version = 3; // required
map<string, uint64> cache_hits_per_version = 4;
map<string, uint64> persisted_query_hits_per_version = 10;
@ -239,7 +246,7 @@ message QueryLatencyStats {
repeated int64 private_cache_ttl_count = 10;
}
message ContextualStatsInfo {
message StatsContext {
string client_id = 1;
string client_name = 2;
string client_version = 3;
@ -247,11 +254,11 @@ message ContextualStatsInfo {
message ContextualizedQueryLatencyStats {
QueryLatencyStats query_latency_stats = 1;
ContextualStatsInfo context = 2;
StatsContext context = 2;
}
message ContextualizedTypeStats {
ContextualStatsInfo context = 1;
StatsContext context = 1;
map<string, TypeStat> per_type_stat = 2;
}
@ -272,15 +279,16 @@ message TypeStat {
}
message QueryStats {
// Either per_client_name (for back-compat) or stats_with_context must be specified. If both are
// specified, then stats_with_context will be used and per_client_name will be ignored. Although
// the fields in ClientStats mention things "per-version," the information in the "per-version"
// fields will only ever be over the default version, the empty String: "".
map<string, ClientStats> per_client_name = 1; // deprecated; use stats_with_context instead
// Either per_client_name (for back-compat) or query_stats_with_context must be specified. If both are
// specified, then query_stats_with_context will be used and per_client_name will be ignored. Although
// the fields in ClientNameStats mention things "per-version," the information in the "per-version"
// fields will only ever be over the default version, the empty String: "", if arrived at via the
// FullTracesAggregator.
map<string, ClientNameStats> per_client_name = 1; // deprecated; use stats_with_context instead
repeated ContextualizedQueryLatencyStats query_stats_with_context = 4;
repeated TypeStat per_type = 2; // deprecated; use per_type_stat instead
repeated TypeStat per_type = 2; // deprecated; use type_stats_with_context instead
// Key is the parent type, e.g. "User" for User.email:String!
map<string, TypeStat> per_type_stat = 3;
map<string, TypeStat> per_type_stat = 3; // deprecated; use type_stats_with_context instead
repeated ContextualizedTypeStats type_stats_with_context = 5;
}

View file

@ -125,7 +125,7 @@ export class EngineReportingAgent<TContext = any> {
private reportTimer: any; // timer typing is weird and node-specific
private sendReportsImmediately?: boolean;
private stopped: boolean = false;
private REPORT_HEADER: ReportHeader;
private reportHeader: ReportHeader;
public constructor(
options: EngineReportingOptions<TContext> = {},
@ -139,11 +139,10 @@ export class EngineReportingAgent<TContext = any> {
);
}
this.REPORT_HEADER = new ReportHeader({
this.reportHeader = new ReportHeader({
...serviceHeaderDefaults,
schemaHash,
schemaTag:
options.schemaBranch || process.env.ENGINE_SCHEMA_BRANCH || 'current',
schemaTag: options.schemaBranch || process.env.ENGINE_SCHEMA_BRANCH || '',
});
this.resetReport();
@ -325,7 +324,7 @@ export class EngineReportingAgent<TContext = any> {
}
private resetReport() {
this.report = new FullTracesReport({ header: this.REPORT_HEADER });
this.report = new FullTracesReport({ header: this.reportHeader });
this.reportSize = 0;
}
}