-
Notifications
You must be signed in to change notification settings - Fork 50
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
Improve properties capture for the sendErrorData method #191
Conversation
`sender.sendErrorData` doesn't always receive data object with a properties field. In the case of unhandled errors vscode itself calls this with all the properties being in the top level of the `data` argument. This PR accounts for that and fallbacks to using full data object if a properties field doesn't exist
@microsoft-github-policy-service agree company="Databricks" |
@Joouis this seems to be solving the same problem as microsoft/vscode#193208 but one in the module in one in core. I was curious if either of you had preferences as to where the solution lived. I quite like this one as I feel like it's pretty clean. Downside being that |
I might be mistaken, but to me it looks like the linked PR in the VSCode core is not backwards compatible - it only mixes common properties to the
True, but |
@lramos15 This can work as I thought of it at beginning, and I fully understand the compatibility concern. I don't prefer the idea because this is more like clean shit by downstream comsumers, letting all telemetry packages adapt to this different data structure design? I would say Just my 2 cents, still respect @ilia-db 's and your contribution. |
@Joouis I created some new test cases just to validate the VS Code side is working as expected and I believe it is. The issue here is that the telemetry API doesn't know what special format your sender needs because it supports more than just app insights. Some might want all data at top level and others might want it split into properties and measurements. We try not to manipulate the data structure too much, which is why I believe the manipulation should be done by the library implementer as they know what the end ingestion result needs to be. Maybe the mistake in the API design was trying to manipulate the data structure at all as now we do have some app insights specific knowledge and not instead returning common properties separate for the sender to mixin. Anyways my stance is that this is the better and more consistent approach that doesn't change the expected behavior of the API. |
Hey, I'm using this package and noticed that all unhandled errors reported by it don't have any common properties (like extension or vscode versions).
It seems like
sender.sendErrorData
doesn't always receive data objects with theproperties
field, in which case common properties that the vscode usually supplies to all events or errors will not be sent.In the case of unhandled errors vscode itself calls
sender.sendErrorData
method providing the data object withoutproperties
field.Internally (and publicly through TelemetryLogger extension API) vscode seem to always treat
data
argument asRecord<string, any>
type. It acknowledges thatproperties
might exist while mixing in common props, but it doesn't create such data objects itself.This PR accounts for that and fallbacks to using full data object if the
properties
field doesn't exist, fixing the reporting of unhandled errors.