This package integrates the Apollo Engine proxy with your GraphQL server.
When installed, it starts the Apollo Engine proxy in a new process, then routes GraphQL requests through that proxy:
Please see our Release Notes in the Engine documenation.
import { Engine } from 'apollo-engine';
// create new engine instance from JS config object
const engine = new Engine({ engineConfig: { ... } });
// create new engine instance from file
const engine = new Engine({ engineConfig: 'path/to/config.json' });
await engine.start();
app.use(engine.expressMiddleware());
// ...
// other middleware / handlers
// ...
To shut down engine
engine.stop();
The graphql server should have tracing enabled if available. If you are using Apollo Server (v1.1.0 or newer), enable the tracing: true
configuration option.
This is the minimum necessary information in the engine configuration object to enable sending tracing and telemetry information.
{
"apiKey": "service:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
See the documentation section on configuring the proxy