-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new augmentLogEntry
property
#148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Mick. Re your comment, should the additional log props be spread at the start of the object so they cannot override the fixed props?
I'm not sure if you're up agains the same general vulnerabilities as I was. I decided to try updating ts-toolkit config and all packages, which worked and was overall probably easier than addressing piecemeal, e.g.:
|
I realised that ultimately it's
Do you think we should update |
Let me try that. |
Oh yeah sorry I forgot that was in another package. Lols at the abstractions, I thought we might use more than just ApolloServer. Such a minor thing, not worth worrying about, twas my doing anyway :) |
@cuzzlor I think I got there, but it tool me too many attempts for me to have confidence to merge this as-is. Would you be able to have another look? I ran |
Thanks @mderriey - I had a look at the build output locally and it's looking good. I'm gonna merge for you. |
Fixes #147
What
This adds a new optional property called
augmentLogEntry
which allows consumers to add additional properties to the "GraphQL operation" log entry emitted by the logging plugin.Why
We have a project where we compute a cost associated with each GraphQL operation and want this to be logged.
At the moment, we emit a separate log entry that contains only this information.
It would make sense to log this with the "GraphQL operation" log entry.
Tests
I'm not sure how we could set up automated tests for this, so I installed the built version locally in our project and made the following changes:
I ran our app locally, made a query, and this is what the Apire dashboard shows:
The one concern is that
logGraphQLOperation
spreadsrest
at the end, which gives consumers the ability to override "fixed" properties. Probably not an issue right now.https://github.com/MakerXStudio/graphql-core/blob/532c8d9559fd359aab524287bcc980247858c94a/src/logging.ts#L79-L109
Security advisories
The initial PR workflow run had a bunch of issues, which I resolved with:
npm update --save
, andnpm install --save-dev rollup@latest
; I'm not sure if rollup being pinned was explicit or not, I took it back to a^
version constraint.