Skip to content

Commit

Permalink
feat: report on reaching max queue size (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnithin authored Dec 10, 2024
1 parent 5292ffe commit 1800589
Show file tree
Hide file tree
Showing 13 changed files with 421 additions and 338 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"lint:fix": "pnpm run -r --parallel lint:fix",
"clean": "del-cli '**/node_modules/' '**/**/dist/' '**/**/gen/' '**/**/.next' '**/**/tsconfig.tsbuildinfo' '**/**/.eslintcache'",
"release-preview": "lerna publish --ignore-scripts --dry-run",
"release": "lerna publish -y"
"release": "lerna publish -y",
"format": "pnpm -r run format"
},
"devDependencies": {
"@commitlint/cli": "19.2.1",
Expand Down
14 changes: 6 additions & 8 deletions packages/apollo-to-cosmo-metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ const gateway = new ApolloGateway({

// Plugin definition
const cosmoReportPlugin = cosmoReportPlugin(
new CosmoClient({
endpointUrl: 'https://cosmo-metrics.wundergraph.com',
routerToken: 'router-token',
}),
);
new CosmoClient({
endpointUrl: 'https://cosmo-metrics.wundergraph.com',
routerToken: 'router-token',
}),
);

const server = new ApolloServer({
gateway,
plugins: [cosmoReportPlugin],
});

startStandaloneServer(server)

startStandaloneServer(server);
```

99 changes: 50 additions & 49 deletions packages/apollo-to-cosmo-metrics/package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
{
"name": "@wundergraph/apollo-to-cosmo-metrics",
"description": "An apollo gateway plugin that exports schema usage metrics to cosmo",
"version": "0.1.1",
"author": {
"name": "WunderGraph Maintainers",
"email": "info@wundergraph.com"
},
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"repository": {
"url": "https://github.com/wundergraph/apollo-compatibility"
},
"keywords": [
"wundergraph",
"cosmo",
"gateway",
"apollo",
"federation",
"graphql"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"files": [
"dist"
],
"scripts": {
"start": "node ./dist/index.js",
"build": "del dist && tsc",
"test": "tsc -p tsconfig.test.json && vitest run --reporter=default --reporter=hanging-process"
},
"dependencies": {
"@apollo/server": "^4.11.0",
"@bufbuild/protobuf": "^1.9.0",
"@connectrpc/connect": "^1.5.0",
"@connectrpc/connect-node": "^1.5.0",
"@esm2cjs/yocto-queue": "^1.0.0",
"@wundergraph/composition": "^0.29.0",
"graphql": "^16.9.0"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.7.4",
"lodash-es": "^4.17.21",
"typescript": "^5.6.2",
"vitest": "^2.1.3"
}
"name": "@wundergraph/apollo-to-cosmo-metrics",
"description": "An apollo gateway plugin that exports schema usage metrics to cosmo",
"version": "0.1.1",
"author": {
"name": "WunderGraph Maintainers",
"email": "info@wundergraph.com"
},
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"repository": {
"url": "https://github.com/wundergraph/apollo-compatibility"
},
"keywords": [
"wundergraph",
"cosmo",
"gateway",
"apollo",
"federation",
"graphql"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"files": [
"dist"
],
"scripts": {
"start": "node ./dist/index.js",
"build": "del dist && tsc",
"test": "tsc -p tsconfig.test.json && vitest run --reporter=default --reporter=hanging-process",
"format": "prettier --write -c src"
},
"dependencies": {
"@apollo/server": "^4.11.0",
"@bufbuild/protobuf": "^1.9.0",
"@connectrpc/connect": "^1.5.0",
"@connectrpc/connect-node": "^1.5.0",
"@esm2cjs/yocto-queue": "^1.0.0",
"@wundergraph/composition": "^0.29.0",
"graphql": "^16.9.0"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.7.4",
"lodash-es": "^4.17.21",
"typescript": "^5.6.2",
"vitest": "^2.1.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,40 @@
/* eslint-disable */
// @ts-nocheck

import { MethodKind } from "@bufbuild/protobuf";
import { PublishAggregatedGraphQLRequestMetricsRequest, PublishAggregatedGraphQLRequestMetricsResponse, PublishGraphQLRequestMetricsRequest, PublishOperationCoverageReportResponse } from "./graphqlmetrics_pb.js";
import { MethodKind } from '@bufbuild/protobuf';
import {
PublishAggregatedGraphQLRequestMetricsRequest,
PublishAggregatedGraphQLRequestMetricsResponse,
PublishGraphQLRequestMetricsRequest,
PublishOperationCoverageReportResponse,
} from './graphqlmetrics_pb.js';

/**
* PublishGraphQLMetrics publishes the GraphQL metrics to the metrics service
*
* @generated from rpc wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService.PublishGraphQLMetrics
*/
export const publishGraphQLMetrics = {
localName: "publishGraphQLMetrics",
name: "PublishGraphQLMetrics",
localName: 'publishGraphQLMetrics',
name: 'PublishGraphQLMetrics',
kind: MethodKind.Unary,
I: PublishGraphQLRequestMetricsRequest,
O: PublishOperationCoverageReportResponse,
service: {
typeName: "wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService"
}
typeName: 'wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService',
},
} as const;

/**
* @generated from rpc wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService.PublishAggregatedGraphQLMetrics
*/
export const publishAggregatedGraphQLMetrics = {
localName: "publishAggregatedGraphQLMetrics",
name: "PublishAggregatedGraphQLMetrics",
localName: 'publishAggregatedGraphQLMetrics',
name: 'PublishAggregatedGraphQLMetrics',
kind: MethodKind.Unary,
I: PublishAggregatedGraphQLRequestMetricsRequest,
O: PublishAggregatedGraphQLRequestMetricsResponse,
service: {
typeName: "wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService"
}
typeName: 'wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService',
},
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@
/* eslint-disable */
// @ts-nocheck

import { PublishAggregatedGraphQLRequestMetricsRequest, PublishAggregatedGraphQLRequestMetricsResponse, PublishGraphQLRequestMetricsRequest, PublishOperationCoverageReportResponse } from "./graphqlmetrics_pb.js";
import { MethodKind } from "@bufbuild/protobuf";
import {
PublishAggregatedGraphQLRequestMetricsRequest,
PublishAggregatedGraphQLRequestMetricsResponse,
PublishGraphQLRequestMetricsRequest,
PublishOperationCoverageReportResponse,
} from './graphqlmetrics_pb.js';
import { MethodKind } from '@bufbuild/protobuf';

/**
* @generated from service wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService
*/
export const GraphQLMetricsService = {
typeName: "wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService",
typeName: 'wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService',
methods: {
/**
* PublishGraphQLMetrics publishes the GraphQL metrics to the metrics service
*
* @generated from rpc wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService.PublishGraphQLMetrics
*/
publishGraphQLMetrics: {
name: "PublishGraphQLMetrics",
name: 'PublishGraphQLMetrics',
I: PublishGraphQLRequestMetricsRequest,
O: PublishOperationCoverageReportResponse,
kind: MethodKind.Unary,
Expand All @@ -29,11 +34,10 @@ export const GraphQLMetricsService = {
* @generated from rpc wg.cosmo.graphqlmetrics.v1.GraphQLMetricsService.PublishAggregatedGraphQLMetrics
*/
publishAggregatedGraphQLMetrics: {
name: "PublishAggregatedGraphQLMetrics",
name: 'PublishAggregatedGraphQLMetrics',
I: PublishAggregatedGraphQLRequestMetricsRequest,
O: PublishAggregatedGraphQLRequestMetricsResponse,
kind: MethodKind.Unary,
},
}
},
} as const;

Loading

0 comments on commit 1800589

Please sign in to comment.