chore(metrics): notification about slow graphql operations - #676
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds slow-operation alerting for GraphQL and MongoDB by reporting to Hawk, with supporting helpers to build/redact request context and new unit tests to validate alert behavior.
Changes:
- Introduces
notifySlowOperationhelper (threshold-based) and reuses it from GraphQL and MongoDB metrics. - Adds
buildGraphqlRequestContextto extract/redact variables and highlight key identifiers for alert context. - Adds unit tests for slow-operation alerting and GraphQL request context construction.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/metrics/slowOperationAlert.test.ts | Adds tests asserting slow operations trigger Hawk alerts and fast/test-env operations do not. |
| test/metrics/graphqlRequestDetails.test.ts | Adds tests for request-context extraction and variable redaction/highlighting. |
| src/metrics/slowOperationAlert.ts | Adds shared slow-operation notification helper and truncation utility. |
| src/metrics/mongodb.ts | Emits slow-command alerts for MongoDB command success/failure paths with relevant context. |
| src/metrics/graphqlRequestDetails.ts | Adds GraphQL request context builder to support richer slow-operation alerts. |
| src/metrics/graphql.ts | Triggers slow-operation alerts for GraphQL operations and includes request/error context. |
| package.json | Bumps package patch version. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Setup alerts for slow GraphQL and MongoDB operations