mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
Revert "Provide ability to specify client info in traces (#1631)"
This reverts commit 96af44e41a
.
This commit is contained in:
parent
03a894de1a
commit
68c82e63c6
7 changed files with 2 additions and 51 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
### vNEXT
|
### vNEXT
|
||||||
|
|
||||||
|
- FIXME(@abernix): client info in traces.
|
||||||
- Allow an optional function to resolve the `rootValue`, passing the `DocumentNode` AST to determine the value. [PR #1555](https://github.com/apollographql/apollo-server/pull/1555)
|
- Allow an optional function to resolve the `rootValue`, passing the `DocumentNode` AST to determine the value. [PR #1555](https://github.com/apollographql/apollo-server/pull/1555)
|
||||||
- Follow-up on the work in [PR #1516](https://github.com/apollographql/apollo-server/pull/1516) to also fix missing insertion cursor/caret when a custom GraphQL configuration is specified which doesn't specify its own `cursorShape` property. [PR #1607](https://github.com/apollographql/apollo-server/pull/1607)
|
- Follow-up on the work in [PR #1516](https://github.com/apollographql/apollo-server/pull/1516) to also fix missing insertion cursor/caret when a custom GraphQL configuration is specified which doesn't specify its own `cursorShape` property. [PR #1607](https://github.com/apollographql/apollo-server/pull/1607)
|
||||||
|
|
||||||
|
|
|
@ -365,13 +365,3 @@ addMockFunctionsToSchema({
|
||||||
* `maskErrorDetails`: boolean
|
* `maskErrorDetails`: boolean
|
||||||
|
|
||||||
Set to true to remove error details from the traces sent to Apollo's servers. Defaults to false.
|
Set to true to remove error details from the traces sent to Apollo's servers. Defaults to false.
|
||||||
|
|
||||||
* generateClientInfo?: (o: { context: any, extensions?: Record<string, any>}) => ClientInfo;
|
|
||||||
|
|
||||||
Creates the client information that is attached to the traces sent to the
|
|
||||||
Apollo backend. The context field is the execution context passed to the
|
|
||||||
resolvers and the extensions field corresponds to the same value in the POST
|
|
||||||
body or GET parameters. `ClientInfo` contains fields for `clientName` and
|
|
||||||
`clientVersion`, which are both optional. The default generation copies the
|
|
||||||
respective fields from `extensions.clientInfo`. If `clientName` or
|
|
||||||
`clientVersion` is not present, the values are set to the empty string.
|
|
||||||
|
|
|
@ -34,11 +34,6 @@ Traces.encode = function(message, originalWriter) {
|
||||||
return writer;
|
return writer;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface ClientInfo {
|
|
||||||
clientName?: string;
|
|
||||||
clientVersion?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EngineReportingOptions {
|
export interface EngineReportingOptions {
|
||||||
// API key for the service. Get this from
|
// API key for the service. Get this from
|
||||||
// [Engine](https://engine.apollographql.com) by logging in and creating
|
// [Engine](https://engine.apollographql.com) by logging in and creating
|
||||||
|
@ -88,14 +83,6 @@ export interface EngineReportingOptions {
|
||||||
sendReportsImmediately?: boolean;
|
sendReportsImmediately?: boolean;
|
||||||
// To remove the error message from traces, set this to true. Defaults to false
|
// To remove the error message from traces, set this to true. Defaults to false
|
||||||
maskErrorDetails?: boolean;
|
maskErrorDetails?: boolean;
|
||||||
// Creates the client information attached to the traces sent to the Apollo
|
|
||||||
// backend
|
|
||||||
generateClientInfo?: (
|
|
||||||
o: {
|
|
||||||
context: any;
|
|
||||||
extensions?: Record<string, any>;
|
|
||||||
},
|
|
||||||
) => ClientInfo;
|
|
||||||
|
|
||||||
// XXX Provide a way to set client_name, client_version, client_address,
|
// XXX Provide a way to set client_name, client_version, client_address,
|
||||||
// service, and service_version fields. They are currently not revealed in the
|
// service, and service_version fields. They are currently not revealed in the
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
} from 'graphql-extensions';
|
} from 'graphql-extensions';
|
||||||
import { Trace, google } from 'apollo-engine-reporting-protobuf';
|
import { Trace, google } from 'apollo-engine-reporting-protobuf';
|
||||||
|
|
||||||
import { EngineReportingOptions, ClientInfo } from './agent';
|
import { EngineReportingOptions } from './agent';
|
||||||
import { defaultSignature } from './signature';
|
import { defaultSignature } from './signature';
|
||||||
|
|
||||||
// EngineReportingExtension is the per-request GraphQLExtension which creates a
|
// EngineReportingExtension is the per-request GraphQLExtension which creates a
|
||||||
|
@ -38,12 +38,6 @@ export class EngineReportingExtension<TContext = any>
|
||||||
operationName: string,
|
operationName: string,
|
||||||
trace: Trace,
|
trace: Trace,
|
||||||
) => void;
|
) => void;
|
||||||
private generateClientInfo: (
|
|
||||||
o: {
|
|
||||||
context: any;
|
|
||||||
extensions?: Record<string, any>;
|
|
||||||
},
|
|
||||||
) => ClientInfo;
|
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
options: EngineReportingOptions,
|
options: EngineReportingOptions,
|
||||||
|
@ -57,11 +51,6 @@ export class EngineReportingExtension<TContext = any>
|
||||||
const root = new Trace.Node();
|
const root = new Trace.Node();
|
||||||
this.trace.root = root;
|
this.trace.root = root;
|
||||||
this.nodes.set(responsePathAsString(undefined), root);
|
this.nodes.set(responsePathAsString(undefined), root);
|
||||||
this.generateClientInfo =
|
|
||||||
options.generateClientInfo ||
|
|
||||||
// Default to using the clientInfo field of the request's extensions, when
|
|
||||||
// the ClientInfo fields are undefined, we send the empty string
|
|
||||||
(({ extensions }) => (extensions && extensions.clientInfo) || {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public requestDidStart(o: {
|
public requestDidStart(o: {
|
||||||
|
@ -71,8 +60,6 @@ export class EngineReportingExtension<TContext = any>
|
||||||
variables?: Record<string, any>;
|
variables?: Record<string, any>;
|
||||||
persistedQueryHit?: boolean;
|
persistedQueryHit?: boolean;
|
||||||
persistedQueryRegister?: boolean;
|
persistedQueryRegister?: boolean;
|
||||||
context: any;
|
|
||||||
extensions?: Record<string, any>;
|
|
||||||
}): EndHandler {
|
}): EndHandler {
|
||||||
this.trace.startTime = dateToTimestamp(new Date());
|
this.trace.startTime = dateToTimestamp(new Date());
|
||||||
this.startHrTime = process.hrtime();
|
this.startHrTime = process.hrtime();
|
||||||
|
@ -167,16 +154,6 @@ export class EngineReportingExtension<TContext = any>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// While clientAddress could be a part of the protobuf, we'll ignore it for
|
|
||||||
// now, since the backend does not group by it and Engine frontend will not
|
|
||||||
// support it in the short term
|
|
||||||
const { clientName, clientVersion } = this.generateClientInfo({
|
|
||||||
context: o.context,
|
|
||||||
extensions: o.extensions,
|
|
||||||
});
|
|
||||||
this.trace.clientName = clientName || '';
|
|
||||||
this.trace.clientVersion = clientVersion || '';
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
this.trace.durationNs = durationHrTimeToNanos(
|
this.trace.durationNs = durationHrTimeToNanos(
|
||||||
process.hrtime(this.startHrTime),
|
process.hrtime(this.startHrTime),
|
||||||
|
|
|
@ -402,7 +402,6 @@ export async function runHttpQuery(
|
||||||
: false,
|
: false,
|
||||||
request: request.request,
|
request: request.request,
|
||||||
extensions: optionsObject.extensions,
|
extensions: optionsObject.extensions,
|
||||||
queryExtensions: extensions,
|
|
||||||
persistedQueryHit,
|
persistedQueryHit,
|
||||||
persistedQueryRegister,
|
persistedQueryRegister,
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,7 +66,6 @@ export interface QueryOptions {
|
||||||
cacheControl?: boolean | CacheControlExtensionOptions;
|
cacheControl?: boolean | CacheControlExtensionOptions;
|
||||||
request: Pick<Request, 'url' | 'method' | 'headers'>;
|
request: Pick<Request, 'url' | 'method' | 'headers'>;
|
||||||
extensions?: Array<() => GraphQLExtension>;
|
extensions?: Array<() => GraphQLExtension>;
|
||||||
queryExtensions?: Record<string, any>;
|
|
||||||
persistedQueryHit?: boolean;
|
persistedQueryHit?: boolean;
|
||||||
persistedQueryRegister?: boolean;
|
persistedQueryRegister?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +136,6 @@ function doRunQuery(options: QueryOptions): Promise<GraphQLResponse> {
|
||||||
persistedQueryHit: options.persistedQueryHit,
|
persistedQueryHit: options.persistedQueryHit,
|
||||||
persistedQueryRegister: options.persistedQueryRegister,
|
persistedQueryRegister: options.persistedQueryRegister,
|
||||||
context,
|
context,
|
||||||
extensions: options.queryExtensions,
|
|
||||||
});
|
});
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(
|
.then(
|
||||||
|
|
|
@ -81,7 +81,6 @@ export class GraphQLExtensionStack<TContext = any> {
|
||||||
persistedQueryHit?: boolean;
|
persistedQueryHit?: boolean;
|
||||||
persistedQueryRegister?: boolean;
|
persistedQueryRegister?: boolean;
|
||||||
context: TContext;
|
context: TContext;
|
||||||
extensions?: Record<string, any>;
|
|
||||||
}): EndHandler {
|
}): EndHandler {
|
||||||
return this.handleDidStart(
|
return this.handleDidStart(
|
||||||
ext => ext.requestDidStart && ext.requestDidStart(o),
|
ext => ext.requestDidStart && ext.requestDidStart(o),
|
||||||
|
|
Loading…
Add table
Reference in a new issue