Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,31 @@ export class BreakingSchemaChangeUsageHelper {

return {
topAffectedOperations: schemaChange.usageStatistics.topAffectedOperations.map(operation => {
const percentage = (operation.count / metadata.usage.totalRequestCount) * 100;
// Note:
// "metadata.usage.totalRequestCount" is sometimes 0 in case of a integration test
// causing a zero devision and GraphQL exception,
// because we aggressively poll for the schema change after publishing usage data
// it seems like clickhouse slighty lags behind for the materialized view here.
// since it only happens in context of an integration test (no production issues)
// we can safely treat 0 as 1 request.
const totalRequestCount = Math.max(1, metadata.usage.totalRequestCount);
const percentage = (operation.count / totalRequestCount) * 100;
return {
...operation,
percentage,
targetIds: metadata.settings.targets.map(target => target.id),
};
}),
topAffectedClients: schemaChange.usageStatistics.topAffectedClients.map(client => {
const percentage = (client.count / metadata.usage.totalRequestCount) * 100;
// Note:
// "metadata.usage.totalRequestCount" is sometimes 0 in case of a integration test
// causing a zero devision and GraphQL exception,
// because we aggressively poll for the schema change after publishing usage data
// it seems like clickhouse slighty lags behind for the materialized view here.
// since it only happens in context of an integration test (no production issues)
// we can safely treat 0 as 1 request.
const totalRequestCount = Math.max(1, metadata.usage.totalRequestCount);
const percentage = (client.count / totalRequestCount) * 100;

return {
...client,
Expand Down
Loading