cosmo
cosmo copied to clipboard
chore(rfc): Extend core module system to support metrics
trafficstars
Motivation and Context
It extends the open core module system RFC to enable custom metric modules.
- Expose both the entering point and existing point. RouterRequestHook, SubgraphRequestHook and OperationParse/Normalize/PlanHook It enables taking end to end measurements.
- Create grouped interfaces: RouterHook, SubgraphHook and OperationHook for easier integration
- For response hooks, a correct/meaningful statusCode should be given for easier processing.
- For Error hooks , input error is an object of core.errorType, so the error can be easily casted.
- Operation name/type should be always included in inputs.
- Removed Telemetry Hooks, as with the above updates and refactor telemetry to be part of the the module system, it can be achieved by implementing the default metrics module.
New findings need to be discussed:
- SchemaUsage info needs to populated despite of graphqlMetricsConfig value, graphqlMetricConfig should only turn on/off for the export to control plane part.
Added one example use case.
TODO
- [ ] Tests or benchmark included
- [ ] Documentation is changed or added on https://app.gitbook.com/
- [ ] PR title must follow conventional-commit-standard