-
Notifications
You must be signed in to change notification settings - Fork 2k
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 toggle for including error messages in reports #1615
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,10 @@ export class EngineReportingExtension<TContext = any> | |
options: EngineReportingOptions, | ||
addTrace: (signature: string, operationName: string, trace: Trace) => void, | ||
) { | ||
this.options = options; | ||
this.options = { | ||
sendErrorTraces: true, | ||
...options, | ||
}; | ||
this.addTrace = addTrace; | ||
const root = new Trace.Node(); | ||
this.trace.root = root; | ||
|
@@ -225,15 +228,22 @@ export class EngineReportingExtension<TContext = any> | |
node = specificNode; | ||
} | ||
} | ||
node!.error!.push( | ||
new Trace.Error({ | ||
message: error.message, | ||
location: (error.locations || []).map( | ||
({ line, column }) => new Trace.Location({ line, column }), | ||
), | ||
json: JSON.stringify(error), | ||
}), | ||
); | ||
|
||
// With noErrorTraces, the Engine proxy strips all error information | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't explain the behavior by comparing it to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay that makes sense. I'll include the comment in the commit message. I think it's important to understand the context around how AS2 differs from the proxy. |
||
// from the traces and sends error counts inside of the aggregated stats | ||
// reports. To get similar behavior inside of the apollo server metrics | ||
// reporting, we always send a trace and mask out the PII | ||
const errorInfo = this.options.sendErrorTraces | ||
? { | ||
message: error.message, | ||
location: (error.locations || []).map( | ||
({ line, column }) => new Trace.Location({ line, column }), | ||
), | ||
json: JSON.stringify(error), | ||
} | ||
: { message: 'Masked by Apollo Engine Reporting' }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it |
||
|
||
node!.error!.push(new Trace.Error(errorInfo)); | ||
}); | ||
} | ||
} | ||
|
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.
Since this setting isn't really about whether or not to send a trace, maybe it should be something like
maskErrors
ormaskErrorDetails
?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.
Totally! The name is definitely an artifact of evolving from not sending them completely to masking