mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-28 08:17:54 +08:00
* Add optics-agent * Remove namespace and use default tslint tsconfig * Set no implicit this to true
38 lines
886 B
TypeScript
38 lines
886 B
TypeScript
import OpticsAgent, {
|
|
configureAgent,
|
|
instrumentSchema,
|
|
middleware,
|
|
instrumentHapiServer,
|
|
context,
|
|
} from 'optics-agent';
|
|
import { GraphQLSchema } from 'graphql';
|
|
import * as express from 'express';
|
|
import * as hapi from 'hapi';
|
|
var OpticsAgentRequired = require('optics-agent');
|
|
|
|
const configOptions = {
|
|
apiKey: "",
|
|
reportTraces: false,
|
|
reportVariables: false,
|
|
printReports: false,
|
|
normalizeQuery: (info: any) => "",
|
|
endpointUrl: "",
|
|
proxyUrl: "",
|
|
reportIntervalMs: 1,
|
|
};
|
|
OpticsAgent.configureAgent(configOptions)
|
|
|
|
let expressServer = express();
|
|
expressServer.use(OpticsAgent.middleware());
|
|
|
|
let hapiServer = new hapi.Server();
|
|
OpticsAgent.instrumentHapiServer(hapiServer);
|
|
|
|
let req = {} as express.Request;
|
|
OpticsAgent.context(req);
|
|
|
|
const agent = new OpticsAgent.Agent({ apiKey: '1234' });
|
|
|
|
let schema = {} as GraphQLSchema;
|
|
agent.instrumentSchema(schema);
|