Skip to content

Commit

Permalink
Try removing custom objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Segaran committed May 21, 2020
1 parent 24b4141 commit 636a4a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
14 changes: 10 additions & 4 deletions packages/apollo-engine-reporting-protobuf/src/reports.proto
Expand Up @@ -4,6 +4,12 @@ package mdg.engine.proto;

import "google/protobuf/timestamp.proto";

import "google/protobuf/descriptor.proto";

extend google.protobuf.FieldOptions {
bool js_use_toArray = 50505;
}

message Trace {
message CachePolicy {
enum Scope {
Expand Down Expand Up @@ -284,16 +290,16 @@ message PathErrorStats {
}

message QueryLatencyStats {
repeated int64 latency_count = 1;
repeated int64 latency_count = 1 [(js_use_toArray)=true];
uint64 request_count = 2;
uint64 cache_hits = 3;
uint64 persisted_query_hits = 4;
uint64 persisted_query_misses = 5;
repeated int64 cache_latency_count = 6;
repeated int64 cache_latency_count = 6 [(js_use_toArray)=true];
PathErrorStats root_error_stats = 7;
uint64 requests_with_errors_count = 8;
repeated int64 public_cache_ttl_count = 9;
repeated int64 private_cache_ttl_count = 10;
repeated int64 public_cache_ttl_count = 9 [(js_use_toArray)=true];
repeated int64 private_cache_ttl_count = 10 [(js_use_toArray)=true];
uint64 registered_operation_count = 11;
uint64 forbidden_operation_count = 12;
}
Expand Down
23 changes: 5 additions & 18 deletions packages/apollo-engine-reporting/src/ContextualizedStats.ts
Expand Up @@ -6,6 +6,8 @@ import {
ContextualizedStats as ContextualizedStatsProto,
ITypeStat as TypeStatProto,
IFieldStat as FieldStatProto,
IQueryLatencyStats,
QueryLatencyStats,
} from 'apollo-engine-reporting-protobuf';

export interface FieldStat {
Expand All @@ -15,22 +17,6 @@ export interface FieldStat {
requestsWithErrorsCount: number;
latencyCount: DurationHistogram;
}

export interface QueryLatencyStats {
readonly latencyCount: DurationHistogram;
requestCount: number;
cacheHits: number;
persistedQueryHits: number;
persistedQueryMisses: number;
readonly cacheLatencyCount: DurationHistogram;
readonly rootErrorStats: IPathErrorStats;
requestsWithErrorCount: number;
readonly publicCacheTtlCount: DurationHistogram;
readonly privateCacheTtlCount: DurationHistogram;
registeredOperationCount: number;
forbiddenOperationCount: number;
}

export class ContextualizedStats {
statsContext: IStatsContext;
queryLatencyStats: QueryLatencyStats;
Expand All @@ -41,7 +27,7 @@ export class ContextualizedStats {

constructor(statsContext: IStatsContext) {
this.statsContext = statsContext;
this.queryLatencyStats = {
this.queryLatencyStats = new QueryLatencyStats({
latencyCount: new DurationHistogram(),
requestCount: 0,
cacheHits: 0,
Expand All @@ -54,10 +40,11 @@ export class ContextualizedStats {
privateCacheTtlCount: new DurationHistogram(),
registeredOperationCount: 0,
forbiddenOperationCount: 0,
};
});
}

public addTrace(trace: Trace) {

const queryLatencyStats = this.queryLatencyStats;
queryLatencyStats.requestCount++;
if (trace.fullQueryCacheHit) {
Expand Down

0 comments on commit 636a4a6

Please sign in to comment.